diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 771f741c6..afc0f011e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -35,6 +35,8 @@ jobs: go install golang.org/x/tools/cmd/goimports - name: Run linters run: make test-fmt test-codegen + - name: Verify CRDs + run: make verify-crd - name: Run tests run: go test -race -coverprofile=coverage.txt -covermode=atomic $(go list ./pkg/...) - name: Check if working tree is dirty diff --git a/Makefile b/Makefile index f51433e23..327b99389 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,9 @@ crd: cat artifacts/flagger/crd.yaml > charts/flagger/crds/crd.yaml cat artifacts/flagger/crd.yaml > kustomize/base/flagger/crd.yaml +verify-crd: + ./hack/verify-crd.sh + version-set: @next="$(TAG)" && \ current="$(VERSION)" && \ diff --git a/artifacts/flagger/crd.yaml b/artifacts/flagger/crd.yaml index 74841cf76..ed2ce257d 100644 --- a/artifacts/flagger/crd.yaml +++ b/artifacts/flagger/crd.yaml @@ -1040,20 +1040,20 @@ spec: - Failed - Terminating - Terminated - trackedConfigs: - description: TrackedConfig of this canary - additionalProperties: - type: string - type: object - canaryWeight: - description: Traffic weight routed to canary - type: number failedChecks: description: Failed check count of the current canary analysis type: number + canaryWeight: + description: Traffic weight routed to canary + type: number iterations: description: Iteration count of the current canary analysis type: number + trackedConfigs: + description: TrackedConfig of this canary + additionalProperties: + type: string + type: object lastAppliedSpec: description: LastAppliedSpec of this canary type: string diff --git a/charts/flagger/crds/crd.yaml b/charts/flagger/crds/crd.yaml index 578867df7..ed2ce257d 100644 --- a/charts/flagger/crds/crd.yaml +++ b/charts/flagger/crds/crd.yaml @@ -163,6 +163,9 @@ spec: portName: description: Container port name type: string + appProtocol: + description: Application protocol of the port + type: string targetPort: description: Container target port name x-kubernetes-int-or-string: true @@ -1037,20 +1040,20 @@ spec: - Failed - Terminating - Terminated - trackedConfigs: - description: TrackedConfig of this canary - additionalProperties: - type: string - type: object - canaryWeight: - description: Traffic weight routed to canary - type: number failedChecks: description: Failed check count of the current canary analysis type: number + canaryWeight: + description: Traffic weight routed to canary + type: number iterations: description: Iteration count of the current canary analysis type: number + trackedConfigs: + description: TrackedConfig of this canary + additionalProperties: + type: string + type: object lastAppliedSpec: description: LastAppliedSpec of this canary type: string diff --git a/hack/verify-crd.sh b/hack/verify-crd.sh new file mode 100755 index 000000000..acfdfbb42 --- /dev/null +++ b/hack/verify-crd.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +REPO_ROOT=$(git rev-parse --show-toplevel) + +d=$(diff ${REPO_ROOT}/artifacts/flagger/crd.yaml ${REPO_ROOT}/charts/flagger/crds/crd.yaml) +if [[ "$d" != "" ]]; then + echo "⨯ ${REPO_ROOT}/artifacts/flagger/crd.yaml and ${REPO_ROOT}/charts/flagger/crds/crd.yaml don't match" + echo "$d" + exit 1 +fi + +d=$(diff ${REPO_ROOT}/artifacts/flagger/crd.yaml ${REPO_ROOT}/kustomize/base/flagger/crd.yaml) +if [[ "$d" != "" ]]; then + echo "⨯ ${REPO_ROOT}/artifacts/flagger/crd.yaml and ${REPO_ROOT}/kustomize/base/flagger/crd.yaml don't match" + echo "$d" + exit 1 +fi + +echo "✔ CRDs verified" diff --git a/kustomize/base/flagger/crd.yaml b/kustomize/base/flagger/crd.yaml index 40d47912e..ed2ce257d 100644 --- a/kustomize/base/flagger/crd.yaml +++ b/kustomize/base/flagger/crd.yaml @@ -163,6 +163,9 @@ spec: portName: description: Container port name type: string + appProtocol: + description: Application protocol of the port + type: string targetPort: description: Container target port name x-kubernetes-int-or-string: true @@ -1037,26 +1040,26 @@ spec: - Failed - Terminating - Terminated - trackedConfigs: - description: TrackedConfig of this canary - additionalProperties: - type: string - type: object - canaryWeight: - description: Traffic weight routed to canary - type: number failedChecks: description: Failed check count of the current canary analysis type: number + canaryWeight: + description: Traffic weight routed to canary + type: number iterations: description: Iteration count of the current canary analysis type: number - lastPromotedSpec: - description: LastPromotedSpec of this canary - type: string + trackedConfigs: + description: TrackedConfig of this canary + additionalProperties: + type: string + type: object lastAppliedSpec: description: LastAppliedSpec of this canary type: string + lastPromotedSpec: + description: LastPromotedSpec of this canary + type: string lastTransitionTime: description: LastTransitionTime of this canary format: date-time