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

feat: Add containerSecurityContext for each container #289

Merged
merged 3 commits into from
Jan 31, 2024
Merged
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
3 changes: 3 additions & 0 deletions helm/flowforge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ If using an external PostgreSQL Database you will need to create the database an
- `forge.clusterRole.name` custom name for the ClusterRole (default `create-pod`)
- `forge.resources` allows to configure [resources](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) for the core application container
- `forge.podSecurityContext` allows to configure [securityContext](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) for the core application pod
- `forge.containerSecurityContext` allows to configure [securityContext](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) for the core application container


note: `forge.projectSelector` and `forge.managementSelector` defaults mean that you must have at least 2 nodes in your cluster and they need to be labeled before installing.
Expand Down Expand Up @@ -80,6 +81,7 @@ To use STMP to send email
- `forge.broker.affinity` allows to configure [affinity or anti-affinity](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) for the broker pod
- `forge.broker.resources` allows to configure [resources](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) for the broker container
- `forge.broker.podSecurityContext` allows to configure [securityContext](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) for the broker pod
- `forge.broker.containerSecurityContext` allows to configure [securityContext](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) for the broker container

### Telemetry

Expand Down Expand Up @@ -129,6 +131,7 @@ Enables FlowForge Telemetry
- `forge.fileStore.context.quota` Sets the maximum number of bytes that a project can store in Persistent Context (default `1048576`)
- `forge.fileStore.resources` allows to configure [resources](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) for the file-server container
- `forge.fileStore.podSecurityContext` allows to configure [securityContext](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) for the flowforge-file pod
- `forge.fileStore.containerSecurityContext` allows to configure [securityContext](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) for the flowforge-file container

### Private Certificate Authority

Expand Down
4 changes: 1 addition & 3 deletions helm/flowforge/templates/broker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ spec:
name: mqtt-native
- containerPort: 1884
name: mqtt-ws
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
securityContext: {{- toYaml .Values.forge.broker.containerSecurityContext | nindent 10 }}
# livenessProbe:
# httpGet:
# path: /ping.html
Expand Down
6 changes: 2 additions & 4 deletions helm/flowforge/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,11 @@ spec:
readOnly: true
{{- end }}
ports:
- containerPort: 3000
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
- containerPort: 3000
{{- if .Values.forge.resources }}
resources: {{- toYaml .Values.forge.resources | nindent 12 }}
{{- end }}
securityContext: {{- toYaml .Values.forge.containerSecurityContext | nindent 10 }}
{{- if .Values.forge.registrySecrets }}
imagePullSecrets:
{{- range .Values.forge.registrySecrets }}
Expand Down
4 changes: 1 addition & 3 deletions helm/flowforge/templates/file-storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ spec:
{{ end -}}
ports:
- containerPort: 3001
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
securityContext: {{- toYaml .Values.forge.fileStore.containerSecurityContext | nindent 10 }}
{{- if .Values.forge.fileStore.resources }}
resources: {{- toYaml .Values.forge.fileStore.resources | nindent 12 }}
{{- end }}
Expand Down
9 changes: 9 additions & 0 deletions helm/flowforge/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@
}
}
}
},
"containerSecurityContext": {
"type": "object"
}
},
"required": [
Expand Down Expand Up @@ -397,6 +400,9 @@
}
}
}
},
"containerSecurityContext": {
"type": "object"
}
},
"required": [
Expand Down Expand Up @@ -539,6 +545,9 @@
}
}
}
},
"containerSecurityContext": {
"type": "object"
}

},
Expand Down
10 changes: 10 additions & 0 deletions helm/flowforge/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ forge:
fsGroup: 1000
seccompProfile:
type: RuntimeDefault
containerSecurityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
fileStore:
enabled: false
type: localfs
Expand All @@ -48,6 +51,9 @@ forge:
fsGroup: 1000
seccompProfile:
type: RuntimeDefault
containerSecurityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
support:
enabled: false

Expand All @@ -74,6 +80,10 @@ forge:
seccompProfile:
type: RuntimeDefault

containerSecurityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true

postgresql:
auth:
postgresPassword: Moomiet0
Expand Down
Loading