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

🐛 Plugin Init improvements #461

Merged
merged 2 commits into from
Apr 9, 2024

Conversation

Fedosin
Copy link
Contributor

@Fedosin Fedosin commented Mar 14, 2024

What this PR does / why we need it:
This PR contains two fixes for the plugin Init operation:

  • Get the latest operator version from the list of all available versions

    Now we use "latest" tag, but due to recent clusterctl changes it forces to download metadata.yaml file which is not available for CAPI operator. Because of that installation fails with exceeded context deadline. To prevent this we specify a version when we create a repo object, and then pick the latest version from the list of all available versions.

  • Add a short delay before deploying providers

    We have to add a short delay here to ensure that the webhooks are successfully started.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #436

/area plugin

Now we use "latest" tag, but due to recent clusterctl changes it forces
to download metadata.yaml file which is not available for CAPI operator.
Because of that installation fails with exceeded context deadline.

To prevent this we specify a version when we create a repo object, and
then pick the latest version from the list of all available versions.
@k8s-ci-robot k8s-ci-robot added area/plugin Issues or PRs related to clusterctl operator plugin cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 14, 2024
@k8s-ci-robot k8s-ci-robot requested review from damdo and JoelSpeed March 14, 2024 14:42
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 14, 2024
Copy link

netlify bot commented Mar 14, 2024

Deploy Preview for kubernetes-sigs-cluster-api-operator ready!

Name Link
🔨 Latest commit a3d27be
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-operator/deploys/6602c0364b7493000978ea07
😎 Deploy Preview https://deploy-preview-461--kubernetes-sigs-cluster-api-operator.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Fedosin Fedosin changed the title Plugin Init improvements 🐛 Plugin Init improvements Mar 14, 2024
@@ -509,6 +513,9 @@ func createGenericProvider(ctx context.Context, client ctrlclient.Client, provid

log.Info("Installing provider", "Type", provider.GetType(), "Name", name, "Version", version, "Namespace", namespace)

// We have to add a short delay here to ensure that the webhooks are successfully started.
time.Sleep(time.Second * 5)
Copy link
Contributor

Choose a reason for hiding this comment

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

are we waiting for CAPI Operator deployment to run?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, we are waiting for webhooks to start. Sometimes when we create provider CRs, they are not ready, and therefore init fails.

but I'm going to add retries instead of the sleep.

Provider creation might fail because webhooks are not initialized yet.
To prevent this, we add retries.
@Fedosin Fedosin force-pushed the plugin_improvements branch from 373502a to a3d27be Compare March 26, 2024 12:31
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 26, 2024
@eljohnson92
Copy link

We have run into this issue as well trying to install the operator and then immediately trying to create a coreprovider resource. could this be solved alternatively through a podReadiness probe that waited until the webhook service was up to mark the operator pod as ready?

Copy link
Member

@Danil-Grigorev Danil-Grigorev left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 5, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 62f99005f4578d872bab0f471c32f5a321b66b11

Copy link
Contributor

@alexander-demicev alexander-demicev left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexander-demicev

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 9, 2024
@k8s-ci-robot k8s-ci-robot merged commit b8643e6 into kubernetes-sigs:main Apr 9, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/plugin Issues or PRs related to clusterctl operator plugin cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plugin init command fails from time to time
5 participants