feat: set default observedGeneration to -1 on Kustomizations
This is a follow-up to https://github.com/fluxcd/helm-controller/pull/294, porting the same code to the kustomize-controller so that all Flux 2 controllers work the same way in this regard. Signed-off-by: Max Jonas Werner <mail@makk.es>
This commit is contained in:
parent
ea052f845d
commit
d7690d8564
|
@ -55,6 +55,17 @@ jobs:
|
|||
KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin
|
||||
- name: Load test image
|
||||
run: kind load docker-image test/kustomize-controller:latest
|
||||
- name: Install CRDs
|
||||
run: make install
|
||||
- name: Run default status test
|
||||
run: |
|
||||
kubectl apply -f config/testdata/status-defaults
|
||||
RESULT=$(kubectl get kustomization status-defaults -o go-template={{.status}})
|
||||
EXPECTED='map[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/kustomize-controller:latest
|
||||
|
|
|
@ -340,7 +340,8 @@ type Kustomization struct {
|
|||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec KustomizationSpec `json:"spec,omitempty"`
|
||||
Spec KustomizationSpec `json:"spec,omitempty"`
|
||||
// +kubebuilder:default:={"observedGeneration":-1}
|
||||
Status KustomizationStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
|
|
|
@ -330,6 +330,8 @@ spec:
|
|||
- sourceRef
|
||||
type: object
|
||||
status:
|
||||
default:
|
||||
observedGeneration: -1
|
||||
description: KustomizationStatus defines the observed state of a kustomization.
|
||||
properties:
|
||||
conditions:
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
|
||||
kind: Kustomization
|
||||
metadata:
|
||||
name: status-defaults
|
Loading…
Reference in New Issue