Skip to content

Commit

Permalink
feat & fix: use selector labels for risingwave workloads, initialize …
Browse files Browse the repository at this point in the history
…the risingwave-operator chart

Signed-off-by: arkbriar <[email protected]>
  • Loading branch information
arkbriar committed Aug 7, 2023
1 parent 5d92fcd commit 79c04f9
Show file tree
Hide file tree
Showing 27 changed files with 42,738 additions and 5 deletions.
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
HELM_CHARTS=$(shell ls charts)
INCUBATING_HELM_CHARTS=$(shell ls incubating/charts)

lint:
# for each in $(HELM_CHARTS) and $(INCUBATING_HELM_CHARTS), do helm lint
$(foreach chart,$(HELM_CHARTS),helm lint charts/$(chart);)
$(foreach chart,$(INCUBATING_HELM_CHARTS),helm lint incubating/charts/$(chart);)

sync-crds:
./scripts/sync-crds.sh incubating/charts/risingwave-operator/templates/crds
2 changes: 1 addition & 1 deletion charts/risingwave/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type: application
# 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: 0.1.8
version: 0.1.9

# 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
Expand Down
2 changes: 1 addition & 1 deletion charts/risingwave/templates/compactor-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
replicas: {{ .Values.compactorComponent.replicas }}
selector:
matchLabels:
{{- include "risingwave.labels" . | nindent 6 }}
{{- include "risingwave.selectorLabels" . | nindent 6 }}
risingwave.risingwavelabs.com/component: compactor
strategy:
type: Recreate
Expand Down
2 changes: 1 addition & 1 deletion charts/risingwave/templates/compute-sts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
replicas: {{ .Values.computeComponent.replicas }}
selector:
matchLabels:
{{- include "risingwave.labels" . | nindent 6 }}
{{- include "risingwave.selectorLabels" . | nindent 6 }}
risingwave.risingwavelabs.com/component: compute
serviceName: {{ include "risingwave.computeHeadlessServiceName" . }}
updateStrategy:
Expand Down
2 changes: 1 addition & 1 deletion charts/risingwave/templates/frontend-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
replicas: {{ .Values.frontendComponent.replicas }}
selector:
matchLabels:
{{- include "risingwave.labels" . | nindent 6 }}
{{- include "risingwave.selectorLabels" . | nindent 6 }}
risingwave.risingwavelabs.com/component: frontend
strategy:
type: Recreate
Expand Down
2 changes: 1 addition & 1 deletion charts/risingwave/templates/meta-sts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
replicas: {{ .Values.metaComponent.replicas }}
selector:
matchLabels:
{{- include "risingwave.labels" . | nindent 6 }}
{{- include "risingwave.selectorLabels" . | nindent 6 }}
risingwave.risingwavelabs.com/component: meta
serviceName: {{ include "risingwave.metaHeadlessServiceName" . }}
updateStrategy:
Expand Down
23 changes: 23 additions & 0 deletions incubating/charts/risingwave-operator/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
31 changes: 31 additions & 0 deletions incubating/charts/risingwave-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: v2
name: risingwave-operator
description: RisingWave Kubernetes Operator

type: application

# 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: 0.1.0

# 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: "0.5.0"

home: https://www.risingwave.com
icon: https://avatars.githubusercontent.com/u/77175557?s=48&v=4

keywords:
- risingwave
- streaming-processing
- cloud-native
- real-time
- operator

maintainers:
- name: RisingWave Labs
url: https://www.risingwave-labs.com

Empty file.
99 changes: 99 additions & 0 deletions incubating/charts/risingwave-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{{/*
Copyright RisingWave Labs.
SPDX-License-Identifier: APACHE-2.0
*/}}

{{/*
Expand the name of the chart.
*/}}
{{- define "risingwave-operator.name" -}}
{{- 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 "risingwave-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 "risingwave-operator.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

{{/*
Common annotations
*/}}
{{- define "risingwave-operator.annotations" -}}
{{- if .Values.commonAnnotations }}
{{ toYaml .Values.commonAnnotations }}
{{- end }}
{{- end }}


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

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

{{/*
Create the image name to use.
*/}}
{{- define "risingwave-operator.image" -}}
{{- $registryName := .Values.image.registry -}}
{{- $repositoryName := .Values.image.repository -}}
{{- $separator := ":" -}}
{{- $termination := .Values.image.tag | toString -}}
{{- if .Values.image.digest }}
{{- $separator = "@" -}}
{{- $termination = .Values.image.digest | toString -}}
{{- end -}}
{{- if $registryName }}
{{- printf "%s/%s%s%s" $registryName $repositoryName $separator $termination -}}
{{- else -}}
{{- printf "%s%s%s" $repositoryName $separator $termination -}}
{{- end -}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{/*
Copyright RisingWave Labs.
SPDX-License-Identifier: APACHE-2.0
*/}}

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ include "risingwave-operator.fullname" . }}
labels:
{{- include "risingwave-operator.labels" . | nindent 4 }}
{{- $annotations := (include "risingwave-operator.annotations" . ) | trim }}
{{- if $annotations }}
annotations:
{{ nindent 4 $annotations }}
{{- end }}
{{- with .Values.serviceAccount.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
dnsNames:
- {{ include "risingwave-operator.fullname" . }}.{{ .Release.Namespace }}.svc
- {{ include "risingwave-operator.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}
issuerRef:
name: {{ include "risingwave-operator.fullname" . }}
kind: Issuer
secretName: {{ include "risingwave-operator.fullname" . }}
21 changes: 21 additions & 0 deletions incubating/charts/risingwave-operator/templates/certs/issuer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{/*
Copyright RisingWave Labs.
SPDX-License-Identifier: APACHE-2.0
*/}}

apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: {{ include "risingwave-operator.fullname" . }}
labels:
{{- include "risingwave-operator.labels" . | nindent 4 }}
{{- $annotations := (include "risingwave-operator.annotations" . ) | trim }}
{{- if $annotations }}
annotations:
{{ nindent 4 $annotations }}
{{- end }}
{{- with .Values.serviceAccount.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selfSigned: {}
Empty file.
Empty file.
Loading

0 comments on commit 79c04f9

Please sign in to comment.