Skip to content
Draft
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
40 changes: 40 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@
# This script also requires `jq` https://stedolan.github.io/jq/

.PHONY: build publish
.PHONY: chart-package-oci chart-package-quay chart-package-all
.PHONY: chart-publish-oci chart-publish-quay chart-publish-all

OPERATOR_NAME := airflow-operator
VERSION := $(shell cargo metadata --format-version 1 | jq -r '.packages[] | select(.name=="stackable-${OPERATOR_NAME}") | .version')

OCI_REGISTRY_HOSTNAME := oci.stackable.tech
OCI_REGISTRY_PROJECT_IMAGES := sdp

OCI_REGISTRY_PROJECT_CHARTS ?= sdp/charts
QUAY_REGISTRY_PROJECT_CHARTS ?= stackable/charts

CHART_DIR := deploy/helm/${OPERATOR_NAME}
CHART_PACKAGE_OUTPUT_DIR ?= /tmp

SHELL=/usr/bin/env bash -euo pipefail

render-readme:
Expand Down Expand Up @@ -53,6 +61,38 @@ crds:
chart-lint: compile-chart
docker run -it -v $(shell pwd):/build/helm-charts -w /build/helm-charts quay.io/helmpack/chart-testing:v3.5.0 ct lint --config deploy/helm/ct.yaml

chart-package-oci: compile-chart
tmp_dir="$$(mktemp -d)"; \
trap 'rm -rf "$$tmp_dir"' EXIT; \
cp -r "${CHART_DIR}" "$$tmp_dir/"; \
yq ea '. as $$item ireduce ({}; . * $$item )' \
"$$tmp_dir/${OPERATOR_NAME}/values.yaml" \
"$$tmp_dir/${OPERATOR_NAME}/values.registry-oci.yaml" \
> "$$tmp_dir/${OPERATOR_NAME}/values.yaml.new"; \
mv "$$tmp_dir/${OPERATOR_NAME}/values.yaml.new" "$$tmp_dir/${OPERATOR_NAME}/values.yaml"; \
helm package "$$tmp_dir/${OPERATOR_NAME}" --destination "${CHART_PACKAGE_OUTPUT_DIR}"

chart-package-quay: compile-chart
tmp_dir="$$(mktemp -d)"; \
trap 'rm -rf "$$tmp_dir"' EXIT; \
cp -r "${CHART_DIR}" "$$tmp_dir/"; \
yq ea '. as $$item ireduce ({}; . * $$item )' \
"$$tmp_dir/${OPERATOR_NAME}/values.yaml" \
"$$tmp_dir/${OPERATOR_NAME}/values.registry-quay.yaml" \
> "$$tmp_dir/${OPERATOR_NAME}/values.yaml.new"; \
mv "$$tmp_dir/${OPERATOR_NAME}/values.yaml.new" "$$tmp_dir/${OPERATOR_NAME}/values.yaml"; \
helm package "$$tmp_dir/${OPERATOR_NAME}" --destination "${CHART_PACKAGE_OUTPUT_DIR}"

chart-package-all: chart-package-oci chart-package-quay

chart-publish-oci: chart-package-oci
helm push "${CHART_PACKAGE_OUTPUT_DIR}/${OPERATOR_NAME}-${VERSION}.tgz" "oci://${OCI_REGISTRY_HOSTNAME}/${OCI_REGISTRY_PROJECT_CHARTS}"

chart-publish-quay: chart-package-quay
helm push "${CHART_PACKAGE_OUTPUT_DIR}/${OPERATOR_NAME}-${VERSION}.tgz" "oci://quay.io/${QUAY_REGISTRY_PROJECT_CHARTS}"

chart-publish-all: chart-publish-oci chart-publish-quay

clean: chart-clean
cargo clean
docker rmi --force '${OCI_REGISTRY_HOSTNAME}/${OCI_REGISTRY_PROJECT_IMAGES}/${OPERATOR_NAME}:${VERSION}'
Expand Down
42 changes: 42 additions & 0 deletions deploy/helm/airflow-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,48 @@ make compile-chart
helm install airflow-operator deploy/helm/airflow-operator
```

## Publish The Chart

The Helm chart is published to two different repositories:

- oci.stackable.tech
- quay.io

Each chart version references images from it's corresponding repository.

Package and publish both variants:

```bash
make chart-package-all
make chart-publish-all
```

Package and publish for oci.stackable.tech:

```bash
make chart-package-oci
make chart-publish-oci
```

Package and publish for quay.io:

```bash
make chart-package-quay
make chart-publish-quay
```

Install from oci.stackable.tech:

```bash
helm install airflow-operator oci://oci.stackable.tech/sdp/charts/airflow-operator --version 0.0.0-dev
```

Install from quay.io:

```shell
helm install airflow-operator oci://quay.io/stackable/charts/airflow-operator --version 0.0.0-dev
```

## Usage of the CRDs

The usage of this operator and its CRDs is described in the [documentation](https://docs.stackable.tech/airflow/index.html)
Expand Down
7 changes: 7 additions & 0 deletions deploy/helm/airflow-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,10 @@ Labels for Kubernetes objects created by helm test
{{- define "operator.testLabels" -}}
helm.sh/test: {{ include "operator.chart" . }}
{{- end }}

{{/*
Build the full container image reference.
*/}}
{{- define "operator.image" -}}
{{- printf "%s/%s:%s" .Values.image.registry .Values.image.repository (.Values.image.tag | default .Chart.AppVersion) -}}
{{- end }}
4 changes: 2 additions & 2 deletions deploy/helm/airflow-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
template:
metadata:
annotations:
internal.stackable.tech/image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
internal.stackable.tech/image: "{{ include "operator.image" . }}"
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
Expand All @@ -37,7 +37,7 @@ spec:
- name: {{ include "operator.appname" . }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
image: "{{ include "operator.image" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
Expand Down
4 changes: 4 additions & 0 deletions deploy/helm/airflow-operator/values.registry-oci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
# Values overlay for chart packages published to oci.stackable.tech.
image:
registry: oci.stackable.tech/sdp
4 changes: 4 additions & 0 deletions deploy/helm/airflow-operator/values.registry-quay.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
# Values overlay for chart packages published to quay.io.
image:
registry: quay.io/stackable
3 changes: 2 additions & 1 deletion deploy/helm/airflow-operator/values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Default values for airflow-operator.
---
image:
repository: oci.stackable.tech/sdp/airflow-operator
registry: oci.stackable.tech/sdp
repository: airflow-operator
pullPolicy: IfNotPresent
pullSecrets: []

Expand Down
Loading