-
Notifications
You must be signed in to change notification settings - Fork 16
feat(server): support openshift nonroot-v2 SCC by default #583
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -147,13 +147,7 @@ A minimal set of writable paths for a read-only root filesystem is: | |||||
| ```yaml | ||||||
| octopus: | ||||||
| containerSecurityContext: | ||||||
| runAsNonRoot: true | ||||||
| runAsGroup: 999 | ||||||
| runAsUser: 999 | ||||||
| readOnlyRootFilesystem: true | ||||||
| podSecurityContext: | ||||||
| fsGroup: 999 | ||||||
| fsGroupChangePolicy: OnRootMismatch | ||||||
|
|
||||||
| serverConfigurationDirectory: /home/octopus/.local | ||||||
|
|
||||||
|
|
@@ -187,6 +181,35 @@ A complete working example including environment variable overrides for .NET too | |||||
|
|
||||||
| Note: `enableDockerInDocker` must be set to `false` when using a read-only root filesystem, as Docker-in-Docker requires a privileged, writable container. | ||||||
|
|
||||||
| ### Openshift | ||||||
| If you are using build in mssql chart on Openshift with values: | ||||||
| ``` | ||||||
| mssql: | ||||||
| enabled: true | ||||||
| ``` | ||||||
|
|
||||||
| Our mssql has such default security contexts for mssql. | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ``` | ||||||
| podSecurityContext: | ||||||
| fsGroup: 10001 | ||||||
| seccompProfile: | ||||||
| type: RuntimeDefault | ||||||
| containerSecurityContext: | ||||||
| runAsUser: 10001 | ||||||
| allowPrivilegeEscalation: false | ||||||
| capabilities: | ||||||
| drop: | ||||||
| - ALL | ||||||
| add: | ||||||
| - NET_BIND_SERVICE | ||||||
| ``` | ||||||
|
|
||||||
| As we're usign hardcoded UID and fsGroup in our `securityContext` you need to assign `nonroot-v2` SCC to allow the SQL Server SA to run: | ||||||
|
|
||||||
| ```oc adm policy add-scc-to-user nonroot-v2 -z octopus-deploy-mssql -n octopus-deploy``` | ||||||
|
|
||||||
|
|
||||||
| ### Ingress | ||||||
| You'll likely want to allow external traffic to your Octopus instance, and this generally means configuring [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/). | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,3 +50,11 @@ this template will return sa_password - either from values or autogenerated | |
| {{- include "random_secret" (list . "sapassword") -}} | ||
| {{- end -}} | ||
| {{- end -}} | ||
|
|
||
| {{- define "mssql.serviceAccountName" -}} | ||
| {{- if .Values.serviceAccount.create -}} | ||
| {{- default (printf "%s-mssql" (include "octopus.fullname" .)) .Values.serviceAccount.name -}} | ||
| {{- else -}} | ||
| default "default-mssql" .Values.serviceAccount.name | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i am not a helm expert, but shouldn't that be inside some |
||
| {{- end -}} | ||
| {{- end -}} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| {{- if .Values.serviceAccount.create -}} | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| {{- with .Values.serviceAccount.annotations }} | ||
| annotations: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| labels: | ||
| {{- include "labels" . | nindent 4 }} | ||
| {{- if .Values.serviceAccount.labels }} | ||
| {{- toYaml .Values.serviceAccount.labels | nindent 4 }} | ||
| {{- end }} | ||
| name: {{ template "mssql.serviceAccountName" . }} | ||
| automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }} | ||
| {{- end -}} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,24 @@ containers: | |
| podAnnotations: {} | ||
|
|
||
| podSecurityContext: | ||
| runAsNonRoot: true | ||
| fsGroup: 10001 | ||
| seccompProfile: | ||
| type: RuntimeDefault | ||
| containerSecurityContext: | ||
| runAsUser: 10001 | ||
| allowPrivilegeEscalation: false | ||
| capabilities: | ||
| drop: | ||
| - ALL | ||
| add: | ||
| - NET_BIND_SERVICE | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is that needed if the port is 1433 (i think this is only needed when running on ports below 1024) |
||
|
|
||
| service: | ||
| port: 1433 | ||
| port: 1433 | ||
|
|
||
| serviceAccount: | ||
| create: true | ||
| automountServiceAccountToken: false | ||
| annotations: {} | ||
| labels: {} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.