From 6ce95ba331d04a6baecd5b7c471c65de0f611921 Mon Sep 17 00:00:00 2001 From: fraochan <191790197+fraochan@users.noreply.github.com> Date: Sun, 15 Dec 2024 19:46:41 +0000 Subject: [PATCH] Add recon support --- charts/ozone/templates/NOTES.txt | 7 ++ charts/ozone/templates/_helpers.tpl | 4 + .../templates/recon/recon-deployment.yaml | 100 ++++++++++++++++++ .../ozone/templates/recon/recon-service.yaml | 46 ++++++++ charts/ozone/values.yaml | 27 +++++ 5 files changed, 184 insertions(+) create mode 100644 charts/ozone/templates/recon/recon-deployment.yaml create mode 100644 charts/ozone/templates/recon/recon-service.yaml diff --git a/charts/ozone/templates/NOTES.txt b/charts/ozone/templates/NOTES.txt index 3479e5c..59b8b07 100644 --- a/charts/ozone/templates/NOTES.txt +++ b/charts/ozone/templates/NOTES.txt @@ -45,3 +45,10 @@ Datanode S3 Gateway To access S3 Gateway from a local environment, use the following command and specify localhost:{{ .Values.s3g.service.port }} as S3 endpoint $ kubectl port-forward svc/{{ .Release.Name }}-s3g {{ .Values.s3g.service.port }}:{{ .Values.s3g.service.port }} + +{{- if .Values.recon.enabled }} + +Recon + To access Recon from a local environment, use the following command and specify localhost:{{ .Values.recon.service.port }} as Recon endpoint + $ kubectl port-forward svc/{{ .Release.Name }}-recon {{ .Values.recon.service.port }}:{{ .Values.recon.service.port }} +{{- end }} \ No newline at end of file diff --git a/charts/ozone/templates/_helpers.tpl b/charts/ozone/templates/_helpers.tpl index e5f56a8..32de6a5 100644 --- a/charts/ozone/templates/_helpers.tpl +++ b/charts/ozone/templates/_helpers.tpl @@ -73,4 +73,8 @@ app.kubernetes.io/instance: {{ .Release.Name }} value: "1" - name: OZONE-SITE.XML_dfs.datanode.use.datanode.hostname value: "true" +{{- if .Values.recon.enabled }} +- name: OZONE-SITE.XML_ozone.recon.address + value: "{{- printf "%s-recon.%s.svc.cluster.local" $.Release.Name $.Release.Namespace }}:9891" +{{- end }} {{- end }} diff --git a/charts/ozone/templates/recon/recon-deployment.yaml b/charts/ozone/templates/recon/recon-deployment.yaml new file mode 100644 index 0000000..f05caa7 --- /dev/null +++ b/charts/ozone/templates/recon/recon-deployment.yaml @@ -0,0 +1,100 @@ +{{/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/}} + +{{- if .Values.recon.enabled }} +{{- $env := concat .Values.env .Values.recon.env }} +{{- $envFrom := concat .Values.envFrom .Values.recon.envFrom }} +{{- $nodeSelector := or .Values.recon.nodeSelector .Values.nodeSelector }} +{{- $affinity := or .Values.recon.affinity .Values.affinity }} +{{- $tolerations := or .Values.recon.tolerations .Values.tolerations }} +{{- $securityContext := or .Values.recon.securityContext .Values.securityContext }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-recon + labels: + {{- include "ozone.labels" . | nindent 4 }} + app.kubernetes.io/component: recon +spec: + replicas: 1 + selector: + matchLabels: + {{- include "ozone.selectorLabels" . | nindent 6 }} + app.kubernetes.io/component: recon + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/ozone-configmap.yaml") . | sha256sum }} + labels: + {{- include "ozone.selectorLabels" . | nindent 8 }} + app.kubernetes.io/component: recon + spec: + containers: + - name: recon + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- with .Values.recon.command }} + command: {{- tpl (toYaml .) $ | nindent 12 }} + {{- end }} + {{- with .Values.recon.args }} + args: {{- tpl (toYaml .) $ | nindent 12 }} + {{- end }} + env: + {{- include "ozone.configuration.env" . | nindent 12 }} + {{- with $env }} + {{- tpl (toYaml .) $ | nindent 12 }} + {{- end }} + {{- with $envFrom }} + envFrom: {{- tpl (toYaml .) $ | nindent 12 }} + {{- end }} + ports: + - name: ui + containerPort: {{ .Values.recon.service.port }} + livenessProbe: + tcpSocket: + port: 9891 + initialDelaySeconds: 30 + readinessProbe: + tcpSocket: + port: 9891 + initialDelaySeconds: 30 + volumeMounts: + - name: config + mountPath: {{ .Values.configuration.dir }} + {{- with $nodeSelector }} + nodeSelector: {{- toYaml . | nindent 8 }} + {{- end }} + {{- with $affinity }} + affinity: {{- toYaml . | nindent 8 }} + {{- end }} + {{- with $tolerations }} + tolerations: {{- toYaml . | nindent 8 }} + {{- end }} + {{- with $securityContext }} + securityContext: {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + - name: config + projected: + sources: + - configMap: + name: {{ .Release.Name }}-ozone + {{- with .Values.configuration.filesFrom }} + {{- tpl (toYaml .) $ | nindent 14 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/ozone/templates/recon/recon-service.yaml b/charts/ozone/templates/recon/recon-service.yaml new file mode 100644 index 0000000..fe21f1e --- /dev/null +++ b/charts/ozone/templates/recon/recon-service.yaml @@ -0,0 +1,46 @@ +{{/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/}} + +{{- if .Values.recon.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-recon + labels: + {{- include "ozone.labels" . | nindent 4 }} + app.kubernetes.io/component: recon + {{- with .Values.recon.service.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.recon.service.annotations }} + annotations: {{- toYaml . | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.recon.service.type }} + ports: + - name: ui + port: {{ .Values.recon.service.port }} + {{- if and (eq .Values.recon.service.type "NodePort") (.Values.recon.service.nodePort) }} + nodePort: {{ .Values.recon.service.nodePort }} + {{- end }} + - name: tcp + port: 9891 + selector: + {{- include "ozone.selectorLabels" . | nindent 4 }} + app.kubernetes.io/component: recon +{{- end }} \ No newline at end of file diff --git a/charts/ozone/values.yaml b/charts/ozone/values.yaml index c2146b3..4d5afd6 100644 --- a/charts/ozone/values.yaml +++ b/charts/ozone/values.yaml @@ -230,3 +230,30 @@ scm: size: 10Gi # The name of a specific storage class name to use storageClassName: ~ + +# Recon configuration +recon: + enabled: false + # Command to launch Recon (templated) + command: ~ + # Arguments to launch Recon (templated) + args: ["ozone", "recon"] + # Additional Recon environment variables (templated) + env: [] + # Additional Recon envFrom items to set up environment variables (templated) + envFrom: [] + # Constrain Recon pods to nodes with specific node labels + nodeSelector: {} + # Constrain Recon pods to nodes by affinity/anti-affinity rules + affinity: {} + # Allow to schedule Recon pods on nodes with matching taints + tolerations: [] + # Recon security context (overwrites common security context) + securityContext: {} + # Recon service configuration + service: + type: ClusterIP + port: 9888 + nodePort: ~ + labels: {} + annotations: {} \ No newline at end of file