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 panic when upgrading to v1beta2 #455

Merged
merged 1 commit into from
Dec 21, 2022
Merged

Fix panic when upgrading to v1beta2 #455

merged 1 commit into from
Dec 21, 2022

Conversation

stefanprodan
Copy link
Member

The Kubernetes conversion webhook doesn't set the default value for the newly added interval field, to avoid controller panic, we set the default in code.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Copy link
Member

@relu relu left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the quick fix 👍

@stefanprodan stefanprodan merged commit 98bf74e into main Dec 21, 2022
@stefanprodan stefanprodan deleted the fix-interval branch December 21, 2022 14:07
@oliver-kriska
Copy link

when I manually changed docker image tag to image: ghcr.io/fluxcd/notification-controller:v0.30.1 I got same error:

flux reconcile kustomization infrastructure --with-source
► annotating GitRepository flux-system in flux-system namespace
✔ GitRepository annotated
◎ waiting for GitRepository reconciliation
✔ fetched revision main/a8658086a7a9d8ee228af56dd7af74d7f660b744
► annotating Kustomization infrastructure in flux-system namespace
✔ Kustomization annotated
◎ waiting for Kustomization reconciliation
✗ Kustomization reconciliation failed: Provider/flux-system/slack dry-run failed, error: .spec.interval: field not declared in schema

not sure where to fix it. Any suggestions please?

@stefanprodan
Copy link
Member Author

@oliver-kriska please upgrade Flux to v0.38.1

@stefanprodan
Copy link
Member Author

The .spec.interval: field not declared in schema tells me you haven't updated the CRDs. You need to download the Flux CLI v0.38.1 and rerun bootstrap. After that run flux check and that should display v1beta2 as the version of Providers.

@danports
Copy link

Is rerunning bootstrap necessary for this upgrade? Usually I just update gotk-components.yaml in Git and Flux applies the updated CRDs, but even after reconciliation of the flux-system Kustomization succeeded, flux check still says v1beta1 for the Providers version. kubectl describe crd providers.notification.toolkit.fluxcd.io does show the new v1beta2 version and the .spec.interval field so I'm a little puzzled about what's going on here.

@relu
Copy link
Member

relu commented Dec 21, 2022

@danports you should just upgrade using the same method you've used before. Updating the got-components.yaml to v0.38.1 should do the trick.
This fix does not change the CRD, it only updates the controller logic to ensure we handle the situation when .spec.interval is not set.

@danports
Copy link

Alright, perhaps there is a different issue with the 0.38 release then? I'm seeing the same error as @oliver-kriska (Provider/flux-system/slack dry-run failed, error: .spec.interval: field not declared in schema) every time Flux reconciles the Kustomization containing that Provider despite having updated Flux to 0.38.1, the Flux CRDs in the cluster, and the Provider apiVersion in Git.

@oliver-kriska
Copy link

Thanks, it didn't help, I still have v1beta1

flux check
► checking prerequisites
✔ Kubernetes 1.24.6 >=1.20.6-0
► checking controllers
✔ helm-controller: deployment ready
► ghcr.io/fluxcd/helm-controller:v0.28.0
✔ image-automation-controller: deployment ready
► ghcr.io/fluxcd/image-automation-controller:v0.28.0
✔ image-reflector-controller: deployment ready
► ghcr.io/fluxcd/image-reflector-controller:v0.23.1
✔ kustomize-controller: deployment ready
► ghcr.io/fluxcd/kustomize-controller:v0.32.0
✔ notification-controller: deployment ready
► ghcr.io/fluxcd/notification-controller:v0.30.1
✔ source-controller: deployment ready
► ghcr.io/fluxcd/source-controller:v0.33.0
► checking crds
✔ alerts.notification.toolkit.fluxcd.io/v1beta1
✔ buckets.source.toolkit.fluxcd.io/v1beta2
✔ gitrepositories.source.toolkit.fluxcd.io/v1beta2
✔ helmcharts.source.toolkit.fluxcd.io/v1beta2
✔ helmreleases.helm.toolkit.fluxcd.io/v2beta1
✔ helmrepositories.source.toolkit.fluxcd.io/v1beta2
✔ imagepolicies.image.toolkit.fluxcd.io/v1beta1
✔ imagerepositories.image.toolkit.fluxcd.io/v1beta1
✔ imageupdateautomations.image.toolkit.fluxcd.io/v1beta1
✔ kustomizations.kustomize.toolkit.fluxcd.io/v1beta2
✔ ocirepositories.source.toolkit.fluxcd.io/v1beta2
✔ providers.notification.toolkit.fluxcd.io/v1beta1
✔ receivers.notification.toolkit.fluxcd.io/v1beta1
✔ all checks passed
flux version
flux: v0.38.1
helm-controller: v0.28.0
image-automation-controller: v0.28.0
image-reflector-controller: v0.23.1
kustomize-controller: v0.32.0
notification-controller: v0.30.1
source-controller: v0.33.0

I run:

flux bootstrap github \
  --owner=<my-org> \
  --repository=<my-repo> \
  --team=<my-team> \
  --path=clusters/staging \
  --read-write-key=true \
  --components-extra=image-reflector-controller,image-automation-controller

@danports
Copy link

Confirmed that the problem is gone in v0.38.2 - thanks for the quick fix!

@oliver-kriska
Copy link

thanks, it works but it's weird that it's still showing old version of provider:

flux check
► checking prerequisites
✔ Kubernetes 1.24.6 >=1.20.6-0
► checking controllers
✔ helm-controller: deployment ready
► ghcr.io/fluxcd/helm-controller:v0.28.1
✔ image-automation-controller: deployment ready
► ghcr.io/fluxcd/image-automation-controller:v0.28.0
✔ image-reflector-controller: deployment ready
► ghcr.io/fluxcd/image-reflector-controller:v0.23.1
✔ kustomize-controller: deployment ready
► ghcr.io/fluxcd/kustomize-controller:v0.32.0
✔ notification-controller: deployment ready
► ghcr.io/fluxcd/notification-controller:v0.30.2
✔ source-controller: deployment ready
► ghcr.io/fluxcd/source-controller:v0.33.0
► checking crds
✔ alerts.notification.toolkit.fluxcd.io/v1beta1
✔ buckets.source.toolkit.fluxcd.io/v1beta2
✔ gitrepositories.source.toolkit.fluxcd.io/v1beta2
✔ helmcharts.source.toolkit.fluxcd.io/v1beta2
✔ helmreleases.helm.toolkit.fluxcd.io/v2beta1
✔ helmrepositories.source.toolkit.fluxcd.io/v1beta2
✔ imagepolicies.image.toolkit.fluxcd.io/v1beta1
✔ imagerepositories.image.toolkit.fluxcd.io/v1beta1
✔ imageupdateautomations.image.toolkit.fluxcd.io/v1beta1
✔ kustomizations.kustomize.toolkit.fluxcd.io/v1beta2
✔ ocirepositories.source.toolkit.fluxcd.io/v1beta2
✔ providers.notification.toolkit.fluxcd.io/v1beta1
✔ receivers.notification.toolkit.fluxcd.io/v1beta1
✔ all checks passed
flux version
flux: v0.38.2
helm-controller: v0.28.1
image-automation-controller: v0.28.0
image-reflector-controller: v0.23.1
kustomize-controller: v0.32.0
notification-controller: v0.30.2
source-controller: v0.33.0

I upgraded flux locally and run bootstrap as well and you can see results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants