Repository navigation
feat(k8s): add operator rollout acceptance #24
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
Open
cooktheryan
wants to merge
2
commits into
praxis-proxy:main
Choose a base branch
from
cooktheryan:feat/issue-1302-rollout-operator
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| name: Rollout | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: "23 3 * * *" | ||
| workflow_dispatch: | ||
| push: | ||
| tags: | ||
| - "v*" | ||
| pull_request: | ||
| branches: [main] | ||
| paths: | ||
| - ".github/workflows/rollout.yaml" | ||
| - "Cargo.toml" | ||
| - "Cargo.lock" | ||
| - "Containerfile" | ||
| - "Containerfile.*" | ||
| - "src/**" | ||
| - "deploy/**" | ||
|
|
||
| concurrency: | ||
| group: rollout-${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
|
||
| permissions: {} | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| CONTAINER_ENGINE: docker | ||
|
|
||
| jobs: | ||
| kind: | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 75 | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Check out operator | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Check out praxis | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| repository: praxis-proxy/praxis | ||
| path: praxis | ||
| ref: f5a79aa36bebbaf542ce109c81144354926f52a9 | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Rust | ||
| uses: praxis-proxy/conventions/.github/actions/setup-rust@f671c1215f89562d286310a6cabdcbaa5da9605c # v0.4.0 | ||
|
|
||
| - name: Install KIND | ||
| run: | | ||
| curl --fail --location --show-error --silent \ | ||
| --output ./kind-linux-amd64.sha256sum \ | ||
| https://kind.sigs.k8s.io/dl/v0.27.0/kind-linux-amd64.sha256sum | ||
| curl --fail --location --show-error --silent \ | ||
| --output ./kind-linux-amd64 \ | ||
| https://kind.sigs.k8s.io/dl/v0.27.0/kind-linux-amd64 | ||
| sha256sum --check ./kind-linux-amd64.sha256sum | ||
| chmod +x ./kind-linux-amd64 | ||
| sudo mv ./kind-linux-amd64 /usr/local/bin/kind | ||
|
|
||
| - name: Install kubectl | ||
| run: | | ||
| curl --fail --location --show-error --silent \ | ||
| --output ./kubectl.sha256 \ | ||
| "https://dl.k8s.io/release/v1.33.3/bin/linux/amd64/kubectl.sha256" | ||
| curl --fail --location --show-error --silent \ | ||
| --output ./kubectl \ | ||
| "https://dl.k8s.io/release/v1.33.3/bin/linux/amd64/kubectl" | ||
| echo "$(cat ./kubectl.sha256) kubectl" | sha256sum --check --strict - | ||
| chmod +x ./kubectl | ||
| sudo mv ./kubectl /usr/local/bin/kubectl | ||
|
|
||
| - name: Run rollout suite (source image) | ||
| working-directory: praxis | ||
| run: >- | ||
| cargo xtask rollout | ||
| --manifest-dir ../deploy/rollout-test | ||
| --operator-dir .. | ||
| --keep-cluster | ||
|
|
||
| - name: Pull the deployed default Praxis image | ||
| id: published | ||
| run: | | ||
| published_praxis_image=$(sed -n 's/^const DEFAULT_PRAXIS_IMAGE: &str = "\(.*\)";$/\1/p' src/context.rs) | ||
| test -n "$published_praxis_image" | ||
| docker pull "$published_praxis_image" | ||
| echo "image=$published_praxis_image" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Start the published-image case with a fresh cluster | ||
| run: kind delete cluster --name praxis-rollout | ||
|
|
||
| - name: Run rollout suite (published default image) | ||
| working-directory: praxis | ||
| env: | ||
| PRAXIS_RELEASE_IMAGE: ${{ steps.published.outputs.image }} | ||
| run: >- | ||
| cargo xtask rollout | ||
| --manifest-dir ../deploy/rollout-test | ||
| --operator-dir .. | ||
| --image "$PRAXIS_RELEASE_IMAGE" | ||
| --operator-image localhost/praxis-operator:rollout | ||
| --skip-build | ||
| --keep-cluster | ||
|
cooktheryan marked this conversation as resolved.
Resolved
|
||
|
|
||
| - name: Dump cluster state | ||
| if: failure() | ||
| run: | | ||
| kubectl --request-timeout=30s --context kind-praxis-rollout -n praxis get pods -o wide || true | ||
| kubectl --request-timeout=30s --context kind-praxis-rollout get nodes -o wide || true | ||
| kubectl --request-timeout=30s --context kind-praxis-rollout get events -A --sort-by=.lastTimestamp || true | ||
| kubectl --request-timeout=30s --context kind-praxis-rollout get crd gatewayclasses.gateway.networking.k8s.io gateways.gateway.networking.k8s.io httproutes.gateway.networking.k8s.io || true | ||
|
|
||
| - name: Delete test cluster | ||
| if: always() | ||
| run: | | ||
| if command -v kind >/dev/null 2>&1; then | ||
| kind delete cluster --name praxis-rollout | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: backend | ||
| namespace: praxis | ||
| labels: | ||
| app.kubernetes.io/name: backend | ||
| spec: | ||
| replicas: 2 | ||
| selector: | ||
| matchLabels: | ||
| app.kubernetes.io/name: backend | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app.kubernetes.io/name: backend | ||
| spec: | ||
| # Keep fixture backends stable while worker nodes hosting proxies drain. | ||
| nodeSelector: | ||
| node-role.kubernetes.io/control-plane: "" | ||
| tolerations: | ||
| - key: node-role.kubernetes.io/control-plane | ||
| operator: Exists | ||
| effect: NoSchedule | ||
| containers: | ||
| - name: backend | ||
| image: busybox:1.37.0 | ||
| args: [httpd, -f, -p, "8080", -h, /www] | ||
| ports: | ||
| - name: http | ||
| containerPort: 8080 | ||
| readinessProbe: | ||
| httpGet: | ||
| path: /healthy | ||
| port: http | ||
| periodSeconds: 2 | ||
| volumeMounts: | ||
| - name: www | ||
| mountPath: /www | ||
| readOnly: true | ||
| volumes: | ||
| - name: www | ||
| configMap: | ||
| name: backend-content | ||
| --- | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: backend-content | ||
| namespace: praxis | ||
| data: | ||
| config-v1: config-v1 | ||
| config-v2: config-v2 | ||
| healthy: ok | ||
| index.html: ok | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: backend | ||
| namespace: praxis | ||
| spec: | ||
| selector: | ||
| app.kubernetes.io/name: backend | ||
| ports: | ||
| - name: http | ||
| port: 8080 | ||
| targetPort: http | ||
| --- | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: healthy-backend | ||
| namespace: praxis | ||
| labels: | ||
| app.kubernetes.io/name: healthy-backend | ||
| spec: | ||
| replicas: 2 | ||
| selector: | ||
| matchLabels: | ||
| app.kubernetes.io/name: healthy-backend | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app.kubernetes.io/name: healthy-backend | ||
| spec: | ||
| # Keep fixture backends stable while worker nodes hosting proxies drain. | ||
| nodeSelector: | ||
| node-role.kubernetes.io/control-plane: "" | ||
| tolerations: | ||
| - key: node-role.kubernetes.io/control-plane | ||
| operator: Exists | ||
| effect: NoSchedule | ||
| containers: | ||
| - name: backend | ||
| image: busybox:1.37.0 | ||
| args: [httpd, -f, -p, "8080", -h, /www] | ||
| ports: | ||
| - name: http | ||
| containerPort: 8080 | ||
| readinessProbe: | ||
| httpGet: | ||
| path: /healthy | ||
| port: http | ||
| periodSeconds: 2 | ||
| volumeMounts: | ||
| - name: www | ||
| mountPath: /www | ||
| readOnly: true | ||
| volumes: | ||
| - name: www | ||
| configMap: | ||
| name: backend-content | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: healthy-backend | ||
| namespace: praxis | ||
| spec: | ||
| selector: | ||
| app.kubernetes.io/name: healthy-backend | ||
| ports: | ||
| - name: http | ||
| port: 8080 | ||
| targetPort: http |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: Gateway | ||
| metadata: | ||
| name: rollout | ||
| namespace: praxis | ||
| annotations: | ||
| praxis.sh/replicas: "2" | ||
| spec: | ||
| gatewayClassName: praxis | ||
| listeners: | ||
| - name: http | ||
| port: 8080 | ||
| protocol: HTTP | ||
| allowedRoutes: | ||
| namespaces: | ||
| from: All | ||
| - name: https | ||
| port: 8443 | ||
| protocol: HTTPS | ||
| tls: | ||
| certificateRefs: | ||
| - name: praxis-tls | ||
| allowedRoutes: | ||
| namespaces: | ||
| from: All |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: HTTPRoute | ||
| metadata: | ||
| name: rollout | ||
| namespace: praxis | ||
| spec: | ||
| parentRefs: | ||
| - name: rollout | ||
| rules: | ||
| - matches: | ||
| - path: | ||
| type: Exact | ||
| value: /config-version | ||
| filters: | ||
| - type: URLRewrite | ||
| urlRewrite: | ||
| path: | ||
| type: ReplaceFullPath | ||
| replaceFullPath: /config-v1 | ||
| backendRefs: | ||
| - name: backend | ||
| port: 8080 | ||
| - matches: | ||
| - path: | ||
| type: Exact | ||
| value: /healthy | ||
| backendRefs: | ||
| - name: healthy-backend | ||
| port: 8080 | ||
| - backendRefs: | ||
| - name: backend | ||
| port: 8080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||
| kind: Kustomization | ||
| resources: | ||
| - ../rbac.yaml | ||
| - ../deployment.yaml | ||
| - ../gatewayclass.yaml | ||
| - backend.yaml | ||
| - gateway.yaml | ||
| - httproute.yaml | ||
| - namespace.yaml | ||
| - service.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| apiVersion: v1 | ||
| kind: Namespace | ||
| metadata: | ||
| name: praxis | ||
| labels: | ||
| app.kubernetes.io/name: praxis | ||
| praxis-rollout/test: "true" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.