When a wrong habitat config is provided using kubectl, it is not very clear if something has gone wrong.
Steps to reproduce
Built it from the current master: 14905ccf3af53eca2bc06ab9ef98646c84f75b8c
$ build-habitat-operator.sh
+ cd /home/hummer/go/src/github.com/habitat-sh/habitat-operator/cmd/habitat-operator
+ go install
and I have this habitat file
$ cat habitat.yml
apiVersion: habitat.sh/v1beta1
kind: Habitat
metadata:
name: random
# this field could also be left out
spec:
foo: bar
Which is an invalid file and I expect some errors, but I see no error while creating it:
$ kubectl create -f habitat.yml
habitat.habitat.sh/random created
Steps to debug
No events reported at all, when checked using kubectl get events.
I see errors only where the operator is being run.
The error being: msg="Habitat could not be synced, requeueing" err="unknown topology: " obj=default/random
$ habitat-operator --kubeconfig ~/.kube/config
ts=2018-08-13T17:58:10.485445153+05:30 level=info msg="created Habitat CRD"
ts=2018-08-13T17:58:10.485664107+05:30 level=info component=controller/v1beta1 msg="Watching Habitat objects"
ts=2018-08-13T17:58:10.50095929+05:30 level=info msg="Habitat CRD already exists, continuing"
ts=2018-08-13T17:58:10.501139664+05:30 level=info component=controller/v1beta2 msg="Watching Habitat objects"
ts=2018-08-13T17:59:30.853233346+05:30 level=error component=controller/v1beta1 msg="Habitat could not be synced, requeueing" err="unknown topology: " obj=default/random
ts=2018-08-13T17:59:30.858439017+05:30 level=error component=controller/v1beta1 msg="Habitat could not be synced, requeueing" err="unknown topology: " obj=default/random
ts=2018-08-13T17:59:30.868620135+05:30 level=error component=controller/v1beta1 msg="Habitat could not be synced, requeueing" err="unknown topology: " obj=default/random
ts=2018-08-13T17:59:30.88881805+05:30 level=error component=controller/v1beta1 msg="Habitat could not be synced, requeueing" err="unknown topology: " obj=default/random
ts=2018-08-13T17:59:30.929034506+05:30 level=error component=controller/v1beta1 msg="Habitat could not be synced, requeueing" err="unknown topology: " obj=default/random
ts=2018-08-13T17:59:31.009246809+05:30 level=error component=controller/v1beta1 msg="Habitat could not be synced, requeueing" err="unknown topology: " obj=default/random
ts=2018-08-13T17:59:31.169442492+05:30 level=error component=controller/v1beta1 msg="Habitat could not be synced, requeueing" err="unknown topology: " obj=default/random
ts=2018-08-13T17:59:31.489618672+05:30 level=error component=controller/v1beta1 msg="Habitat could not be synced, requeueing" err="unknown topology: " obj=default/random
ts=2018-08-13T17:59:32.129864234+05:30 level=error component=controller/v1beta1 msg="Habitat could not be synced, requeueing" err="unknown topology: " obj=default/random
ts=2018-08-13T17:59:33.410042857+05:30 level=error component=controller/v1beta1 msg="Habitat could not be synced, requeueing" err="unknown topology: " obj=default/random
ts=2018-08-13T17:59:35.970280165+05:30 level=error component=controller/v1beta1 msg="Habitat could not be synced, requeueing" err="unknown topology: " obj=default/random
ts=2018-08-13T17:59:41.090486135+05:30 level=error component=controller/v1beta1 msg="Habitat could not be synced, requeueing" err="unknown topology: " obj=default/random
ts=2018-08-13T17:59:51.330690499+05:30 level=error component=controller/v1beta1 msg="Habitat could not be synced, requeueing" err="unknown topology: " obj=default/random
ts=2018-08-13T18:00:10.501855564+05:30 level=error component=controller/v1beta1 msg="Habitat could not be synced, requeueing" err="unknown topology: " obj=default/random
ts=2018-08-13T18:00:11.810923475+05:30 level=error component=controller/v1beta1 msg="Habitat could not be synced, requeueing" err="unknown topology: " obj=default/random
ts=2018-08-13T18:01:10.502015212+05:30 level=error component=controller/v1beta1 msg="Habitat could not be synced, requeueing" err="unknown topology: " obj=default/random
Questions and suggestions
Is this the normal behavior? That I have to see logs of operator to figure out what is wrong?
Can we have a Status in the CRD? Which tells us state of the CR? Because looking at either of following does not tell anything:
$ kubectl get habitats.habitat.sh random -o yaml
apiVersion: habitat.sh/v1beta1
kind: Habitat
metadata:
clusterName: ""
creationTimestamp: 2018-08-13T12:29:30Z
generation: 1
name: random
namespace: default
resourceVersion: "261044"
selfLink: /apis/habitat.sh/v1beta1/namespaces/default/habitats/random
uid: 86f7a3df-9ef4-11e8-ba7d-080027cc5126
spec:
foo: bar
OR
$ kubectl get habitats.habitat.sh
NAME CREATED AT
random 4m
Or should we error out when the config is being sent to via kubectl to server that the config is wrong?
What's wrong?
When a wrong habitat config is provided using kubectl, it is not very clear if something has gone wrong.
Steps to reproduce
Built it from the current master: 14905ccf3af53eca2bc06ab9ef98646c84f75b8c
and I have this habitat file
Which is an invalid file and I expect some errors, but I see no error while creating it:
Steps to debug
No events reported at all, when checked using
kubectl get events
.I see errors only where the operator is being run. The error being:
msg="Habitat could not be synced, requeueing" err="unknown topology: " obj=default/random
Questions and suggestions
Is this the normal behavior? That I have to see logs of operator to figure out what is wrong?
Can we have a
Status
in the CRD? Which tells us state of the CR? Because looking at either of following does not tell anything:OR