Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix up comments and errors around CRD issues #499

Merged
merged 1 commit into from
Aug 22, 2017

Conversation

ozdanborne
Copy link
Member

@ozdanborne ozdanborne commented Aug 22, 2017

Provide better comments and error messages around the code that checks the datastore is initialized. This error should help alleviate a possibly common scenario where users launch Calico in KDD mode without first creating the custom resources. In that scenario, we were seeing the following error in calico/node:

$ kubectl logs -n kube-system canal-f1rpp -c calico-node -p 
Checking datastore connection
Datastore connection verified
ERROR: Unable to set node resource configuration: Failed to ensure ClusterType is set: timed out waiting for the condition
Terminating
Calico node failed to start

We should now see a more appropriate error: ERROR: Unable to set node resource configuration: Failed to ensure the datastore has been initialized: "timed out waiting for the condition". Make sure the Custom Resource Definitions have been created and Calico has been authorized to access them.

Copy link
Contributor

@bcreane bcreane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

much more helpful error message.

// as a backend but can often fail when using KDD as it relies
// on various custom resources existing.
// To ensure the datastore is initialized, this function checks that a
// known custom resource is defined: FelixGlobalConfigSetting. It accomplishes this
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean GlobalFelixConfig here?

// on various custom resources existing.
// To ensure the datastore is initialized, this function checks that a
// known custom resource is defined: FelixGlobalConfigSetting. It accomplishes this
// by trying to set the ClusterType (an example of FelixGlobalConfigSetting).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure I understand what you mean by an example of FelixGlobalConfigSetting. ClusterType is an instance of GlobalFelixConfig CRD

err := c.waitForClusterType()
if err != nil {
return fmt.Errorf("Failed to ensure ClusterType is set: %s", err)
return fmt.Errorf("Failed to ensure datastore has been initialized: \"%s\". Have you created custom resources and is calico authorized to access them?", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit odd to see a ? in an error message. How about something like: `return fmt.Errorf("Failed to ensure datastore has been initialized: "%s". Make sure the Custom Resource Definitions are created and Calico is authorized to access them", err)

@gunjan5
Copy link
Contributor

gunjan5 commented Aug 22, 2017

JGOC

@ozdanborne ozdanborne merged commit da18e6e into projectcalico:master Aug 22, 2017
@ozdanborne ozdanborne deleted the better-crd-error branch August 22, 2017 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants