feat: set default observedGeneration to -1 on HelmReleases
This resolves an issue with kustomize-controller marking a Kustomization as healthy even when the helm-controller hasn't even looked at the HelmRelease targeted by the Kustomization's healthChecks, yet. Setting `observedGeneration` to -1 by default will cause kstatus to report a status of `InProgress` instead of `Ready`. see https://github.com/fluxcd/kustomize-controller/issues/387 for details on the issues this is solving. Signed-off-by: Max Jonas Werner <mail@makk.es>
This commit is contained in:
parent
098fa6d4d1
commit
1f16ebd699
|
@ -54,6 +54,17 @@ jobs:
|
|||
KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin
|
||||
- name: Load test image
|
||||
run: kind load docker-image test/helm-controller:latest
|
||||
- name: Install CRDs
|
||||
run: make install
|
||||
- name: Run default status test
|
||||
run: |
|
||||
kubectl apply -f config/testdata/status-defaults
|
||||
RESULT=$(kubectl get helmrelease status-defaults -o jsonpath={.status})
|
||||
EXPECTED='{"observedGeneration":-1}'
|
||||
if [ "${RESULT}" != "${EXPECTED}" ] ; then
|
||||
echo -e "${RESULT}\n\ndoes not equal\n\n${EXPECTED}"
|
||||
exit 1
|
||||
fi
|
||||
- name: Deploy controllers
|
||||
run: |
|
||||
make dev-deploy IMG=test/helm-controller:latest
|
||||
|
|
|
@ -882,6 +882,7 @@ type HelmRelease struct {
|
|||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec HelmReleaseSpec `json:"spec,omitempty"`
|
||||
// +kubebuilder:default:={"observedGeneration":-1}
|
||||
Status HelmReleaseStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
|
|
|
@ -447,6 +447,8 @@ spec:
|
|||
- interval
|
||||
type: object
|
||||
status:
|
||||
default:
|
||||
observedGeneration: -1
|
||||
description: HelmReleaseStatus defines the observed state of a HelmRelease.
|
||||
properties:
|
||||
conditions:
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
apiVersion: helm.toolkit.fluxcd.io/v2beta1
|
||||
kind: HelmRelease
|
||||
metadata:
|
||||
name: status-defaults
|
||||
spec:
|
||||
interval: 5m
|
||||
chart:
|
||||
spec:
|
||||
chart: podinfo
|
||||
version: '>=4.0.0 <5.0.0'
|
||||
sourceRef:
|
||||
kind: HelmRepository
|
||||
name: podinfo
|
||||
interval: 1m
|
Loading…
Reference in New Issue