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

feat: set default observedGeneration to -1 on HelmReleases #294

Merged
merged 5 commits into from
Aug 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 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/helm-controller:latest
Expand Down Expand Up @@ -555,10 +566,10 @@ jobs:
which kubectl
kubectl version
helm version
kubectl -n helm-system get helmrepositories -oyaml
kubectl -n helm-system get helmcharts -oyaml
kubectl -n helm-system get helmreleases -oyaml
kubectl -n helm-system get helmrepositories -oyaml || true
kubectl -n helm-system get helmcharts -oyaml || true
kubectl -n helm-system get helmreleases -oyaml || true
kubectl -n helm-system get all
helm ls -n helm-system --all
kubectl -n helm-system logs deploy/source-controller
kubectl -n helm-system logs deploy/helm-controller
kubectl -n helm-system logs deploy/source-controller || true
kubectl -n helm-system logs deploy/helm-controller || true
3 changes: 2 additions & 1 deletion api/v2beta1/helmrelease_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,8 @@ type HelmRelease struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec HelmReleaseSpec `json:"spec,omitempty"`
Spec HelmReleaseSpec `json:"spec,omitempty"`
// +kubebuilder:default:={"observedGeneration":-1}
Status HelmReleaseStatus `json:"status,omitempty"`
}

Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,8 @@ spec:
- interval
type: object
status:
default:
observedGeneration: -1
description: HelmReleaseStatus defines the observed state of a HelmRelease.
properties:
conditions:
Expand Down
14 changes: 14 additions & 0 deletions config/testdata/status-defaults/helmrelease.yaml
Original file line number Diff line number Diff line change
@@ -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