Skip to content
Closed
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
78 changes: 78 additions & 0 deletions .github/workflows/test-chart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Test Chart

on:
push:
pull_request:

permissions: {}

jobs:
test-e2e:
permissions:
contents: read
name: Run on Ubuntu
runs-on: ubuntu-latest
env:
IMG: controller:latest
steps:
- name: Clone the code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Setup Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: go.mod

- name: Install the latest version of kind
run: |

Check failure on line 29 in .github/workflows/test-chart.yml

View workflow job for this annotation

GitHub Actions / lint

shellcheck reported issue in this script: SC2046:warning:1:63: Quote this to prevent word splitting

Check failure on line 29 in .github/workflows/test-chart.yml

View workflow job for this annotation

GitHub Actions / lint

shellcheck reported issue in this script: SC2046:warning:1:63: Quote this to prevent word splitting
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-$(go env GOARCH)
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind

- name: Verify kind installation
run: kind version

- name: Create kind cluster
run: kind create cluster

- name: Prepare clickhouse-operator
run: |

Check failure on line 41 in .github/workflows/test-chart.yml

View workflow job for this annotation

GitHub Actions / lint

shellcheck reported issue in this script: SC2086:info:3:24: Double quote to prevent globbing and word splitting

Check failure on line 41 in .github/workflows/test-chart.yml

View workflow job for this annotation

GitHub Actions / lint

shellcheck reported issue in this script: SC2086:info:3:24: Double quote to prevent globbing and word splitting
go mod tidy
make docker-build
kind load docker-image $IMG

- name: Install Helm
run: make install-helm

- name: Lint Helm Chart
run: |
helm lint ./dist/chart


- name: Install cert-manager via Helm (wait for readiness)
run: |
helm repo add jetstack https://charts.jetstack.io
helm repo update
helm install cert-manager jetstack/cert-manager \
--namespace cert-manager \
--create-namespace \
--set crds.enabled=true \
--wait \
--timeout 300s

# TODO: Uncomment if Prometheus is enabled
# - name: Install Prometheus Operator CRDs
# run: |
# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
# helm repo update
# helm install prometheus-crds prometheus-community/prometheus-operator-crds

- name: Deploy manager via Helm
run: |
make helm-deploy

- name: Check Helm release status
run: |
make helm-status
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ kind: Kustomization
images:
- name: controller
newName: ghcr.io/clickhouse/clickhouse-operator
newTag: v0.0.1
newTag: v0.0.3-34efe55
3 changes: 0 additions & 3 deletions config/metrics/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ patches:
- op: add
path: /spec/template/spec/containers/0/args/-
value: --metrics-bind-address=:8080
- op: add
path: /spec/template/spec/containers/0/args/-
value: --metrics-secure=false

- op: add
path: /spec/template/spec/containers/0/ports/-
Expand Down
2 changes: 1 addition & 1 deletion dist/chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ dependencies:
- name: cert-manager
version: "v1.19.2"
repository: "oci://quay.io/jetstack/charts"
condition: certManager.install
condition: certManager.enable
18 changes: 3 additions & 15 deletions dist/chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Expand the name of the chart.
*/}}
{{- define "clickhouse-operator.name" -}}
{{- default (trimSuffix "-helm" .Chart.Name) .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}q
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
Expand All @@ -14,7 +14,7 @@ If release name contains chart name it will be used as a full name.
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := include "clickhouse-operator.name" . }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
Expand Down Expand Up @@ -48,15 +48,3 @@ Dynamically calculates safe truncation to ensure total name length <= 63 chars.
{{- printf "%s-%s" $fullname $suffix | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}

{{/*
Util function for generating the image URL based on the provided options.
Cribbed from the cert-manager organization.
*/}}
{{- define "clickhouse-operator.image" -}}
{{- $defaultTag := index . 1 -}}
{{- with index . 0 -}}
{{ printf .repository }}
{{- if .digest -}}{{ printf "@%s" .digest }}{{- else -}}{{ printf ":%s" (default $defaultTag .tag) }}{{- end -}}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion dist/chart/templates/cert-manager/selfsigned-issuer.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.certManager.enable (not .Values.certManager.issuerRef) }}
{{- if .Values.certManager.enable }}
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
Expand Down
20 changes: 7 additions & 13 deletions dist/chart/templates/cert-manager/serving-cert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,18 @@ apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
labels:
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/name: {{ include "clickhouse-operator.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/name: {{ include "clickhouse-operator.name" . }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/instance: {{ .Release.Name }}
name: {{ include "clickhouse-operator.resourceName" (dict "suffix" "serving-cert" "context" $) }}
namespace: {{ .Release.Namespace }}
spec:
dnsNames:
- {{ include "clickhouse-operator.resourceName" (dict "suffix" "webhook-service" "context" $) }}.{{ .Release.Namespace }}.svc
- {{ include "clickhouse-operator.resourceName" (dict "suffix" "webhook-service" "context" $) }}.{{ .Release.Namespace }}.svc.cluster.local
- {{ include "clickhouse-operator.resourceName" (dict "suffix" "metrics-service" "context" $) }}.{{ .Release.Namespace }}.svc
- {{ include "clickhouse-operator.resourceName" (dict "suffix" "metrics-service" "context" $) }}.{{ .Release.Namespace }}.svc.cluster.local
- {{ include "clickhouse-operator.resourceName" (dict "suffix" "webhook-service" "context" $) }}.{{ .Release.Namespace }}.svc
- {{ include "clickhouse-operator.resourceName" (dict "suffix" "webhook-service" "context" $) }}.{{ .Release.Namespace }}.svc.cluster.local
issuerRef:
{{- if .Values.certManager.issuerRef}}
{{ .Values.certManager.issuerRef | toYaml | nindent 4 }}
{{- else }}
kind: Issuer
name: {{ include "clickhouse-operator.resourceName" (dict "suffix" "selfsigned-issuer" "context" $) }}
{{- end }}
secretName: {{ include "clickhouse-operator.resourceName" (dict "suffix" "serving-cert" "context" $) }}
secretName: serving-cert
{{- end }}
Loading
Loading