forked from Oteemo/charts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
245 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{{- if or .Values.initSysctl.enabled .Values.elasticsearch.configureNode }} | ||
|
||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{ template "sonarqube.fullname" . }} | ||
labels: | ||
app: {{ template "sonarqube.name" . }} | ||
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
app.kubernetes.io/name: {{ template "sonarqube.name" . }}-{{ template "sonarqube.fullname" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/part-of: sonarqube | ||
app.kubernetes.io/component: {{ template "sonarqube.fullname" . }} | ||
app.kubernetes.io/version: {{ .Values.image.tag | quote }} | ||
spec: | ||
template: | ||
spec: | ||
{{- if .Values.initSysctl.serviceAccount.create }} | ||
{{- if .Values.initSysctl.serviceAccount.name }} | ||
serviceAccountName: {{ .Values.initSysctl.serviceAccount.name }} | ||
{{- else }} | ||
serviceAccountName: {{ include "sonarqube.fullname" . }}-initsysctl | ||
{{- end }} | ||
{{- end }} | ||
containers: | ||
- name: init-sysctl | ||
image: {{ default "busybox:1.32" .Values.initSysctl.image }} | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
{{- if $securityContext := (default .Values.initContainers.securityContext .Values.initSysctl.securityContext) }} | ||
securityContext: | ||
{{ toYaml $securityContext | indent 12 }} | ||
{{- end }} | ||
resources: | ||
{{ toYaml (default .Values.initContainers.resources .Values.initSysctl.resources) | indent 12 }} | ||
command: ["sh", | ||
"-e", | ||
"/tmp/scripts/init_sysctl.sh"] | ||
volumeMounts: | ||
- name: init-sysctl | ||
mountPath: /tmp/scripts/ | ||
{{- with .Values.env }} | ||
env: | ||
{{- . | toYaml | trim | nindent 12 }} | ||
{{- end }} | ||
restartPolicy: {{ .Values.initSysctl.job.restartPolicy }} | ||
volumes: | ||
- name: init-sysctl | ||
configMap: | ||
name: {{ template "sonarqube.fullname" . }}-init-sysctl | ||
items: | ||
- key: init_sysctl.sh | ||
path: init_sysctl.sh | ||
|
||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{{- if .Values.initSysctl.serviceAccount.create -}} | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
{{- if .Values.initSysctl.serviceAccount.name }} | ||
name: {{ .Values.initSysctl.serviceAccount.name }} | ||
{{- else }} | ||
name: {{ include "sonarqube.fullname" . }}-initsysctl | ||
{{- end }} | ||
{{- if .Values.serviceAccount.annotations }} | ||
annotations: | ||
{{ toYaml .Values.serviceAccount.annotations | indent 4 }} | ||
{{- end }} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{{- if and (.Values.OpenShift.enabled) (.Values.OpenShift.createSCC) }} | ||
{{- if and (.Values.initSysctl.serviceAccount.create) (not .Values.initSysctl.serviceAccount.name) }} | ||
|
||
# This SCC allows any user ID except root | ||
apiVersion: security.openshift.io/v1 | ||
kind: SecurityContextConstraints | ||
metadata: | ||
annotations: | ||
kubernetes.io/description: "allows pod to run as root, privileged and run sysctl" | ||
"helm.sh/hook": pre-install | ||
name: {{ .Release.Name }}-initsysctl-privileged-scc | ||
allowHostDirVolumePlugin: false | ||
allowHostIPC: false | ||
allowHostNetwork: false | ||
allowHostPID: false | ||
allowHostPorts: false | ||
allowPrivilegedContainer: true | ||
allowPrivilegeEscalation: true | ||
allowedCapabilities: [] | ||
allowedFlexVolumes: [] | ||
allowedUnsafeSysctls: [] | ||
defaultAddCapabilities: [] | ||
defaultAllowPrivilegeEscalation: true | ||
fsGroup: | ||
type: RunAsAny | ||
readOnlyRootFilesystem: false | ||
requiredDropCapabilities: | ||
- KILL | ||
- MKNOD | ||
- SETUID | ||
- SETGID | ||
runAsUser: | ||
type: RunAsAny | ||
# This can be customized for your host machine | ||
seLinuxContext: | ||
type: MustRunAs | ||
# seLinuxOptions: | ||
# level: | ||
# user: | ||
# role: | ||
# type: | ||
supplementalGroups: | ||
type: RunAsAny | ||
# This can be customized for your host machine | ||
volumes: | ||
- configMap | ||
- downwardAPI | ||
- emptyDir | ||
- persistentVolumeClaim | ||
- projected | ||
- secret | ||
# If you want a priority on your SCC -- set for a value more than 0 | ||
priority: 11 | ||
users: | ||
- system:serviceaccount:{{ .Release.Namespace }}:{{ .Release.Name }}-sonarqube-initsysctl | ||
|
||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{{- if and (.Values.OpenShift.enabled) (.Values.OpenShift.createSCC) }} | ||
|
||
# This SCC allows any user ID except root | ||
apiVersion: security.openshift.io/v1 | ||
kind: SecurityContextConstraints | ||
metadata: | ||
annotations: | ||
kubernetes.io/description: "nonroot provides all features of the restricted SCC | ||
but allows users to run with any non-root UID. The user must specify the UID | ||
or it must be specified on the by the manifest of the container runtime." | ||
"helm.sh/hook": pre-install | ||
name: {{ .Release.Name }}-nonroot-scc | ||
allowHostDirVolumePlugin: false | ||
allowHostIPC: false | ||
allowHostNetwork: false | ||
allowHostPID: false | ||
allowHostPorts: false | ||
allowPrivilegedContainer: false | ||
allowPrivilegeEscalation: true | ||
allowedCapabilities: [] | ||
allowedFlexVolumes: [] | ||
allowedUnsafeSysctls: [] | ||
defaultAddCapabilities: [] | ||
defaultAllowPrivilegeEscalation: true | ||
forbiddenSysctls: | ||
- "*" | ||
fsGroup: | ||
type: RunAsAny | ||
readOnlyRootFilesystem: false | ||
requiredDropCapabilities: | ||
- KILL | ||
- MKNOD | ||
- SETUID | ||
- SETGID | ||
runAsUser: | ||
type: MustRunAsNonRoot | ||
# This can be customized for your host machine | ||
seLinuxContext: | ||
type: MustRunAs | ||
# seLinuxOptions: | ||
# level: | ||
# user: | ||
# role: | ||
# type: | ||
supplementalGroups: | ||
type: RunAsAny | ||
# This can be customized for your host machine | ||
volumes: | ||
- configMap | ||
- downwardAPI | ||
- emptyDir | ||
- persistentVolumeClaim | ||
- projected | ||
- secret | ||
# If you want a priority on your SCC -- set for a value more than 0 | ||
priority: 11 | ||
users: | ||
{{- if .Values.serviceAccount.name }} | ||
- system:serviceaccount:{{ .Release.Namespace }}:{{ .Release.Name }}-{{ .Values.serviceAccount.name }} | ||
{{- else }} | ||
- system:serviceaccount:{{ .Release.Namespace }}:{{ .Release.Name }}-sonarqube | ||
{{- end }} | ||
- system:serviceaccount:{{ .Release.Namespace }}:{{ .Release.Name }}-postgresql | ||
|
||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters