fix intermittent calico failures during k8s-bootstrap #175
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR hopefully fixes some of the flakes we have observed when deploying calico on a newly created K8s cluster.
The root cause of the failure is that the
kubectl --kubeconfig $KUBECONFIG create -f https://raw.githubusercontent.com/projectcalico/calico/${CALICO_VERSION}/manifests/custom-resources.yaml
command fails as the cluster doesn't immediately recognise one of the custom resource kinds (defined by the CRD created in the previous step) as there seems to be some delay in CRD creation going through after issuing the kubectl create command of the same. This failure prompts a retry which ultimately fails as it also retries creating custom resources which were already created successfully in the first attempt.This PR applies a two-fold fix
i) Run
kubectl apply
instead ofkubectl create
as it is idempotent and declarativeii) Sleep 10s after the Calico CRDs are created so that the new kinds are fully registered in the cluster etcd