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

[artifactory] [artifactory-ha] Support Openshift helm install #1744

Closed
wants to merge 2 commits into from
Closed
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
152 changes: 32 additions & 120 deletions stable/artifactory-ha/templates/artifactory-primary-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ metadata:
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
{{- define "securityContext" }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
runAsUser: {{ .Values.artifactory.uid }}
runAsGroup: {{ .Values.artifactory.gid }}
privileged: false
{{- end }}
spec:
serviceName: {{ template "artifactory-ha.primary.name" . }}
replicas: {{ .Values.artifactory.primary.replicaCount }}
Expand Down Expand Up @@ -89,6 +100,7 @@ spec:
securityContext:
runAsUser: {{ .Values.artifactory.uid }}
fsGroup: {{ .Values.artifactory.gid }}
runAsGroup: {{ .Values.artifactory.gid }}
{{- if .Values.artifactory.fsGroupChangePolicy }}
fsGroupChangePolicy: {{ .Values.artifactory.fsGroupChangePolicy }}
{{- end }}
Expand All @@ -111,12 +123,7 @@ spec:
- name: "create-artifactory-data-dir"
image: "{{ .Values.initContainerImage }}"
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
resources:
{{ toYaml .Values.initContainers.resources | indent 10 }}
command:
Expand All @@ -133,12 +140,7 @@ spec:
- name: "delete-db-properties"
image: "{{ .Values.initContainerImage }}"
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
resources:
{{ toYaml .Values.initContainers.resources | indent 10 }}
command:
Expand All @@ -152,12 +154,7 @@ spec:
- name: "remove-lost-found"
image: "{{ .Values.initContainerImage }}"
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
resources:
{{ toYaml .Values.initContainers.resources | indent 10 }}
command:
Expand All @@ -184,12 +181,7 @@ spec:
- name: "access-bootstrap-creds"
image: "{{ .Values.initContainerImage }}"
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
resources:
{{ toYaml .Values.initContainers.resources | indent 10 }}
command:
Expand Down Expand Up @@ -218,12 +210,7 @@ spec:
{{- end }}
- name: 'copy-system-configurations'
image: '{{ .Values.initContainerImage }}'
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
resources:
{{ toYaml .Values.initContainers.resources | indent 10 }}
command:
Expand Down Expand Up @@ -353,12 +340,7 @@ spec:
{{- if or .Values.artifactory.customCertificates.enabled .Values.global.customCertificates.enabled }}
- name: copy-custom-certificates
image: "{{ .Values.initContainerImage }}"
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
resources:
{{ toYaml .Values.initContainers.resources | indent 10 }}
command:
Expand All @@ -376,12 +358,7 @@ spec:
{{- if .Values.artifactory.circleOfTrustCertificatesSecret }}
- name: copy-circle-of-trust-certificates
image: "{{ .Values.initContainerImage }}"
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
resources:
{{ toYaml .Values.initContainers.resources | indent 10 }}
command:
Expand Down Expand Up @@ -421,12 +398,7 @@ spec:
- name: 'migration-artifactory-ha'
image: {{ include "artifactory-ha.getImageInfoByValue" (list . "artifactory") }}
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
resources:
{{ toYaml .Values.artifactory.primary.resources | indent 10 }}
command:
Expand Down Expand Up @@ -564,12 +536,7 @@ spec:
- name: {{ .Values.router.name }}
image: {{ include "artifactory-ha.getImageInfoByValue" (list . "router") }}
imagePullPolicy: {{ .Values.router.image.imagePullPolicy }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
command:
- '/bin/bash'
- '-c'
Expand Down Expand Up @@ -612,12 +579,7 @@ spec:
- name: {{ .Values.frontend.name }}
image: {{ include "artifactory-ha.getImageInfoByValue" (list . "artifactory") }}
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
command:
- '/bin/bash'
- '-c'
Expand Down Expand Up @@ -653,12 +615,7 @@ spec:
- name: {{ .Values.metadata.name }}
image: {{ include "artifactory-ha.getImageInfoByValue" (list . "artifactory") }}
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
command:
- '/bin/bash'
- '-c'
Expand Down Expand Up @@ -745,12 +702,7 @@ spec:
- name: {{ .Values.event.name }}
image: {{ include "artifactory-ha.getImageInfoByValue" (list . "artifactory") }}
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
command:
- '/bin/bash'
- '-c'
Expand Down Expand Up @@ -786,12 +738,7 @@ spec:
- name: {{ .Values.artifactory.replicator.name }}
image: {{ include "artifactory-ha.getImageInfoByValue" (list . "artifactory") }}
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
command:
- '/bin/bash'
- '-c'
Expand Down Expand Up @@ -819,12 +766,7 @@ spec:
- name: {{ .Values.jfconnect.name }}
image: {{ include "artifactory-ha.getImageInfoByValue" (list . "artifactory") }}
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
command:
- '/bin/bash'
- '-c'
Expand Down Expand Up @@ -860,12 +802,7 @@ spec:
- name: {{ .Values.integration.name }}
image: {{ include "artifactory-ha.getImageInfoByValue" (list . "artifactory") }}
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
command:
- '/bin/bash'
- '-c'
Expand Down Expand Up @@ -901,12 +838,7 @@ spec:
- name: {{ .Values.observability.name }}
image: {{ include "artifactory-ha.getImageInfoByValue" (list . "artifactory") }}
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
command:
- '/bin/bash'
- '-c'
Expand Down Expand Up @@ -942,12 +874,7 @@ spec:
- name: {{ .Values.artifactory.name }}
image: {{ include "artifactory-ha.getImageInfoByValue" (list . "artifactory") }}
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
command:
- '/bin/bash'
- '-c'
Expand Down Expand Up @@ -1196,12 +1123,7 @@ spec:
{{- range .Values.artifactory.loggers }}
- name: {{ . | replace "_" "-" | replace "." "-" }}
image: {{ include "artifactory-ha.getImageInfoByValue" (list $ "logger") }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
command:
- 'sh'
- '-c'
Expand All @@ -1219,12 +1141,7 @@ spec:
{{- range .Values.artifactory.catalinaLoggers }}
- name: {{ . | replace "_" "-" | replace "." "-" }}
image: {{ include "artifactory-ha.getImageInfoByValue" (list $ "logger") }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
command:
- 'sh'
- '-c'
Expand All @@ -1243,12 +1160,7 @@ spec:
- name: {{ .Values.filebeat.name }}
image: "{{ .Values.filebeat.image.repository }}:{{ .Values.filebeat.image.version }}"
imagePullPolicy: {{ .Values.filebeat.image.pullPolicy }}
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
capabilities:
drop:
- NET_RAW
{{ include "securityContext" . }
args:
- "-e"
- "-E"
Expand Down
20 changes: 15 additions & 5 deletions stable/artifactory-ha/templates/nginx-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ spec:
{{- range $key, $value := .Values.nginx.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- if .Values.vault}}
{{- include "vaultAnnotationsNginx" . | nindent 8 }}
{{- end}}
labels:
app: {{ template "artifactory-ha.name" . }}
chart: {{ template "artifactory-ha.chart" . }}
Expand All @@ -61,6 +64,9 @@ spec:
- name: "setup"
image: "{{ .Values.initContainerImage }}"
imagePullPolicy: {{ .Values.nginx.image.pullPolicy }}
securityContext:
{{ toYaml . | indent 10 }}
{{- end }}
command:
- '/bin/sh'
- '-c'
Expand All @@ -73,14 +79,15 @@ spec:
securityContext:
runAsUser: {{ .Values.nginx.uid }}
fsGroup: {{ .Values.nginx.gid }}
{{- if .Values.nginx.gid }}
supplementalGroups:
- {{ .Values.nginx.gid }}
{{- end }}
containers:
- name: {{ .Values.nginx.name }}
image: {{ include "artifactory-ha.getImageInfoByValue" (list . "nginx") }}
imagePullPolicy: {{ .Values.nginx.image.pullPolicy }}
{{- with .Values.nginx.securityContext }}
securityContext:
{{ toYaml . | indent 10 }}
{{- end }}
command:
{{- tpl (include "nginx.command" .) . | indent 10 }}
ports:
Expand Down Expand Up @@ -123,9 +130,12 @@ spec:
mountPath: "{{ .Values.nginx.persistence.mountPath }}/conf.d/"
- name: nginx-volume
mountPath: {{ .Values.nginx.persistence.mountPath | quote }}
{{- if .Values.nginx.https.enabled }}
{{- if and .Values.nginx.https.enabled (not .Values.vault) }}
- name: ssl-certificates
mountPath: "{{ .Values.nginx.persistence.mountPath }}/ssl"
- name: platform-client-certs
mountPath: "{{ .Values.nginx.persistence.mountPath }}/ca/ca/.pem"
subPath: ca.pem
{{- end }}
{{- if .Values.nginx.customVolumeMounts }}
{{ tpl (include "artifactory.nginx.customVolumeMounts" .) . | indent 8 }}
Expand Down Expand Up @@ -199,7 +209,7 @@ spec:
{{- else }}
emptyDir: {}
{{- end }}
{{- if .Values.nginx.https.enabled }}
{{- if and .Values.nginx.https.enabled (not .Values.vault) }}
- name: ssl-certificates
secret:
{{- if .Values.nginx.tlsSecretName }}
Expand Down
2 changes: 1 addition & 1 deletion stable/artifactory-ha/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ artifactory:
# fsGroupChangePolicy: "Always"
# seLinuxOptions: {}
terminationGracePeriodSeconds: 30
## By default, the Artifactory StatefulSet is created with a securityContext that sets the `runAsUser` and the `fsGroup` to the `artifactory.uid` value.
## By default, the Artifactory StatefulSet is created with a securityContext that sets the `runAsUser` to the `artifactory.uid` value, and `runAsGroup` and `fsGroup` to the `artifactory.gid` value.
## If you want to disable the securityContext for the Artifactory StatefulSet, set this tag to false
setSecurityContext: true
## The following settings are to configure the frequency of the liveness and startup probes.
Expand Down
Loading