-
Notifications
You must be signed in to change notification settings - Fork 183
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
Add custom terraform and bash script to the setup #1020
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,34 @@ | ||
#!/bin/bash | ||
# | ||
# This script copies files from /customer-scripts to /scripts/<dirname> basing on the filename | ||
# | ||
# Example file structure: | ||
# | ||
# /customer-scripts | ||
# ├── dir1_main.tf | ||
# ├── dir1_setup.sh | ||
# ├── dir2_list.txt | ||
# └── dir2_setup.sh | ||
# | ||
# Expected structure: | ||
# | ||
# /scripts | ||
# ├── dir1 | ||
# │ ├── main.tf | ||
# │ └── setup.sh | ||
# └── dir2 | ||
# ├── list.txt | ||
# └── setup.sh | ||
# | ||
# shellcheck disable=SC2010 | ||
# extract target directory names from the file names using _ as separator | ||
for dir in $(ls -1 /customer-scripts | grep _ | grep -oE '^.*?_' | sed 's/_//g' | sort | uniq); do | ||
target="/scripts/${dir}" | ||
mkdir "${target}" | ||
# shellcheck disable=SC2010 | ||
# Get files for given directory and take only filename part (after first _) | ||
for file in $(ls -1 "/customer-scripts/${dir}_"* | grep -oE '_.*' | sed 's/_//g'); do | ||
cp "/customer-scripts/${dir}_${file}" "${target}/${file}" | ||
done | ||
cd "${target}" && bash setup.sh | ||
done |
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
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
18 changes: 18 additions & 0 deletions
18
deploy/helm/sumologic/templates/setup/setup-custom-configmap.yaml
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,18 @@ | ||
{{- if .Values.sumologic.setup.additionalFiles }} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "sumologic.metadata.name.setup.configmap-custom" . }} | ||
annotations: | ||
{{ include "sumologic.annotations.app.setup.helmsh" "2" | indent 4 }} | ||
labels: | ||
app: {{ template "sumologic.labels.app.setup.configmap-custom" . }} | ||
{{- include "sumologic.labels.common" . | nindent 4 }} | ||
data: | ||
{{- range $directory, $files := .Values.sumologic.setup.additionalFiles }} | ||
{{- range $filename, $file := $files }} | ||
{{ printf "%s_%s: |-" $directory $filename }} | ||
{{- $file | nindent 4 }} | ||
{{- end }} | ||
{{- 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Ok so this will work but it will keep the changed CWD from the last
dir
in the loop hence the directory for the caller will be changed.To fix that we can e.g. save the dir before the loop and then
popd
orcd
to it at the endThere 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.
I'm operating on absolute paths, so
CWD
inside thecustom.sh
doesn't impact on anything