adutra commented on code in PR #4755:
URL: https://github.com/apache/polaris/pull/4755#discussion_r3437257032


##########
helm/polaris/templates/cronjob-maintenance.yaml:
##########
@@ -0,0 +1,149 @@
+{{/*
+  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.
+*/}}
+
+{{- range $jobName, $jobSpec := .Values.maintenance.jobs }}
+{{- if $jobSpec.enabled }}
+{{- $cronName := printf "%s-maint-%s" (include "polaris.fullname" $) $jobName 
}}
+{{- if gt (len $cronName) 52 }}
+  {{- fail (printf "Maintenance CronJob name %q is %d chars; must be <= 52 
(K8s appends a timestamp+random suffix to generated Pod names, which are capped 
at 63). Shorten release name, nameOverride/fullnameOverride, or the job key 
%q." $cronName (len $cronName) $jobName) }}
+{{- end }}
+---
+apiVersion: batch/v1
+kind: CronJob
+metadata:
+  name: {{ $cronName }}
+  namespace: {{ $.Release.Namespace }}
+  labels:
+    {{- include "polaris.labels" $ | nindent 4 }}
+  {{- with $.Values.maintenance.annotations }}
+  annotations:
+    {{- tpl (toYaml .) $ | nindent 4 }}
+  {{- end }}
+spec:
+  schedule: {{ $jobSpec.schedule | quote }}
+  concurrencyPolicy: {{ default "Forbid" $jobSpec.concurrencyPolicy }}
+  {{- if hasKey $jobSpec "successfulJobsHistoryLimit" }}
+  successfulJobsHistoryLimit: {{ $jobSpec.successfulJobsHistoryLimit }}
+  {{- end }}
+  {{- if hasKey $jobSpec "failedJobsHistoryLimit" }}
+  failedJobsHistoryLimit: {{ $jobSpec.failedJobsHistoryLimit }}
+  {{- end }}
+  jobTemplate:
+    spec:
+      {{- if hasKey $jobSpec "backoffLimit" }}
+      backoffLimit: {{ $jobSpec.backoffLimit }}
+      {{- end }}
+      {{- with $jobSpec.activeDeadlineSeconds }}
+      activeDeadlineSeconds: {{ . }}
+      {{- end }}
+      template:
+        metadata:
+          labels:
+            helm.sh/chart: {{ include "polaris.chart" $ }}
+            app.kubernetes.io/name: {{ include "polaris.name" $ }}-maintenance
+            app.kubernetes.io/instance: {{ $.Release.Name }}
+            app.kubernetes.io/component: maintenance
+            app.kubernetes.io/managed-by: {{ $.Release.Service }}
+            {{- if $.Chart.AppVersion }}
+            app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}
+            {{- end }}
+          {{- with $jobSpec.podAnnotations }}
+          annotations:
+            {{- tpl (toYaml .) $ | nindent 12 }}
+          {{- end }}
+        spec:
+          {{- if $.Values.imagePullSecrets }}
+          imagePullSecrets:
+          {{- range $.Values.imagePullSecrets }}
+            - name: {{ . | quote }}
+          {{- end }}
+          {{- end }}
+          restartPolicy: {{ default "Never" $jobSpec.restartPolicy }}
+          {{- with $.Values.priorityClassName }}
+          priorityClassName: {{ tpl . $ | quote }}
+          {{- end }}
+          serviceAccountName: {{ include "polaris.serviceAccountName" $ }}
+          automountServiceAccountToken: false
+          {{- if $.Values.podSecurityContext }}
+          securityContext:
+            {{- tpl (toYaml $.Values.podSecurityContext) $ | nindent 12 }}
+          {{- end }}
+          containers:
+            - name: polaris-admin-tool

Review Comment:
   I actually don't know. But from my experience, if you let users use custom 
images, they WILL use custom images 😄 
   
   But, I think it's reasonable to assume that if they customize the admin tool 
image, the customized image needs to stay compatible with the official one.
   
   So, I take back my comment. No need to change the container name.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to