Skip to content

Commit

Permalink
Add container security context for core application, broker, and file…
Browse files Browse the repository at this point in the history
… storage containers
  • Loading branch information
ppawlowski committed Jan 28, 2024
1 parent 6c02d85 commit c5be981
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 10 deletions.
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.broker.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
7 changes: 7 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 Down Expand Up @@ -74,6 +77,10 @@ forge:
seccompProfile:
type: RuntimeDefault

containerSecurityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true

postgresql:
auth:
postgresPassword: Moomiet0
Expand Down

0 comments on commit c5be981

Please sign in to comment.