-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mount volumes for tmp directories, apply best practice to sc (#38)
* mount volumes for tmp directories, apply best practice to sc * bump version * use safe sc for bundled apps (postgres, memcached) too * use read-only filesystem with mounted tmp volumes unless in development mode * revert version bump to let this be handled by changeset flow * amend dev readme * Create bright-students-eat.md --------- Co-authored-by: Oliver Günther <[email protected]>
- Loading branch information
1 parent
b59f5fe
commit 7fc8ea3
Showing
10 changed files
with
268 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@fake-scope/fake-pkg": major | ||
--- | ||
|
||
* rename `securityContext` to `containerSecurityContext` in `values.yaml` | ||
* mount volumes for tmp directories to make containers work in accordance with best practices, that is with read-only file systems | ||
* use secure defaults for container security policy |
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,46 @@ | ||
#!/bin/bash | ||
|
||
# Outputs the generated helm configurations after templating. | ||
|
||
yaml_output=/tmp/op-hc-yaml-output.txt | ||
error_output=/tmp/op-hc-error-output.txt | ||
section_output=/tmp/op-hc-section-output.yml | ||
vimrc=/tmp/op-hc-vim-rc | ||
|
||
rm $yaml_output $error_output $section_output $vimrc &>/dev/null | ||
|
||
helm template --debug "$@" . 1> $yaml_output 2> $error_output | ||
|
||
if [ $? -gt 0 ]; then | ||
section=`cat $error_output | grep 'Error: YAML parse error on' | cut -d: -f2 | cut -d' ' -f6-` | ||
|
||
if [ -n "$section" ]; then | ||
cat $yaml_output | sed -e "0,/\# Source: ${section//\//\\/}/d" | tail -n+2 | sed -e '/---/,$d' > $section_output | ||
|
||
line=`cat $error_output | grep line | head -n1 | perl -nle 'm/line (\d+)/; print $1'` | ||
|
||
if [ -n "$line" ]; then | ||
echo "autocmd VimEnter * echo '`cat $error_output | grep line | head -n1`'" > $vimrc | ||
vim +$line -u $vimrc $section_output | ||
else | ||
echo | ||
echo "Template error: " | ||
echo | ||
echo --- | ||
cat $section_output | ||
cat $error_output | ||
fi | ||
else | ||
echo | ||
echo "Template error: " | ||
echo | ||
echo --- | ||
cat $yaml_output | ||
cat $error_output | ||
fi | ||
else | ||
cat $yaml_output | ||
|
||
echo | ||
echo "Syntax ok" | ||
fi |
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,6 @@ | ||
# !/bin/bash | ||
|
||
# Install OpenProject in development mode, that is without https and allowing writes | ||
# to the container file system. | ||
|
||
helm upgrade --create-namespace --namespace openproject --install openproject --set develop=true "$@" . |
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,40 @@ | ||
{{/* | ||
Returns the OpenProject image to be used including the respective registry and image tag. | ||
*/}} | ||
{{- define "openproject.image" -}} | ||
{{ .Values.image.registry }}/{{ .Values.image.repository }}{{ if .Values.image.sha256 }}@sha256:{{ .Values.image.sha256 }}{{ else }}:{{ .Values.image.tag }}{{ end }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Yields the configured container security context if enabled. | ||
Allows writing to the container file system in development mode | ||
This way the OpenProject container works without mounted tmp volumes | ||
which may not work correctly in local development clusters. | ||
*/}} | ||
{{- define "openproject.containerSecurityContext" }} | ||
{{- if .Values.containerSecurityContext.enabled }} | ||
securityContext: | ||
{{- | ||
mergeOverwrite | ||
(omit .Values.containerSecurityContext "enabled" | deepCopy) | ||
(dict "readOnlyRootFilesystem" (not .Values.develop)) | ||
| toYaml | ||
| nindent 2 | ||
}} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* Yields the configured pod security context if enabled. */}} | ||
{{- define "openproject.podSecurityContext" }} | ||
{{- if .Values.podSecurityContext.enabled }} | ||
securityContext: | ||
{{ omit .Values.podSecurityContext "enabled" | toYaml | nindent 2 | trim }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "openproject.useTmpVolumes" -}} | ||
{{- if not .Values.develop -}} | ||
{{- true -}} | ||
{{- 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
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
Oops, something went wrong.