Skip to content

Commit

Permalink
Merge branch '2-0-translate-script' into 'master'
Browse files Browse the repository at this point in the history
Add basic values translation script, example 1.x defaults

See merge request big-bang/bigbang!2687
  • Loading branch information
mjnagel committed Apr 17, 2023
2 parents d229b4a + ff1b4cb commit 3a0435c
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 3 deletions.
6 changes: 3 additions & 3 deletions blog/2-0-breaking-changes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
revision_date: Last edited April 13, 2023
revision_date: Last edited April 14, 2023
tags:
- blog
---
Expand All @@ -19,7 +19,7 @@ As mentioned in the first post, a number of values keys will be changing in orde
- `mattermostoperator` -> `mattermostOperator`
- `nexus` -> `nexusRepositoryManager`

Note that your upgrade to 2.0 will fail if you do not modify your values as seen above. Big Bang is now maintaining a [values schema](https://helm.sh/docs/topics/charts/#schema-files) to enforce strict adherence to the allowed/required keys within Big Bang. For reference Big Bang's values schema is located [here](https://repo1.dso.mil/big-bang/bigbang/-/blob/master/chart/values.schema.json).
Note that your upgrade to 2.0 will fail if you do not modify your values as seen above. Big Bang is now maintaining a [values schema](https://helm.sh/docs/topics/charts/#schema-files) to enforce strict adherence to the allowed/required keys within Big Bang. For reference Big Bang's values schema is located [here](https://repo1.dso.mil/big-bang/bigbang/-/blob/master/chart/values.schema.json). You can also leverage the script in `/scripts/values-translate-2-0.sh <values file path>` to perform these translations for you (note that this is a relatively simple script and may not work for your use case).

## Namespace Changes

Expand Down Expand Up @@ -49,7 +49,7 @@ As mentioned in the previous post - Big Bang will deploy by default with a new o
- Gatekeeper: Set `gatekeeper.enabled` and `clusterAuditor.enabled` to true; set `kyverno.enabled`, `kyvernoReporter.enabled`, and `kyvernoPolicies.enabled` to false
- Jaeger: Set `jaeger.enabled` to true; set `tempo.enabled` to false

Provided you make the above adjustments you will be able to deploy with the same set of packages you were using in 1.x.
Provided you make the above adjustments you will be able to deploy with the same set of packages you were using in 1.x. Example values for each of the above are provided in a reference file [here](../docs/assets/configs/example/core-packages-1-x.yaml).

## HelmRelease / GitRepository Name Changes

Expand Down
35 changes: 35 additions & 0 deletions docs/assets/configs/example/core-packages-1-x.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Runtime Security
twistlock:
enabled: true
neuvector:
enabled: false

# Log Forwarding
fluentbit:
enabled: true
promtail:
enabled: false

# Log Storage
elasticsearchKibana:
enabled: true
loki:
enabled: false

# Policy Enforcement
gatekeeper:
enabled: true
clusterAuditor:
enabled: true
kyverno:
enabled: false
kyvernoReporter:
enabled: false
kyvernoPolicies:
enabled: false

# Tracing
jaeger:
enabled: true
tempo:
enabled: false
51 changes: 51 additions & 0 deletions scripts/values-translate-2-0.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
values_file=$1

if [ -z $values_file ]; then
echo "This script requires one parameter, the path to your values file. Rerun the script with that parameter, ex: './scripts/values-translate-2-0.sh my-values-file.yaml'."
exit 1
fi

if [ ! -f $values_file ]; then
echo "Values file not found, verify that the correct path was provided for your values."
exit 1
fi

sed_gsed="sed"
# Verify sed version if on macOS
if [ "$(uname -s)" == "Darwin" ]; then
if command -v gsed >/dev/null 2>&1; then
sed_gsed="gsed"
else
echo "The 'gnu-sed' tool is not installed, but if required when running on macOS. 'gnu-sed' can be installed with 'brew install gnu-sed'."
exit 1
fi
fi

if ! command -v $sed_gsed >/dev/null 2>&1; then
echo "The 'sed' tool is required to run this script. Please install 'sed' then re-run this script."
exit 1
fi

# Update core packages
$sed_gsed -i 's/^istiooperator:$/istioOperator:/' $values_file
$sed_gsed -i 's/^kyvernopolicies:$/kyvernoPolicies:/' $values_file
$sed_gsed -i 's/^kyvernoreporter:$/kyvernoReporter:/' $values_file
$sed_gsed -i 's/^logging:$/elasticsearchKibana:/' $values_file
$sed_gsed -i 's/^eckoperator:$/eckOperator:/' $values_file
# Update addon packages
$sed_gsed -i 's/^\(\s*\)mattermostoperator:$/\1mattermostOperator:/' $values_file
$sed_gsed -i 's/^\(\s*\)nexus:$/\1nexusRepositoryManager:/' $values_file

echo "Values translation completed successfully - validate that the below translations were completed as expected:"
cat << EOF
Core Packages:
istiooperator -> istioOperator
kyvernopolicies -> kyvernoPolicies
kyvernoreporter -> kyvernoReporter
logging -> elasticsearchKibana
eckoperator -> eckOperator
Addon Packages:
mattermostoperator -> mattermostOperator
nexus -> nexusRepositoryManager
EOF
echo "It is important to validate these and confirm that no other keys were affected."

0 comments on commit 3a0435c

Please sign in to comment.