From f66a90a9fd07b3ff7e8fc7fd4ff2854c850dc43b Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Sun, 7 Jul 2019 08:01:00 +0200 Subject: [PATCH] Working on the RadosGW chart --- charts-wip/radosgw/templates/_helpers.tpl | 16 ++++++++++++++++ charts-wip/radosgw/templates/config.yaml | 16 ++++++++++++++++ charts-wip/radosgw/templates/ingress.yaml | 8 ++------ charts-wip/radosgw/templates/keyring.yaml | 10 ++++++++++ charts-wip/radosgw/templates/statefulset.yaml | 3 +++ charts-wip/radosgw/values.yaml | 15 ++++++++------- 6 files changed, 55 insertions(+), 13 deletions(-) diff --git a/charts-wip/radosgw/templates/_helpers.tpl b/charts-wip/radosgw/templates/_helpers.tpl index fd74fc8..f2fc114 100644 --- a/charts-wip/radosgw/templates/_helpers.tpl +++ b/charts-wip/radosgw/templates/_helpers.tpl @@ -43,3 +43,19 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end -}} + +{{/* +Generate a CEPH keyring file, suitable for base64 encoding +*/}} +{{- define "radosgw.keyringFile" -}} +[client.{{ .Client }}] +key = {{ .Key }} +{{- end --} + +{{/* +Helper for joining a list +*/}} +{{- define "helm-toolkit.utils.joinListWithComma" -}} +{{- $local := dict "first" true -}} +{{- range $k, $v := . -}}{{- if not $local.first -}},{{- end -}}{{- $v -}}{{- $_ := set $local "first" false -}}{{- end -}} +{{- end -}} diff --git a/charts-wip/radosgw/templates/config.yaml b/charts-wip/radosgw/templates/config.yaml index e69de29..49cf3ff 100644 --- a/charts-wip/radosgw/templates/config.yaml +++ b/charts-wip/radosgw/templates/config.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "radosgw.fullname" . }} + labels: +{{ include "radosgw.labels" . | indent 4 }} +data: + ceph.conf: |- + [global] + mon_host = {{ include "helm-toolkit.utils.joinListWithComma" .Values.monHosts }} + rgw frontends = beast port=8008 endpoint=0.0.0.0:8080 + rgw dns name = {{ .Values.dnsName }} +{{- if .Values.extraCephConf }} +{{ .Values.extraCephConf | indent 4 }} +{{- end -}} diff --git a/charts-wip/radosgw/templates/ingress.yaml b/charts-wip/radosgw/templates/ingress.yaml index 13675d3..f6478c7 100644 --- a/charts-wip/radosgw/templates/ingress.yaml +++ b/charts-wip/radosgw/templates/ingress.yaml @@ -22,15 +22,11 @@ spec: {{- end }} {{- end }} rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} + - host: {{ .Values.dnsName | quote }} http: paths: - {{- range .paths }} - - path: {{ . }} + - path: / backend: serviceName: {{ $fullName }} servicePort: http - {{- end }} - {{- end }} {{- end }} diff --git a/charts-wip/radosgw/templates/keyring.yaml b/charts-wip/radosgw/templates/keyring.yaml index e69de29..7de20a7 100644 --- a/charts-wip/radosgw/templates/keyring.yaml +++ b/charts-wip/radosgw/templates/keyring.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "radosgw.fullname" . }} + labels: +{{ include "radosgw.labels" . | indent 4 }} +data: + client.admin.keyring: {{ include "radosgw.keyringFile" (dict "Client" "admin" "Key" .Values.adminKey) | b64enc }} + bootstrap-rgw.keyring: {{ include "radosgw.keyringFile" (dict "Client" "bootstrap-rgw" "Key" .Values.bootstrapKey) | b64enc }} diff --git a/charts-wip/radosgw/templates/statefulset.yaml b/charts-wip/radosgw/templates/statefulset.yaml index f0b88de..c71cc46 100644 --- a/charts-wip/radosgw/templates/statefulset.yaml +++ b/charts-wip/radosgw/templates/statefulset.yaml @@ -12,6 +12,9 @@ spec: app.kubernetes.io/instance: {{ .Release.Name }} template: metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }} + checksum/secrets: {{ include (print $.Template.BasePath "/keyring.yaml") . | sha256sum }} labels: app.kubernetes.io/name: {{ include "radosgw.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/charts-wip/radosgw/values.yaml b/charts-wip/radosgw/values.yaml index 04eec5f..d1c91a4 100644 --- a/charts-wip/radosgw/values.yaml +++ b/charts-wip/radosgw/values.yaml @@ -13,6 +13,14 @@ imagePullSecrets: [] nameOverride: "" fullnameOverride: "" +# monHosts: [] +dnsName: chart-example.local + +# extraCephConf: |- + +# adminKey: +# bootstrapKey: + service: type: ClusterIP port: 8080 @@ -22,9 +30,6 @@ ingress: annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" - hosts: - - host: chart-example.local - paths: [] tls: [] # - secretName: chart-example-tls @@ -32,10 +37,6 @@ ingress: # - chart-example.local resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. # limits: # cpu: 100m # memory: 128Mi