Skip to content
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 template-dependency command #36

Merged
merged 3 commits into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,25 @@ Apply the generated template:
kubectl apply -f sumologic.yaml
```

## Template dependency configuration

There could be scenarios when you want to get the configuration of the subcharts (prometheus-operator, fluent-bit, etc.).

Command `template-dependency` takes part of the upstream `values.yaml` file basing on the given key:

```
kubectl run template-dependency \
-it --rm \
--restart=Never -n sumologic \
--image sumologic/kubernetes-tools \
-- template-dependency 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:
Expand Down
6 changes: 4 additions & 2 deletions deploy/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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/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

COPY --from=builder /build/k8s-api-test /usr/bin/
COPY --from=builder /build/stress-tester /usr/bin/
Expand Down
11 changes: 11 additions & 0 deletions src/commands/template-dependency
Original file line number Diff line number Diff line change
@@ -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}"