Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
66 changes: 21 additions & 45 deletions .github/workflows/publish_dev_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,64 +16,40 @@ env:
CARGO_INCREMENTAL: '0'
CARGO_PROFILE_DEV_DEBUG: '0'
RUSTFLAGS: "-D warnings -W rust-2021-compatibility"
REPO_APT_DEV_URL: https://repo.stackable.tech/repository/deb-dev
REPO_RPM_DEV_URL: https://repo.stackable.tech/repository/rpm-dev
REPO_HELM_DEV_URL: https://repo.stackable.tech/repository/helm-dev
CHART_TESTING_CONFIG: deploy/helm/chart-testing.yaml

jobs:
debian10:
runs-on: debian10
helm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.4.0
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.6.2
- name: Compile chart
run: make compile-chart
- name: Change version if is PR
if: ${{ github.event_name == 'pull_request' }}
# We use "mr" instead of "pr" to denote pull request builds, as this prefix comes before "nightly" when lexically
# sorting packages by version. This means that when installing the package without specifying a version the
# nighly version is considered more current than mr versions and installed by default
run: sed -i -e 's/^version = "\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/version = "\1-mr${{ github.event.number }}"/' rust/operator-binary/Cargo.toml
- name: Build
run: ~/.cargo/bin/cargo +nightly build --verbose --release
- name: Build apt package
run: ~/.cargo/bin/cargo deb --manifest-path rust/operator-binary/Cargo.toml --no-build
- name: Publish apt package
run: |
sed -i -e 's/^version: \([0-9]\+\.[0-9]\+\.[0-9]\+\).*/version: \1+mr${{ github.event.number }}/' deploy/helm/${{ env.PRODUCT_NAME }}-operator/Chart.yaml
- name: Package Chart
run: mkdir -p target/helm && helm package --destination target/helm deploy/helm/${{ env.PRODUCT_NAME }}-operator
- name: Publish Chart
env:
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
if: env.NEXUS_PASSWORD != null
run: >-
/usr/bin/curl
--fail
-u 'github:${{ secrets.NEXUS_PASSWORD }}'
-H "Content-Type: multipart/form-data"
--data-binary "@./$(find target/debian/ -name *.deb)"
"${{ env.REPO_APT_DEV_URL }}/"
- name: Clean
run: ~/.cargo/bin/cargo clean
--upload-file "./$(find target/helm/ -name *.tgz)"
"${{ env.REPO_HELM_DEV_URL }}/"

centos:
runs-on: centos${{ matrix.node }}
strategy:
matrix:
node: [ 7, 8 ]
steps:
- uses: actions/checkout@v2.4.0
- name: Change version if is PR
if: ${{ github.event_name == 'pull_request' }}
# We use "mr" instead of "pr" to denote pull request builds, as this prefix comes before "nightly" when lexically
# sorting packages by version. This means that when installing the package without specifying a version the
# nighly version is considered more current than mr versions and installed by default
run: sed -i -e 's/^version = "\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/version = "\1-mr${{ github.event.number }}"/' rust/operator-binary/Cargo.toml
- name: Build
run: ~/.cargo/bin/cargo +nightly build --verbose --release
- name: Build RPM package
run: packaging/buildrpm.sh stackable-${{ env.PRODUCT_NAME }}-operator-binary stackable-${{ env.PRODUCT_NAME }}-operator
- name: Publish RPM package
env:
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
if: env.NEXUS_PASSWORD != null
run: >-
/usr/bin/curl
--fail
-u 'github:${{ secrets.NEXUS_PASSWORD }}'
--upload-file "./$(find target/rpm/RPMS/x86_64/ -name *.rpm)"
"${{ env.REPO_RPM_DEV_URL }}/el${{ matrix.node }}/"
- name: Clean
run: ~/.cargo/bin/cargo clean
71 changes: 19 additions & 52 deletions .github/workflows/publish_release_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,64 +15,31 @@ env:
CARGO_INCREMENTAL: '0'
CARGO_PROFILE_DEV_DEBUG: '0'
RUSTFLAGS: "-D warnings -W rust-2021-compatibility"
REPO_APT_RELEASE_URL: https://repo.stackable.tech/repository/deb-release
REPO_RPM_RELEASE_URL: https://repo.stackable.tech/repository/rpm-release
REPO_HELM_STABLE_URL: https://repo.stackable.tech/repository/helm-stable
CT_CONFIG: deploy/helm/ct.yaml

jobs:
debian10:
runs-on: debian10
helm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.4.0
- name: Change version if is PR
if: ${{ github.event_name == 'pull_request' }}
# We use "mr" instead of "pr" to denote pull request builds, as this prefix comes before "nightly" when lexically
# sorting packages by version. This means that when installing the package without specifying a version the
# nighly version is considered more current than mr versions and installed by default
run: sed -i -e 's/^version = "\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/version = "\1-mr${{ github.event.number }}"/' rust/operator-binary/Cargo.toml
- name: Build
run: ~/.cargo/bin/cargo +nightly build --verbose --release
- name: Build apt package
run: ~/.cargo/bin/cargo deb --manifest-path rust/operator-binary/Cargo.toml --no-build
- name: Publish apt package
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.6.2
- name: Compile chart
run: make compile-chart
- name: Package Chart
run: mkdir -p target/helm && helm package --destination target/helm deploy/helm/${{ env.PRODUCT_NAME }}-operator
- name: Publish Chart
env:
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
if: env.NEXUS_PASSWORD != null
run: >-
/usr/bin/curl
--fail
-u 'github:${{ secrets.NEXUS_PASSWORD }}'
-H "Content-Type: multipart/form-data"
--data-binary "@./$(find target/debian/ -name *.deb)"
"${{ env.REPO_APT_RELEASE_URL }}/"
- name: Clean
run: ~/.cargo/bin/cargo clean

centos:
runs-on: centos${{ matrix.node }}
strategy:
matrix:
node: [ 7, 8 ]
steps:
- uses: actions/checkout@v2.4.0
- name: Change version if is PR
if: ${{ github.event_name == 'pull_request' }}
# We use "mr" instead of "pr" to denote pull request builds, as this prefix comes before "nightly" when lexically
# sorting packages by version. This means that when installing the package without specifying a version the
# nighly version is considered more current than mr versions and installed by default
run: sed -i -e 's/^version = "\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/version = "\1-mr${{ github.event.number }}"/' rust/operator-binary/Cargo.toml
- name: Build
run: ~/.cargo/bin/cargo +nightly build --verbose --release
- name: Build RPM package
run: packaging/buildrpm.sh stackable-${{ env.PRODUCT_NAME }}-operator-binary stackable-${{ env.PRODUCT_NAME }}-operator
- name: Publish RPM package
env:
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
if: env.NEXUS_PASSWORD != null
run: >-
/usr/bin/curl
--fail
-u 'github:${{ secrets.NEXUS_PASSWORD }}'
--upload-file "./$(find target/rpm/RPMS/x86_64/ -name *.rpm)"
"${{ env.REPO_RPM_RELEASE_URL }}/el${{ matrix.node }}/"
- name: Clean
run: ~/.cargo/bin/cargo clean
--upload-file "./$(find target/helm/ -name *.tgz)"
"${{ env.REPO_HELM_STABLE_URL }}/"
36 changes: 34 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,40 @@
.PHONY: docker
# =============
# This file is automatically generated from the templates in stackabletech/operator-templating
# DON'T MANUALLY EDIT THIS FILE
# =============

.PHONY: docker chart-lint compile-chart

TAG := $(shell git rev-parse --short HEAD)

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

docker:
docker build --force-rm -t "docker.stackable.tech/stackable/kafka-operator:${TAG}" -t "docker.stackable.tech/stackable/kafka-operator:latest" -f docker/Dockerfile .
docker build --force-rm -t "docker.stackable.tech/stackable/kafka-operator:${VERSION}" -t "docker.stackable.tech/stackable/kafka-operator:latest" -f docker/Dockerfile .
echo "${NEXUS_PASSWORD}" | docker login --username github --password-stdin docker.stackable.tech
docker push --all-tags docker.stackable.tech/stackable/kafka-operator

## Chart related targets
compile-chart: version crds config

chart-clean:
rm -rf deploy/helm/kafka-operator/configs
rm -rf deploy/helm/kafka-operator/templates/crds.yaml

version:
yq eval -i '.version = ${VERSION} | .appVersion = ${VERSION}' deploy/helm/kafka-operator/Chart.yaml


config: deploy/helm/kafka-operator/configs

deploy/helm/kafka-operator/configs:
cp -r deploy/config-spec deploy/helm/kafka-operator/configs

crds: deploy/helm/kafka-operator/crds/crds.yaml

deploy/helm/kafka-operator/crds/crds.yaml:
mkdir -p deploy/helm/kafka-operator/crds
cat deploy/crd/*.yaml | yq e '.metadata.annotations["helm.sh/resource-policy"]="keep"' - > ${@}

chart-lint: compile-chart
docker run -it -v $(shell pwd):/build/helm-charts -w /build/helm-charts quay.io/helmpack/chart-testing:v3.4.0 ct lint --config deploy/helm/chart_testing.yaml
5 changes: 5 additions & 0 deletions deploy/helm/chart_testing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
remote: origin
target-branch: main
chart-dirs:
- deploy/helm
all: true
33 changes: 33 additions & 0 deletions deploy/helm/kafka-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# =============
# This file is automatically generated from the templates in stackabletech/operator-templating
# DON'T MANUALLY EDIT THIS FILE
# =============

apiVersion: v2
name: kafka-operator
description: The Stackable Operator for Apache Kafka

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

maintainers:
- name: stackable
url: github.com/stackabletech

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: <version_placeholder>

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: <version_placeholder>
42 changes: 42 additions & 0 deletions deploy/helm/kafka-operator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[]: # =============
[]: # This file is automatically generated from the templates in stackabletech/operator-templating
[]: # DON'T MANUALLY EDIT THIS FILE
[]: # =============

# Helm Chart for Stackable Operator for Apache Kafka

This Helm Chart can be used to install Custom Resource Definitions and the Operator for Apache Kafka provided by Stackable.


## Requirements

- Create a [Kubernetes Cluster](../Readme.md)
- Install [Helm](https://helm.sh/docs/intro/install/)


## Install the Stackble Operator for Apache Kafka

```bash
# From the root of the operator repository
make compile-chart

helm install kafka-operator deploy/helm/kafka-operator
```




## Create a Apache Kafka Cluster

as described [here](https://docs.stackable.tech/kafka/index.html)



The operator has example requests included in the [`/examples`](https://github.com/stackabletech/kafka/operator/tree/main/examples) directory that can be used to spin up a cluster.


## Links

https://github.com/stackabletech/kafka-operator


76 changes: 76 additions & 0 deletions deploy/helm/kafka-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "operator.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-operator" }}
{{- end }}

{{/*
Expand the name of the chart.
*/}}
{{- define "operator.appname" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "operator.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "operator.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "operator.labels" -}}
helm.sh/chart: {{ include "operator.chart" . }}
{{ include "operator.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "operator.selectorLabels" -}}
app.kubernetes.io/name: {{ include "operator.appname" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "operator.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "operator.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Labels for Kubernetes objects created by helm test
*/}}
{{- define "operator.testLabels" -}}
helm.sh/test: {{ include "operator.chart" . }}
{{- end }}
12 changes: 12 additions & 0 deletions deploy/helm/kafka-operator/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# =============
# This file is automatically generated from the templates in stackabletech/operator-templating
# DON'T MANUALLY EDIT THIS FILE
# =============
apiVersion: v1
data:
{{ (.Files.Glob "configs/*").AsConfig | indent 2 }}
kind: ConfigMap
metadata:
name: {{ include "operator.fullname" . }}-configspec
labels:
{{- include "operator.labels" . | nindent 4 }}
Loading