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

Update & add more yaook charts #76

Merged
merged 1 commit into from
Aug 29, 2024
Merged
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
16 changes: 12 additions & 4 deletions .charts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,27 @@ charts:
repository:
url: https://headlamp-k8s.github.io/headlamp/
# YAOOK charts
- name: cds-operator
version: 0.20240801.0
repository:
url: https://charts.yaook.cloud/operator/stable
- name: crds
version: 0.20240704.1
version: 0.20240801.0
repository:
url: https://charts.yaook.cloud/operator/stable
- name: infra-operator
version: 0.20240704.1
version: 0.20240801.0
repository:
url: https://charts.yaook.cloud/operator/stable
- name: keystone-operator
version: 0.20240704.1
version: 0.20240801.0
repository:
url: https://charts.yaook.cloud/operator/stable
- name: keystone-resources-operator
version: 0.20240704.1
version: 0.20240801.0
repository:
url: https://charts.yaook.cloud/operator/stable
- name: horizon-operator
version: 0.20240801.0
repository:
url: https://charts.yaook.cloud/operator/stable
7 changes: 7 additions & 0 deletions charts/cds-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v2
description: Yaook ConfiguredDaemonSet operator
type: application
name: cds-operator
version: "0.20240801.0"
appVersion: "0.20240801.0"
kubeVersion: ">=1.16.0-0"
7 changes: 7 additions & 0 deletions charts/cds-operator/charts/operator-lib/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v2
description: Yaook Operator Helm Chart library
type: library
name: operator-lib
version: 1.0.0
appVersion: 1.0.0
kubeVersion: ">=1.16.0-0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- define "yaook.operator-lib.ClusterRoleBinding" -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "yaook.operator-lib.fullname" . }}
labels:
{{- include "yaook.operator-lib.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "yaook.operator-lib.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ include "yaook.operator-lib.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
100 changes: 100 additions & 0 deletions charts/cds-operator/charts/operator-lib/templates/_deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{{- define "yaook.operator-lib.Deployment" -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "yaook.operator-lib.fullname" . }}
labels:
{{- include "yaook.operator-lib.labels" . | nindent 4 }}
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
{{- include "yaook.operator-lib.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "yaook.operator-lib.labels" . | nindent 8 }}
spec:
serviceAccountName: {{ include "yaook.operator-lib.fullname" . }}
containers:
- name: operator
image: {{ include "yaook.operator-lib.image" . }}
imagePullPolicy: {{ .Values.operator.image.pullPolicy }}
securityContext:
runAsUser: 2020
runAsGroup: 2020
ports:
- containerPort: 8000
name: metrics
protocol: TCP
args:
- {{ include "yaook.operator.name" . | quote }}
- run
env:
- name: YAOOK_OP_VERBOSITY
value: {{ .Values.operator.verbosity | toString | toYaml }}
- name: YAOOK_OP_RUNNER_COUNT
value: {{ .Values.operator.runnerCount | toString | toYaml }}
- name: YAOOK_OP_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: YAOOK_OP_MULTIPLE_NAMESPACES
value: {{ .Values.operator.multipleNamespaces | toString | toYaml }}
- name: PYTHONOPTIMIZE
{{- if .Values.operator.pythonOptimize }}
value: "1"
{{- else }}
value: "0"
{{- end }}
{{- if .Values.operator.dockerConfigSecret }}
- name: YAOOK_OP_DOCKER_CONFIG
value: /var/run/secrets/docker/.dockerconfigjson
{{- end }}
{{- if .Values.operator.caConfigMap }}
- name: REQUESTS_CA_BUNDLE
value: /etc/pki/tls/certs/ca-bundle.crt
{{- end }}
{{- include "yaook.operator-lib.env" . | nindent 8 }}
volumeMounts:
{{- if .Values.operator.dockerConfigSecret }}
- mountPath: /var/run/secrets/docker
name: docker-config
readOnly: true
{{- end }}
{{- if .Values.operator.caConfigMap }}
- mountPath: /etc/pki/tls/certs
name: ca-certs
{{- end }}
volumes:
{{- if .Values.operator.dockerConfigSecret }}
- name: docker-config
secret:
secretName: {{ .Values.operator.dockerConfigSecret | quote }}
{{- end }}
{{- if .Values.operator.caConfigMap }}
- name: ca-certs
configMap:
defaultMode: 420
name: {{ .Values.operator.caConfigMap | quote }}
{{- end }}
{{- with .Values.operator.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.operator.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.operator.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.operator.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "yaook.operator-lib.scheduling" . | nindent 6 }}
{{- end -}}
84 changes: 84 additions & 0 deletions charts/cds-operator/charts/operator-lib/templates/_lib.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{{- define "yaook.operator-lib.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "yaook.operator-lib.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 55 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 55 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 55 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{- define "yaook.operator-lib.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "yaook.operator-lib.labels" -}}
helm.sh/chart: {{ include "yaook.operator-lib.chart" . }}
{{ include "yaook.operator-lib.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
{{- end -}}

{{- define "yaook.operator-lib.selectorLabels" -}}
app.kubernetes.io/name: {{ include "yaook.operator-lib.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{- define "yaook.operator-lib.image" -}}
{{ .Values.operator.image.repository }}:{{ default .Chart.AppVersion .Values.operator.image.tag }}
{{- end -}}

{{- define "yaook.operator.extraEnv" -}}
{{- end -}}

{{- define "yaook.operator-lib.env" -}}
{{- range .Values.operator.extraEnv }}
- {{ . | toYaml | nindent 2 }}
{{- end }}
{{ include "yaook.operator.extraEnv" . }}
{{- end -}}

{{- define "yaook.operator-lib.applySchedulingKeys" -}}
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
{{- range . }}
- matchExpressions:
- key: {{ . }}
operator: Exists
{{- end }}
tolerations:
{{- range . }}
- key: {{ . }}
operator: Exists
{{- end }}
{{- end -}}

{{- define "yaook.operator-lib.scheduling" -}}
{{- if .Values.operator.schedulingKeys }}
{{- include "yaook.operator-lib.applySchedulingKeys" .Values.operator.schedulingKeys }}
{{- else }}
{{- with .Values.operator.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.operator.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.operator.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- define "yaook.operator-lib.RoleBinding" -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
namespace: {{ .Release.Namespace }}
name: {{ include "yaook.operator-lib.fullname" . }}
labels:
{{- include "yaook.operator-lib.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "yaook.operator-lib.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ include "yaook.operator-lib.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- define "yaook.operator-lib.ServiceAccount" -}}
apiVersion: v1
kind: ServiceAccount
metadata:
namespace: {{ .Release.Namespace }}
name: {{ include "yaook.operator-lib.fullname" . }}
labels:
{{- include "yaook.operator-lib.labels" . | nindent 4 }}
{{- end -}}
18 changes: 18 additions & 0 deletions charts/cds-operator/charts/operator-lib/templates/_service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- define "yaook.operator-lib.Service" -}}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "yaook.operator-lib.fullname" . }}
labels:
{{- include "yaook.operator-lib.labels" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
spec:
type: ClusterIP
selector:
{{- include "yaook.operator-lib.selectorLabels" . | nindent 6 }}
ports:
- name: metrics
port: 8000
protocol: TCP
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- define "yaook.operator-lib.ServiceMonitor" -}}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "yaook.operator-lib.fullname" . }}
labels:
{{- include "yaook.operator-lib.labels" . | nindent 4 }}
{{- range $key, $val := .Values.operator.additionalServiceMonitorLabels }}
{{ $key }}: {{ $val }}
{{- end }}
namespace: {{ .Release.Namespace }}
spec:
selector:
matchLabels:
{{- include "yaook.operator-lib.selectorLabels" . | nindent 6 }}
endpoints:
- port: metrics
interval: 15s
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
{{- end }}
3 changes: 3 additions & 0 deletions charts/cds-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{- define "yaook.operator.name" -}}
cds
{{- end -}}
1 change: 1 addition & 0 deletions charts/cds-operator/templates/cluster-role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ include "yaook.operator-lib.ClusterRoleBinding" . }}
1 change: 1 addition & 0 deletions charts/cds-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ include "yaook.operator-lib.Deployment" . }}
Loading