Skip to content

Commit

Permalink
add target and script to keep crds in sync
Browse files Browse the repository at this point in the history
Signed-off-by: Sanskar Jaiswal <[email protected]>
  • Loading branch information
Sanskar Jaiswal committed Aug 11, 2022
1 parent f449ee1 commit fe37bdd
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 27 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)" && \
Expand Down
16 changes: 8 additions & 8 deletions artifacts/flagger/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 11 additions & 8 deletions charts/flagger/crds/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions hack/verify-crd.sh
Original file line number Diff line number Diff line change
@@ -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"
25 changes: 14 additions & 11 deletions kustomize/base/flagger/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fe37bdd

Please sign in to comment.