Compare commits

...

1 Commits

Author SHA1 Message Date
Gary Larizza
924600cb83 doc: Helm Values test updates
* Convert all files with.period.separators to hyphen-separators.
* Rename and markdown_test.go to be specific to Helm Values.
* Move helm-values_test.go to be in the same directory as the Helm Values doc.
* Move Blackbox common configuration CUE file to `config/prometheus` so it can be imported as necessary.
* Use explicit import statements for Blackbox common config in `blackbox` and `prometheus` components.
2025-01-10 16:26:42 -08:00
48 changed files with 170 additions and 133 deletions

View File

@@ -1 +0,0 @@
cat <<EOF > components/blackbox.cue

View File

@@ -1,2 +0,0 @@
[main a4bc817] integrate blackbox and prometheus together
2 files changed, 4 insertions(+), 2 deletions(-)

View File

@@ -1,3 +0,0 @@
rendered blackbox in 161.782375ms
rendered prometheus in 203.388ms
rendered platform in 203.481459ms

View File

@@ -1,3 +0,0 @@
rendered blackbox in 1.324044833s
rendered prometheus in 1.336657625s
rendered platform in 1.33672525s

View File

@@ -1,2 +0,0 @@
[main 1200227] render integrated blackbox and prometheus manifests
2 files changed, 7 insertions(+), 7 deletions(-)

View File

@@ -13,23 +13,23 @@ exec git config --global init.defaultBranch main
exec rm -rf holos-helm-values-tutorial
# Create and change to the tutorial directory, and then initialize the Holos platform
exec bash -c 'bash -euo pipefail mkdir.and.init.sh'
exec bash -c 'bash -euo pipefail mkdir-and-init.sh'
cd holos-helm-values-tutorial
# Git init and create the component directories
exec bash -c 'bash -euo pipefail $WORK/git.init.sh'
exec bash -c 'bash -euo pipefail $WORK/mkdir.components.sh'
exec bash -c 'bash -euo pipefail $WORK/git-init.sh'
exec bash -c 'bash -euo pipefail $WORK/mkdir-components.sh'
# Combine and execute the multiline prometheus/blackbox component header/body/trailer files
exec cat $WORK/prometheus.component.header.sh ../prometheus.component.body.cue ../eof.trailer.sh
exec cat $WORK/prometheus-component-header.sh ../prometheus-component-body.cue ../eof-trailer.sh
stdin stdout
exec bash -xeuo pipefail
exec cat $WORK/blackbox.component.header.sh ../blackbox.component.body.cue ../eof.trailer.sh
exec cat $WORK/blackbox-component-header.sh ../blackbox-component-body.cue ../eof-trailer.sh
stdin stdout
exec bash -xeuo pipefail
# Combine and execute the multiline platform registration header/body/trailer files.
exec cat $WORK/register.components.header.sh ../register.components.body.cue ../eof.trailer.sh
exec cat $WORK/register-components-header.sh ../register-components-body.cue ../eof-trailer.sh
stdin stdout
exec bash -xeuo pipefail
@@ -39,34 +39,37 @@ exec bash -xeuo pipefail
# NOTE: The [net] condition will test whether external network access is available
[net] exec bash -c 'bash -euo pipefail $WORK/render.sh 2>&1'
[net] stdin stdout
exec $WORK/update.sh $WORK/register.components.output.txt
exec $WORK/update.sh $WORK/register-components-output.txt
# Commit and conditionally update the output file
exec bash -c 'bash -euo pipefail $WORK/register.components.git.commit.sh'
exec bash -c 'bash -euo pipefail $WORK/register-components-git-commit.sh'
stdin stdout
exec $WORK/update.sh $WORK/register.components.git.commit.output.txt
exec $WORK/update.sh $WORK/register-components-git-commit-output.txt
# Import values
exec bash -c 'bash -euo pipefail $WORK/import.prometheus.values.sh'
exec bash -c 'bash -euo pipefail $WORK/import.blackbox.values.sh'
exec bash -c 'bash -euo pipefail $WORK/import-prometheus-values.sh'
exec bash -c 'bash -euo pipefail $WORK/import-blackbox-values.sh'
# Render, update the output file, commit, and update the commit output file.
[net] exec bash -c 'bash -euo pipefail $WORK/render.sh 2>&1'
[net] stdin stdout
exec $WORK/update.sh $WORK/import.values.render.output.txt
exec bash -c 'bash -euo pipefail $WORK/import.values.git.commit.sh'
exec $WORK/update.sh $WORK/import-values-render-output.txt
exec bash -c 'bash -euo pipefail $WORK/import-values-git-commit.sh'
stdin stdout
exec $WORK/update.sh $WORK/import.values.git.output.txt
exec $WORK/update.sh $WORK/import-values-git-output.txt
# Create the common configuration path
exec bash -c 'bash -euo pipefail $WORK/mkdir-common-config.sh'
# Combine and execute the common configuration header/body/trailer to write the cue file.
exec cat $WORK/blackbox.common.config.header.sh ../blackbox.common.config.body.cue ../eof.trailer.sh
exec cat $WORK/blackbox-common-config-header.sh ../blackbox-common-config-body.cue ../eof-trailer.sh
stdin stdout
exec bash -xeuo pipefail
# Git commit blackbox common config
exec bash -c 'bash -euo pipefail $WORK/blackbox.common.config.git.commit.sh'
exec bash -c 'bash -euo pipefail $WORK/blackbox-common-config-git-commit.sh'
stdin stdout
exec $WORK/update.sh $WORK/blackbox.common.config.git.output.txt
exec $WORK/update.sh $WORK/blackbox-common-config-git-output.txt
# Patch the common config values file and write to output file.
#
@@ -74,30 +77,30 @@ exec $WORK/update.sh $WORK/blackbox.common.config.git.output.txt
# within the same directory, but it actually lives one directory up in the
# testscript $WORK dir.
exec ln -s $WORK/values.patch values.patch
exec bash -c 'bash -euo pipefail $WORK/common.config.patch.sh'
exec bash -c 'bash -euo pipefail $WORK/common-config-patch.sh'
stdin stdout
exec $WORK/update.sh $WORK/common.config.patch.txt
exec $WORK/update.sh $WORK/common-config-patch.txt
# Remove patch and commit changes
exec bash -c 'bash -euo pipefail $WORK/common.config.rm.sh'
exec bash -c 'bash -euo pipefail $WORK/common.config.git.sh'
exec bash -c 'bash -euo pipefail $WORK/common-config-rm.sh'
exec bash -c 'bash -euo pipefail $WORK/common-config-git.sh'
stdin stdout
exec $WORK/update.sh $WORK/common.config.git.output.txt
exec $WORK/update.sh $WORK/common-config-git-output.txt
# Final render and update of output file.
[net] exec bash -c 'bash -euo pipefail $WORK/render.sh 2>&1'
[net] stdin stdout
exec $WORK/update.sh $WORK/reviewing.changes.git.output.txt
exec $WORK/update.sh $WORK/reviewing-changes-git-output.txt
# Git diff and write to output file.
exec bash -c 'bash -euo pipefail $WORK/git.diff.sh'
exec bash -c 'bash -euo pipefail $WORK/git-diff.sh'
stdin stdout
exec $WORK/update.sh $WORK/git.diff
# Final commit and write to output file
exec bash -c 'bash -euo pipefail $WORK/reviewing.changes.git.commit.sh'
exec bash -c 'bash -euo pipefail $WORK/reviewing-changes-git-commit.sh'
stdin stdout
exec $WORK/update.sh $WORK/reviewing.changes.git.output.txt
exec $WORK/update.sh $WORK/reviewing-changes-git-output.txt
# Clean up the tutorial directory and tmp $HOME directory
cd $WORK
@@ -109,17 +112,17 @@ exec rm -rf $HOME
set -euo pipefail
[[ -s "$1" ]] && [[ -z "${HOLOS_UPDATE_SCRIPTS:-}" ]] && exit 0
cat > "$1"
-- mkdir.and.init.sh --
-- mkdir-and-init.sh --
mkdir holos-helm-values-tutorial
cd holos-helm-values-tutorial
holos init platform v1alpha5
-- git.init.sh --
-- git-init.sh --
git init . && git add . && git commit -m "initial commit"
-- mkdir.components.sh --
-- mkdir-components.sh --
mkdir -p components/prometheus components/blackbox
-- prometheus.component.header.sh --
-- prometheus-component-header.sh --
cat <<EOF > components/prometheus/prometheus.cue
-- prometheus.component.body.cue --
-- prometheus-component-body.cue --
package holos
// Produce a helm chart build plan.
@@ -135,11 +138,11 @@ Helm: #Helm & {
}
}
}
-- eof.trailer.sh --
-- eof-trailer.sh --
EOF
-- blackbox.component.header.sh --
-- blackbox-component-header.sh --
cat <<EOF > components/blackbox/blackbox.cue
-- blackbox.component.body.cue --
-- blackbox-component-body.cue --
package holos
// Produce a helm chart build plan.
@@ -155,9 +158,9 @@ Helm: #Helm & {
}
}
}
-- register.components.header.sh --
-- register-components-header.sh --
cat <<EOF > platform/prometheus.cue
-- register.components.body.cue --
-- register-components-body.cue --
package holos
Platform: Components: {
@@ -172,15 +175,15 @@ Platform: Components: {
}
-- render.sh --
holos render platform
-- register.components.output.txt --
-- register-components-output.txt --
cached prometheus-blackbox-exporter 9.0.1
rendered blackbox in 3.825430417s
cached prometheus 25.27.0
rendered prometheus in 4.840089667s
rendered platform in 4.840137792s
-- register.components.git.commit.sh --
-- register-components-git-commit.sh --
git add . && git commit -m 'add blackbox and prometheus'
-- register.components.git.commit.output.txt --
-- register-components-git-commit-output.txt --
[main b5df111] add blackbox and prometheus
5 files changed, 1550 insertions(+)
create mode 100644 components/blackbox/blackbox.cue
@@ -188,33 +191,35 @@ git add . && git commit -m 'add blackbox and prometheus'
create mode 100644 deploy/components/blackbox/blackbox.gen.yaml
create mode 100644 deploy/components/prometheus/prometheus.gen.yaml
create mode 100644 platform/prometheus.cue
-- import.prometheus.values.sh --
-- import-prometheus-values.sh --
holos cue import \
--package holos \
--path 'Helm: Values:' \
--outfile components/prometheus/values.cue \
components/prometheus/vendor/25.27.0/prometheus/values.yaml
-- import.blackbox.values.sh --
-- import-blackbox-values.sh --
holos cue import \
--package holos \
--path 'Helm: Values:' \
--outfile components/blackbox/values.cue \
components/blackbox/vendor/9.0.1/prometheus-blackbox-exporter/values.yaml
-- import.values.render.output.txt --
-- import-values-render-output.txt --
rendered blackbox in 365.936792ms
rendered prometheus in 371.855875ms
rendered platform in 372.109916ms
-- import.values.git.commit.sh --
-- import-values-git-commit.sh --
git add . && git commit -m 'import values'
-- import.values.git.output.txt --
-- import-values-git-output.txt --
[main 52e90ea] import values
2 files changed, 1815 insertions(+)
create mode 100644 components/blackbox/values.cue
create mode 100644 components/prometheus/values.cue
-- blackbox.common.config.header.sh --
cat <<EOF > components/blackbox.cue
-- blackbox.common.config.body.cue --
package holos
-- mkdir-common-config.sh --
mkdir -p config/prometheus
-- blackbox-common-config-header.sh --
cat <<EOF > config/prometheus/blackbox.cue
-- blackbox-common-config-body.cue --
package prometheus
// Schema Definition
#Blackbox: {
@@ -225,65 +230,77 @@ package holos
}
// Concrete values must validate against the schema.
Blackbox: #Blackbox & {
blackbox: #Blackbox & {
host: "blackbox"
port: 9115
}
-- blackbox.common.config.git.commit.sh --
-- blackbox-common-config-git-commit.sh --
git add . && git commit -m 'add blackbox configuration'
-- blackbox.common.config.git.output.txt --
-- blackbox-common-config-git-output.txt --
[main 1adcd08] add blackbox configuration
1 file changed, 15 insertions(+)
create mode 100644 components/blackbox.cue
-- common.config.patch.sh --
-- common-config-patch.sh --
patch -p1 < values.patch
-- values.patch --
--- a/components/blackbox/values.cue
+++ b/components/blackbox/values.cue
@@ -1,6 +1,8 @@
@@ -1,6 +1,11 @@
package holos
+// Import common blackbox configuration
+import "holos.example/config/prometheus"
+
Helm: Values: {
+ fullnameOverride: Blackbox.host
+ fullnameOverride: prometheus.blackbox.host
+
global: {
//# Global image registry to use if it needs to be overriden for some specific use cases (e.g local registries, custom images, ...)
//#
@@ -192,7 +194,7 @@ Helm: Values: {
@@ -192,7 +197,7 @@ Helm: Values: {
annotations: {}
labels: {}
type: "ClusterIP"
- port: 9115
+ port: Blackbox.port
+ port: prometheus.blackbox.port
ipDualStack: {
enabled: false
ipFamilies: ["IPv6", "IPv4"]
--- a/components/prometheus/values.cue
+++ b/components/prometheus/values.cue
@@ -1083,7 +1083,7 @@ Helm: Values: {
@@ -1,5 +1,8 @@
package holos
+// Import common blackbox configuration
+import "holos.example/config/prometheus"
+
Helm: Values: {
// yaml-language-server: $schema=values.schema.json
// Default values for prometheus.
@@ -1083,7 +1086,7 @@ Helm: Values: {
target_label: "__param_target"
}, {
target_label: "__address__"
- replacement: "blackbox"
+ replacement: "\(Blackbox.host):\(Blackbox.port)"
+ replacement: "\(prometheus.blackbox.host):\(prometheus.blackbox.port)"
}, {
source_labels: ["__param_target"]
target_label: "instance"
-- common.config.patch.txt --
-- common-config-patch.txt --
patching file 'components/blackbox/values.cue'
patching file 'components/prometheus/values.cue'
-- common.config.rm.sh --
-- common-config-rm.sh --
rm values.patch
-- common.config.git.sh --
-- common-config-git.sh --
git add . && git commit -m 'integrate blackbox and prometheus together'
-- common.config.git.output.txt --
-- common-config-git-output.txt --
[main 4221803] integrate blackbox and prometheus together
2 files changed, 4 insertions(+), 2 deletions(-)
-- reviewing.changes.render.output.txt --
-- reviewing-changes-render-output.txt --
rendered blackbox in 374.810666ms
rendered prometheus in 382.899334ms
rendered platform in 383.270625ms
-- git.diff.sh --
-- git-diff.sh --
git diff
-- git.diff --
diff --git a/deploy/components/blackbox/blackbox.gen.yaml b/deploy/components/blackbox/blackbox.gen.yaml
@@ -350,8 +367,8 @@ index 9e02bce..ab638f0 100644
target_label: __address__
- source_labels:
- __param_target
-- reviewing.changes.git.commit.sh --
-- reviewing-changes-git-commit.sh --
git add . && git commit -m 'render integrated blackbox and prometheus manifests'
-- reviewing.changes.git.output.txt --
-- reviewing-changes-git-output.txt --
[main 67efe0d] render integrated blackbox and prometheus manifests
2 files changed, 7 insertions(+), 7 deletions(-)

View File

@@ -0,0 +1 @@
0.102.5

View File

@@ -1,4 +1,4 @@
package holos
package prometheus
// Schema Definition
#Blackbox: {
@@ -9,7 +9,7 @@ package holos
}
// Concrete values must validate against the schema.
Blackbox: #Blackbox & {
blackbox: #Blackbox & {
host: "blackbox"
port: 9115
}

View File

@@ -1,3 +1,3 @@
[main ffea4dd] add blackbox configuration
[main 1adcd08] add blackbox configuration
1 file changed, 15 insertions(+)
create mode 100644 components/blackbox.cue

View File

@@ -0,0 +1 @@
cat <<EOF > config/prometheus/blackbox.cue

View File

@@ -0,0 +1,2 @@
[main 4221803] integrate blackbox and prometheus together
2 files changed, 4 insertions(+), 2 deletions(-)

View File

@@ -1,4 +1,4 @@
[main d8046af] import values
[main 52e90ea] import values
2 files changed, 1815 insertions(+)
create mode 100644 components/blackbox/values.cue
create mode 100644 components/prometheus/values.cue

View File

@@ -0,0 +1,3 @@
rendered blackbox in 365.936792ms
rendered prometheus in 371.855875ms
rendered platform in 372.109916ms

View File

@@ -0,0 +1 @@
mkdir -p config/prometheus

View File

@@ -1,4 +1,4 @@
[main 8971a74] add blackbox and prometheus
[main b5df111] add blackbox and prometheus
5 files changed, 1550 insertions(+)
create mode 100644 components/blackbox/blackbox.cue
create mode 100644 components/prometheus/prometheus.cue

View File

@@ -0,0 +1,5 @@
cached prometheus-blackbox-exporter 9.0.1
rendered blackbox in 3.825430417s
cached prometheus 25.27.0
rendered prometheus in 4.840089667s
rendered platform in 4.840137792s

View File

@@ -0,0 +1,2 @@
[main 67efe0d] render integrated blackbox and prometheus manifests
2 files changed, 7 insertions(+), 7 deletions(-)

View File

@@ -1,31 +1,43 @@
--- a/components/blackbox/values.cue
+++ b/components/blackbox/values.cue
@@ -1,6 +1,8 @@
@@ -1,6 +1,11 @@
package holos
+// Import common blackbox configuration
+import "holos.example/config/prometheus"
+
Helm: Values: {
+ fullnameOverride: Blackbox.host
+ fullnameOverride: prometheus.blackbox.host
+
global: {
//# Global image registry to use if it needs to be overriden for some specific use cases (e.g local registries, custom images, ...)
//#
@@ -192,7 +194,7 @@ Helm: Values: {
@@ -192,7 +197,7 @@ Helm: Values: {
annotations: {}
labels: {}
type: "ClusterIP"
- port: 9115
+ port: Blackbox.port
+ port: prometheus.blackbox.port
ipDualStack: {
enabled: false
ipFamilies: ["IPv6", "IPv4"]
--- a/components/prometheus/values.cue
+++ b/components/prometheus/values.cue
@@ -1083,7 +1083,7 @@ Helm: Values: {
@@ -1,5 +1,8 @@
package holos
+// Import common blackbox configuration
+import "holos.example/config/prometheus"
+
Helm: Values: {
// yaml-language-server: $schema=values.schema.json
// Default values for prometheus.
@@ -1083,7 +1086,7 @@ Helm: Values: {
target_label: "__param_target"
}, {
target_label: "__address__"
- replacement: "blackbox"
+ replacement: "\(Blackbox.host):\(Blackbox.port)"
+ replacement: "\(prometheus.blackbox.host):\(prometheus.blackbox.port)"
}, {
source_labels: ["__param_target"]
target_label: "instance"

View File

@@ -47,8 +47,8 @@ resource.
Ensure you have a current version of `holos` installed. This document was
tested with the following version.
import HolosVersionCommand from '!!raw-loader!../_markdown-tests/script-01-holos-version/command.sh';
import HolosVersionOutput from '!!raw-loader!../_markdown-tests/script-01-holos-version/output.txt';
import HolosVersionCommand from '!!raw-loader!./_helm-values/script-01-holos-version/command.sh';
import HolosVersionOutput from '!!raw-loader!./_helm-values/script-01-holos-version/output.txt';
<CodeBlock language="bash">{HolosVersionCommand}</CodeBlock>
<CodeBlock language="txt">{HolosVersionOutput}</CodeBlock>
@@ -58,13 +58,13 @@ import HolosVersionOutput from '!!raw-loader!../_markdown-tests/script-01-holos-
Use `holos` to generate a minimal platform directory structure. First, create
and navigate into a blank directory, then use the `holos init platform` command:
import MkdirAndInit from '!!raw-loader!../_markdown-tests/script-02-helm-values/mkdir.and.init.sh';
import MkdirAndInit from '!!raw-loader!./_helm-values/script-02-helm-values/mkdir-and-init.sh';
<CodeBlock language="bash">{MkdirAndInit}</CodeBlock>
Make an initial commit to track changes:
import GitInit from '!!raw-loader!../_markdown-tests/script-02-helm-values/git.init.sh';
import GitInit from '!!raw-loader!./_helm-values/script-02-helm-values/git-init.sh';
<CodeBlock language="bash">{GitInit}</CodeBlock>
@@ -73,12 +73,12 @@ import GitInit from '!!raw-loader!../_markdown-tests/script-02-helm-values/git.i
Create the `prometheus` and `blackbox` component directories, then add each of
the following file contents.
import MkdirComponents from '!!raw-loader!../_markdown-tests/script-02-helm-values/mkdir.components.sh';
import PrometheusComponentHeader from '!!raw-loader!../_markdown-tests/script-02-helm-values/prometheus.component.header.sh';
import PrometheusComponentBody from '!!raw-loader!../_markdown-tests/script-02-helm-values/prometheus.component.body.cue';
import BlackboxComponentHeader from '!!raw-loader!../_markdown-tests/script-02-helm-values/blackbox.component.header.sh';
import BlackboxComponentBody from '!!raw-loader!../_markdown-tests/script-02-helm-values/blackbox.component.body.cue';
import EofTrailer from '!!raw-loader!../_markdown-tests/script-02-helm-values/eof.trailer.sh';
import MkdirComponents from '!!raw-loader!./_helm-values/script-02-helm-values/mkdir-components.sh';
import PrometheusComponentHeader from '!!raw-loader!./_helm-values/script-02-helm-values/prometheus-component-header.sh';
import PrometheusComponentBody from '!!raw-loader!./_helm-values/script-02-helm-values/prometheus-component-body.cue';
import BlackboxComponentHeader from '!!raw-loader!./_helm-values/script-02-helm-values/blackbox-component-header.sh';
import BlackboxComponentBody from '!!raw-loader!./_helm-values/script-02-helm-values/blackbox-component-body.cue';
import EofTrailer from '!!raw-loader!./_helm-values/script-02-helm-values/eof-trailer.sh';
<CodeBlock language="bash">{MkdirComponents}</CodeBlock>
@@ -100,8 +100,8 @@ import EofTrailer from '!!raw-loader!../_markdown-tests/script-02-helm-values/eo
Register the components with the platform by adding the following file to the platform directory.
import RegisterComponentsHeader from '!!raw-loader!../_markdown-tests/script-02-helm-values/register.components.header.sh';
import RegisterComponentsBody from '!!raw-loader!../_markdown-tests/script-02-helm-values/register.components.body.cue';
import RegisterComponentsHeader from '!!raw-loader!./_helm-values/script-02-helm-values/register-components-header.sh';
import RegisterComponentsBody from '!!raw-loader!./_helm-values/script-02-helm-values/register-components-body.cue';
<CodeBlock language="bash">{RegisterComponentsHeader}</CodeBlock>
<CodeBlock language="cue" showLineNumbers>{RegisterComponentsBody}</CodeBlock>
@@ -109,8 +109,8 @@ import RegisterComponentsBody from '!!raw-loader!../_markdown-tests/script-02-he
Render the platform.
import RenderCommand from '!!raw-loader!../_markdown-tests/script-02-helm-values/render.sh';
import RegisterComponentsRenderOutput from '!!raw-loader!../_markdown-tests/script-02-helm-values/register.components.output.txt';
import RenderCommand from '!!raw-loader!./_helm-values/script-02-helm-values/render.sh';
import RegisterComponentsRenderOutput from '!!raw-loader!./_helm-values/script-02-helm-values/register-components-output.txt';
<Tabs groupId="33D6BFED-62D8-4A42-A26A-F3121D57C4E5">
<TabItem value="command" label="Command">
@@ -123,8 +123,8 @@ import RegisterComponentsRenderOutput from '!!raw-loader!../_markdown-tests/scri
Commit the results.
import GitCommitRegisterComponents from '!!raw-loader!../_markdown-tests/script-02-helm-values/register.components.git.commit.sh';
import RegisterComponentsGitOutput from '!!raw-loader!../_markdown-tests/script-02-helm-values/register.components.git.commit.output.txt';
import GitCommitRegisterComponents from '!!raw-loader!./_helm-values/script-02-helm-values/register-components-git-commit.sh';
import RegisterComponentsGitOutput from '!!raw-loader!./_helm-values/script-02-helm-values/register-components-git-commit-output.txt';
<Tabs groupId="446CC550-A634-45C0-BEC7-992E5C56D4FA">
<TabItem value="command" label="Command">
@@ -140,8 +140,8 @@ import RegisterComponentsGitOutput from '!!raw-loader!../_markdown-tests/script-
Holos renders Helm charts with their default values. We can import these default
values into CUE to work with them as structured data instead of text markup.
import ImportPrometheusValues from '!!raw-loader!../_markdown-tests/script-02-helm-values/import.prometheus.values.sh';
import ImportBlackboxValues from '!!raw-loader!../_markdown-tests/script-02-helm-values/import.blackbox.values.sh';
import ImportPrometheusValues from '!!raw-loader!./_helm-values/script-02-helm-values/import-prometheus-values.sh';
import ImportBlackboxValues from '!!raw-loader!./_helm-values/script-02-helm-values/import-blackbox-values.sh';
<CodeBlock language="bash">{ImportPrometheusValues}</CodeBlock>
<CodeBlock language="bash">{ImportBlackboxValues}</CodeBlock>
@@ -155,9 +155,9 @@ CUE unifies `values.cue` with the other `\*.cue` files in the same directory.
Render the platform using `holos render platform` and commit the results.
import ImportValuesRenderOutput from '!!raw-loader!../_markdown-tests/script-02-helm-values/import.values.render.output.txt';
import ImportValuesGitCommit from '!!raw-loader!../_markdown-tests/script-02-helm-values/import.values.git.commit.sh';
import ImportValuesGitOutput from '!!raw-loader!../_markdown-tests/script-02-helm-values/import.values.git.output.txt';
import ImportValuesRenderOutput from '!!raw-loader!./_helm-values/script-02-helm-values/import-values-render-output.txt';
import ImportValuesGitCommit from '!!raw-loader!./_helm-values/script-02-helm-values/import-values-git-commit.sh';
import ImportValuesGitOutput from '!!raw-loader!./_helm-values/script-02-helm-values/import-values-git-output.txt';
<Tabs groupId="BDDCD65A-2E9D-4BA6-AAE2-8099494D5E4B">
<TabItem value="command" label="Command">
@@ -180,12 +180,15 @@ import ImportValuesGitOutput from '!!raw-loader!../_markdown-tests/script-02-hel
### Managing Common Configuration
To manage shared configuration for both Helm charts, define a structure that
holds the common configuration values. Place this configuration in the
`components` directory to ensure it is accessible to all components.
holds the common configuration values. Create a `config` directory at the root
of the repository, and place the configuration file there to ensure it is
accessible to all components.
import BlackboxCommonConfigHeader from '!!raw-loader!../_markdown-tests/script-02-helm-values/blackbox.common.config.header.sh';
import BlackboxCommonConfigBody from '!!raw-loader!../_markdown-tests/script-02-helm-values/blackbox.common.config.body.cue';
import BlackboxCommonConfigMkdir from '!!raw-loader!./_helm-values/script-02-helm-values/mkdir-common-config.sh';
import BlackboxCommonConfigHeader from '!!raw-loader!./_helm-values/script-02-helm-values/blackbox-common-config-header.sh';
import BlackboxCommonConfigBody from '!!raw-loader!./_helm-values/script-02-helm-values/blackbox-common-config-body.cue';
<CodeBlock language="bash">{BlackboxCommonConfigMkdir}</CodeBlock>
<CodeBlock language="bash">{BlackboxCommonConfigHeader}</CodeBlock>
<CodeBlock language="cue" showLineNumbers>{BlackboxCommonConfigBody}</CodeBlock>
<CodeBlock language="bash" showLineNumbers>{EofTrailer}</CodeBlock>
@@ -199,8 +202,8 @@ languages with only type checking.
Add and commit the configuration.
import BlackboxCommonConfigGit from '!!raw-loader!../_markdown-tests/script-02-helm-values/blackbox.common.config.git.commit.sh';
import BlackboxCommonConfigGitOutput from '!!raw-loader!../_markdown-tests/script-02-helm-values/blackbox.common.config.git.output.txt';
import BlackboxCommonConfigGit from '!!raw-loader!./_helm-values/script-02-helm-values/blackbox-common-config-git-commit.sh';
import BlackboxCommonConfigGitOutput from '!!raw-loader!./_helm-values/script-02-helm-values/blackbox-common-config-git-output.txt';
<Tabs groupId="A738CCE4-F0C6-4CC7-BE1F-2B92F0E86FDC">
<TabItem value="command" label="Command">
@@ -214,14 +217,16 @@ import BlackboxCommonConfigGitOutput from '!!raw-loader!../_markdown-tests/scrip
### Using Common Configuration Across Components
Referencing common configuration across multiple components is straightforward
and reliable using Holos and CUE.
and reliable using Holos and CUE. Configuration can be imported where necessary
following [CUE module standards], which are similar to Golang.
To apply the common configuration, patch the two `values.cue` files, or manually
edit them to reference `Blackbox.host` and `Blackbox.port`.
edit them to import the configuration and reference `prometheus.blackbox.host`
and `prometheus.blackbox.port`.
import CommonConfigPatchCommand from '!!raw-loader!../_markdown-tests/script-02-helm-values/common.config.patch.sh';
import CommonConfigPatchDiff from '!!raw-loader!../_markdown-tests/script-02-helm-values/values.patch';
import CommonConfigPatchOutput from '!!raw-loader!../_markdown-tests/script-02-helm-values/common.config.patch.txt';
import CommonConfigPatchCommand from '!!raw-loader!./_helm-values/script-02-helm-values/common-config-patch.sh';
import CommonConfigPatchDiff from '!!raw-loader!./_helm-values/script-02-helm-values/values.patch';
import CommonConfigPatchOutput from '!!raw-loader!./_helm-values/script-02-helm-values/common-config-patch.txt';
<Tabs groupId="5FFCE892-B8D4-4F5B-B2E2-39EC9E9F87A4">
<TabItem value="command" label="Command">
@@ -242,9 +247,9 @@ safely and easily.
Remove the patch file, then commit the changes.
import CommonConfigPatchRm from '!!raw-loader!../_markdown-tests/script-02-helm-values/common.config.rm.sh';
import CommonConfigPatchGitCommit from '!!raw-loader!../_markdown-tests/script-02-helm-values/common.config.git.sh';
import CommonConfigPatchGitCommitOutput from '!!raw-loader!../_markdown-tests/script-02-helm-values/common.config.git.output.txt';
import CommonConfigPatchRm from '!!raw-loader!./_helm-values/script-02-helm-values/common-config-rm.sh';
import CommonConfigPatchGitCommit from '!!raw-loader!./_helm-values/script-02-helm-values/common-config-git.sh';
import CommonConfigPatchGitCommitOutput from '!!raw-loader!./_helm-values/script-02-helm-values/common-config-git-output.txt';
<Tabs groupId="6498B00E-FADA-4EB2-885C-808F1D22E04D">
<TabItem value="command" label="Command">
@@ -261,7 +266,7 @@ import CommonConfigPatchGitCommitOutput from '!!raw-loader!../_markdown-tests/sc
Holos makes it easy to view and review platform-wide changes. Render the
platform to observe how both Prometheus and Blackbox update in sync.
import ReviewingChangesRenderOutput from '!!raw-loader!../_markdown-tests/script-02-helm-values/reviewing.changes.render.output.txt';
import ReviewingChangesRenderOutput from '!!raw-loader!./_helm-values/script-02-helm-values/reviewing-changes-render-output.txt';
<Tabs groupId="E7F6D8B1-22FA-4075-9B44-D9F2815FE0D3">
<TabItem value="command" label="Command">
@@ -274,8 +279,8 @@ import ReviewingChangesRenderOutput from '!!raw-loader!../_markdown-tests/script
Changes are easily visible in version control.
import GitDiffCommand from '!!raw-loader!../_markdown-tests/script-02-helm-values/git.diff.sh';
import GitDiff from '!!raw-loader!../_markdown-tests/script-02-helm-values/git.diff';
import GitDiffCommand from '!!raw-loader!./_helm-values/script-02-helm-values/git-diff.sh';
import GitDiff from '!!raw-loader!./_helm-values/script-02-helm-values/git.diff';
<Tabs groupId="9789A0EF-24D4-4FB9-978A-3895C2778789">
<TabItem value="command" label="Command">
@@ -299,8 +304,8 @@ Blackbox host or port will reconfigure both charts correctly.
Commit the changes and proceed to deploy them.
import ReviewingChangesGitCommit from '!!raw-loader!../_markdown-tests/script-02-helm-values/reviewing.changes.git.commit.sh';
import ReviewingChangesGitOutput from '!!raw-loader!../_markdown-tests/script-02-helm-values/reviewing.changes.git.output.txt';
import ReviewingChangesGitCommit from '!!raw-loader!./_helm-values/script-02-helm-values/reviewing-changes-git-commit.sh';
import ReviewingChangesGitOutput from '!!raw-loader!./_helm-values/script-02-helm-values/reviewing-changes-git-output.txt';
<Tabs groupId="F8C9A98D-DE1E-4EF6-92C1-017A9166F6C7">
<TabItem value="command" label="Command">
@@ -327,7 +332,7 @@ service endpoint.
[prometheus]: https://github.com/prometheus-community/helm-charts/tree/prometheus-25.27.0/charts/prometheus
[blackbox]: https://github.com/prometheus-community/helm-charts/tree/prometheus-blackbox-exporter-9.0.1/charts/prometheus-blackbox-exporter
[httpbin]: https://github.com/mccutchen/go-httpbin/tree/v2.15.0
[CUE module standards]: https://cuelang.org/docs/concept/modules-packages-instances/
[Config Schema]: #config-schema
[Technical Overview]: ./overview.mdx

View File

@@ -22,10 +22,10 @@ func TestMain(m *testing.M) {
}
// Run these with go test -v to see the verbose names
func TestMarkdown(t *testing.T) {
t.Run("AddOnPromoter", func(t *testing.T) {
func TestHelmValues(t *testing.T) {
t.Run("TestHelmValues", func(t *testing.T) {
// Get an ordered list of test script files.
dir := "_markdown-tests"
dir := "_helm-values"
for _, file := range sortedTestScripts(t, filepath.Join(dir, "examples")) {
t.Run("examples", func(t *testing.T) {
runOneScript(t, dir, file)