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

Package all manifests with release #87

Merged
merged 15 commits into from
Sep 20, 2024
7 changes: 6 additions & 1 deletion .github/workflows/helm-unittest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@

name: Run Helm unit tests

"on": pull_request
"on":
pull_request:
branches:
- main
paths:
- deploy/charts/**

# Do not grant jobs any permissions by default
permissions: {}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/operator-lint-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: Lint and Test Prefect Operator Chart

"on":
pull_request:
branches:
- main
paths:
- deploy/charts/**

# Do not grant jobs any permissions by default
permissions: {}
Expand Down
21 changes: 18 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
run: make test

build-and-upload-manifests:
if: github.ref_type == 'tag'
mitchnielsen marked this conversation as resolved.
Show resolved Hide resolved
needs: unit-tests
permissions:
contents: write
Expand All @@ -44,15 +45,29 @@ jobs:
- name: Install tool dependencies
uses: jdx/mise-action@v2

- name: Package CRDs
- name: Package kubernetes manifests & CRDs
run: |
# package just CRDs
cat deploy/charts/prefect-operator/crds/*.yaml > prefect-crds.yaml
# handle helm dependencies
helm repo add bitnami https://charts.bitnami.com/bitnami
helm dependency build deploy/charts/prefect-operator
jamiezieziula marked this conversation as resolved.
Show resolved Hide resolved
jamiezieziula marked this conversation as resolved.
Show resolved Hide resolved
# template the helm chart including the CRDs
helm template prefect-operator deploy/charts/prefect-operator \
--include-crds --set operator.image.tag=${{ github.ref_name }} \
> prefect-operator.yaml
# Remove labels relevant only for Helm installs
yq -i 'del(.metadata.labels."app.kubernetes.io/managed-by")' prefect-operator.yaml
yq -i 'del(.metadata.labels."helm.sh/chart")' prefect-operator.yaml
yq -i 'del(.spec.template.metadata.labels."app.kubernetes.io/managed-by")' prefect-operator.yaml
yq -i 'del(.spec.template.metadata.labels."helm.sh/chart")' prefect-operator.yaml
# Ensure all references to app version match the released version tag
yq -i '(.. | select(tag == "!!str" and . == "v0.0.0")) |= "${{ github.ref_name }}"' prefect-operator.yaml
mitchnielsen marked this conversation as resolved.
Show resolved Hide resolved

- name: Upload release assets
if: github.ref_type == 'tag'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ github.ref_name }} prefect-crds.yaml
run: gh release upload ${{ github.ref_name }} prefect-crds.yaml prefect-operator.yaml

build-and-push-docker-image:
needs: unit-tests
Expand Down
1 change: 1 addition & 0 deletions .mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ kustomize = '5.3.0'
pre-commit = '3.8.0'
setup-envtest = '0.17.0'
yamllint = '1.35.1'
yq = '4.44.3'

# tomlv does not currently have an entry in the registry.
# For now, install with `go`:
Expand Down
2 changes: 1 addition & 1 deletion .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
extends: default

ignore: |
deploy/
deploy/charts/

rules:
comments:
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ vet: ## Run go vet against code.

.PHONY: helmbuild
helmbuild: ## Build Helm dependencies
helm repo add bitnami https://charts.bitnami.com/bitnami
helm dependency build $(CHART_PATH)


Expand Down
2 changes: 0 additions & 2 deletions deploy/samples/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
## Append samples of your project ##
resources:
- v1_prefectserver_sqlite.yaml
- v1_prefectworkpool_process.yaml
Expand All @@ -7,4 +6,3 @@ resources:
# - v1_prefectserver_sqlite.yaml
# - v1_prefectworkpool_kubernetes.yaml
# - v1_prefectworkpool_process.yaml
#+kubebuilder:scaffold:manifestskustomizesamples
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: the-api-key-secret
type: Opaque
stringData:
the-api-key: "pnu_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
the-api-key: pnu_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
---
apiVersion: prefect.io/v1
kind: PrefectWorkPool
Expand All @@ -17,11 +17,11 @@ spec:
type: process
server:
remoteApiUrl: https://api.prefect.cloud
accountId: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
accountId: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
workspaceId: bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb
apiKey:
valueFrom:
secretKeyRef:
name: 'the-api-key-secret'
key: 'the-api-key'
name: the-api-key-secret
key: the-api-key
workers: 3