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

Add target and script to keep crds in sync #1254

Merged
merged 1 commit into from
Aug 11, 2022
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
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