Upgrade Flux to the Kustomize v1beta2 API #1916
Replies: 5 comments 14 replies
-
WorkaroundIf you can't upgrade your clusters, then use a Flux apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: HelmRepository
metadata:
name: metrics-server
namespace: flux-system
spec:
interval: 60m
url: https://kubernetes-sigs.github.io/metrics-server/
---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: metrics-server
namespace: flux-system
spec:
interval: 60m
targetNamespace: kube-system
releaseName: metrics-server
chart:
spec:
chart: metrics-server
sourceRef:
kind: HelmRepository
name: metrics-server
values:
args:
- --metric-resolution=15s
- --kubelet-insecure-tls |
Beta Was this translation helpful? Give feedback.
-
We've run into an issue with the new v0.18.0 validation related to when a CRD and CR are included in the same In this scenario we can no longer include a Subscription and a CR in the same Kustomization due to the validation failing in the dry-run. In v0.17.0 this was previously possible, it would fail to reconcile all resources on the first apply, then on the second reconcile the CRD would be present and all resources would successfully apply. The present workaround in v0.18.0 is to split our kustomization into two but it would be great if we could retain the previous functionality. Perhaps a method to override the dry-run or apply all other resources that do not fail their dry-run. Alternatively maybe it is possible to implement similar validation logic for the Subscription + CR scenario as exists for the CRD + CR scenario. |
Beta Was this translation helpful? Give feedback.
-
What is the rational behind the introduction of The motivation as described in fluxcd/kustomize-controller#364 is at best confusing to me and I do not really understand it. That said, I am not a big fan of the new approach I know, that I am a bit late to the party. But I don't like the fact that breaking changes and deprecations are introduced lightheartedly into FluxCD's APIs (even if it's still beta). Especially, if the disadvantages of changes out-weight their advantages. Contributing to open source is sometimes a bit frustrating, because once you got your changes merged there is always a risk that they are fully or partly reverted by another contributor (acting in good faith) later, without them realising that they actually remove a feature or at least make it worse. Maybe we need something like a RFC (change management) process for breaking changes and deprecations, to make sure we care a bit more about this aspects and to ensure:
Many other open source projects have successfully adopted change management process, e.g. Kubernetes with its KEPs or Rust with its RFC. What do you think? |
Beta Was this translation helpful? Give feedback.
-
@stefanprodan I wonder whether there is a typo in #1916 (comment)
I understand this suggest to change the kustomize yaml api version to
|
Beta Was this translation helpful? Give feedback.
-
I want to deploy awx-operator using flux and kustomize. I am having awx-operator helm release file at base with namespace 'x' and in overlays i am having same helmrelease file with namespace 'dev'. will flux deploys 2 awx-operators in both 'x' and 'dev' namespaces what is the ideal way to run my awx-operator in mutliple environments using flux and kustomize. I am newbie please help |
Beta Was this translation helpful? Give feedback.
-
Starting with v0.18, Flux comes with a new reconciler based on Kubernetes server-side apply and graduates the Flux Kustomize API to
v1beta2
.Breaking changes
Namespaced objects must contain
metadata.namespace
, defaulting to thedefault
namespace is no longer supported. Setting a namespace for all objects reconciled by a Kustomization can be done withspec.targetNamespace
.The logs, events and alerts that report Kubernetes namespaced object changes are now using the
Kind/Namespace/Name
format instead ofKind/Name
.The minimum required version of Kubernetes has changed to:
v1.16
>= 1.16.11
v1.17
>= 1.17.7
v1.18
>= 1.18.4
v1.19
and later>= 1.19.0
Features and improvements
kubectl
execs with a specialised applier written in Go.API changes
The
kustomize.toolkit.fluxcd.io/v1beta2
API is backwards compatible withv1beta1
.Additions, deprecations and removals:
.spec.patchesStrategicMerge
deprecated in favour of.spec.patches
.spec.patchesJson6902
deprecated in favour of.spec.patches
.spec.validation
deprecated and no longer used (server-side validation is implicit).spec.wait
added (when enabled, will wait for all the reconciled resources to become ready).status.snapshot
replaced by.status.inventory
Upgrade procedure
To upgrade your cluster, download the Flux CLI binary from the release page and rerun the
flux bootstrap
command. This will upgrade the Flux components on your cluster to the latest version. Other upgrade options can be found on the docs website.To update the Flux
Kustomization
manifests in Git see the following table:v1beta2
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
.spec.validation
removed.spec.
.spec.patchesStrategicMerge
deprecated in favour of.spec.patches
.spec.patchesStrategicMerge
into an inline strategic merge patch, like this example given in the Kustomize documentation, and append to.spec.patches.
. Note that the value in the patch field is quoted; that is, it is the YAML or JSON of the patch, stringified..spec.patchesJson6902
deprecated in favour of.spec.patches
.spec.patchesJson6902
into an inline JSON6902 patch, and append to.spec.patches
. Note that the value in the patch field is quoted; that is, it is the YAML or JSON of the patch, stringified..status.snapshot
replaced by.status.inventory
.status
is not kept in files, so you will not need to account for this.ℹ️ Note that updating the manifests in Git to
v1beta2
can be done at any time after the Flux components upgrade. All users are encouraged to update the manifests as the deprecated fields will be removed when the next API version will be released.Terrafrom upgrade
When using the Terraform provider for Flux, you have to manually remove the
v1beta1
Kustomization from the TF state:Beta Was this translation helpful? Give feedback.
All reactions