From e54e647382eb2b7dbdfca6dd8c1075b65b9a12d7 Mon Sep 17 00:00:00 2001 From: Dominik Rosiek Date: Wed, 12 Aug 2020 13:32:04 +0200 Subject: [PATCH 1/3] Add get-override command to obtain part of the values.yaml --- deploy/docker/Dockerfile | 6 ++++-- src/commands/get-override | 11 +++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100755 src/commands/get-override diff --git a/deploy/docker/Dockerfile b/deploy/docker/Dockerfile index c883c78f..bec9485d 100644 --- a/deploy/docker/Dockerfile +++ b/deploy/docker/Dockerfile @@ -14,8 +14,6 @@ RUN find / -name libgcc_s.so.1 FROM alpine:3.9 RUN set -ex \ - && echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories \ - && echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ && apk update \ && apk upgrade \ && apk add --no-cache \ @@ -39,6 +37,10 @@ ADD ./src/commands/check /usr/bin/check ADD ./src/commands/fix-log-symlinks /usr/bin/fix-log-symlinks ADD ./src/commands/tools-usage /usr/bin/tools-usage ADD ./src/commands/template /usr/bin/template +ADD ./src/commands/get-override /usr/bin/get-override + +RUN curl -LJ https://github.com/mikefarah/yq/releases/download/3.2.1/yq_linux_amd64 -o /usr/bin/yq +RUN chmod +x /usr/bin/yq COPY --from=builder /build/k8s-api-test /usr/bin/ COPY --from=builder /build/stress-tester /usr/bin/ diff --git a/src/commands/get-override b/src/commands/get-override new file mode 100755 index 00000000..2a36123c --- /dev/null +++ b/src/commands/get-override @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +key="${1}" +shift + +echo '# Add sumologic repository' +helm repo add sumologic https://sumologic.github.io/sumologic-kubernetes-collection 1>/dev/null 2>&1 +echo '# Update repository' +helm repo update 1>/dev/null 2>&1 +echo "# Generating override for ${key}" +helm show values $@ sumologic/sumologic | yq r - "${key}" From 134ad16b50c1776fe9a3533afaa5530df963b963 Mon Sep 17 00:00:00 2001 From: Dominik Rosiek Date: Thu, 13 Aug 2020 10:39:38 +0200 Subject: [PATCH 2/3] Update README --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index d4192cf1..53d2dfe8 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,25 @@ Apply the generated template: kubectl apply -f sumologic.yaml ``` +## Get override configuration + +There could be scenarios when you want to get the configuration of the subcharts (prometheus-operator, fluent-bit, etc.). + +Command `get-override` takes part of the upstream `values.yaml` file basing on the given key: + +``` + kubectl run get-override \ + -it --rm \ + --restart=Never -n sumologic \ + --image sumologic/kubernetes-tools \ + -- get-override prometheus-operator +``` + +This command will return our configuration of `prometheus-operator` ready to apply for the `prometheus-operator` helm chart. + +You can add additional parameters (like `--version=1.0.0`) at the end of the command. +List of supported arguments is compatible with `helm show values`. + ## Interactive mode The pod can be also run in interactive mode: From 93e3364f5b0fc0726ebceb7bdc901ef646e45961 Mon Sep 17 00:00:00 2001 From: Dominik Rosiek Date: Thu, 3 Sep 2020 09:25:46 +0200 Subject: [PATCH 3/3] Rename get-override to template-dependency --- README.md | 8 ++++---- deploy/docker/Dockerfile | 2 +- src/commands/{get-override => template-dependency} | 0 3 files changed, 5 insertions(+), 5 deletions(-) rename src/commands/{get-override => template-dependency} (100%) diff --git a/README.md b/README.md index 53d2dfe8..374d6ae6 100644 --- a/README.md +++ b/README.md @@ -138,18 +138,18 @@ Apply the generated template: kubectl apply -f sumologic.yaml ``` -## Get override configuration +## Template dependency configuration There could be scenarios when you want to get the configuration of the subcharts (prometheus-operator, fluent-bit, etc.). -Command `get-override` takes part of the upstream `values.yaml` file basing on the given key: +Command `template-dependency` takes part of the upstream `values.yaml` file basing on the given key: ``` - kubectl run get-override \ + kubectl run template-dependency \ -it --rm \ --restart=Never -n sumologic \ --image sumologic/kubernetes-tools \ - -- get-override prometheus-operator + -- template-dependency prometheus-operator ``` This command will return our configuration of `prometheus-operator` ready to apply for the `prometheus-operator` helm chart. diff --git a/deploy/docker/Dockerfile b/deploy/docker/Dockerfile index bec9485d..0b23e722 100644 --- a/deploy/docker/Dockerfile +++ b/deploy/docker/Dockerfile @@ -37,7 +37,7 @@ ADD ./src/commands/check /usr/bin/check ADD ./src/commands/fix-log-symlinks /usr/bin/fix-log-symlinks ADD ./src/commands/tools-usage /usr/bin/tools-usage ADD ./src/commands/template /usr/bin/template -ADD ./src/commands/get-override /usr/bin/get-override +ADD ./src/commands/template-dependency /usr/bin/template-dependency RUN curl -LJ https://github.com/mikefarah/yq/releases/download/3.2.1/yq_linux_amd64 -o /usr/bin/yq RUN chmod +x /usr/bin/yq diff --git a/src/commands/get-override b/src/commands/template-dependency similarity index 100% rename from src/commands/get-override rename to src/commands/template-dependency