From 3814d6c395cd37cd7a7fa10a0fe3f13dee195f9f Mon Sep 17 00:00:00 2001
From: Sheogorath <sheogorath@shivering-isles.com>
Date: Sun, 13 Feb 2022 03:13:53 +0100
Subject: [PATCH] feat(cli): Add additional tools to koolbox

This patch adds yq, kubeval and kustomize to the CLI, which helps to
evaluate and validate the current repository structure.
---
 cli/Dockerfile | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/cli/Dockerfile b/cli/Dockerfile
index e7c1f1b8b..b12164132 100644
--- a/cli/Dockerfile
+++ b/cli/Dockerfile
@@ -31,6 +31,24 @@ ENV FLUX_RELEASE=${FLUX_RELEASE}
 RUN curl -L https://github.com/fluxcd/flux2/releases/download/v${FLUX_RELEASE}/flux_${FLUX_RELEASE}_linux_amd64.tar.gz | tar xvzf - flux \
     && install -o root -g root -m 0755 flux /usr/local/bin/flux
 
+# kustomize CLI cache
+FROM docker.io/library/fedora:35 as kustomize
+
+ARG KUSTOMIZE_RELEASE=4.1.3
+ENV KUSTOMIZE_RELEASE=${KUSTOMIZE_RELEASE}
+
+RUN curl -L https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${KUSTOMIZE_RELEASE}/kustomize_v${KUSTOMIZE_RELEASE}_linux_amd64.tar.gz | tar xvzf - kustomize \
+    && install -o root -g root -m 0755 kustomize /usr/local/bin/kustomize
+
+# kubeval CLI cache
+FROM docker.io/library/fedora:35 as kubeval
+
+ARG KUBEVAL_RELEASE=v0.16.1
+ENV KUBEVAL_RELEASE=${KUBEVAL_RELEASE}
+
+RUN curl -L https://github.com/instrumenta/kubeval/releases/download/${KUBEVAL_RELEASE}/kubeval-linux-amd64.tar.gz | tar xvzf - kubeval \
+    && install -o root -g root -m 0755 kubeval /usr/local/bin/kubeval
+
 # SOPS CLI cache
 FROM docker.io/library/fedora:35 as sops
 
@@ -40,6 +58,16 @@ ENV SOPS_RELEASE=${SOPS_RELEASE}
 RUN curl -L https://github.com/mozilla/sops/releases/download/${SOPS_RELEASE}/sops-${SOPS_RELEASE}.linux > ./sops \
     && install -o root -g root -m 0755 sops /usr/local/bin/sops
 
+# yq CLI cache
+FROM docker.io/library/fedora:35 as yq
+
+ARG YQ_RELEASE=v4.6.1
+ENV YQ_RELEASE=${YQ_RELEASE}
+
+RUN curl -L https://github.com/mikefarah/yq/releases/download/${YQ_RELEASE}/yq_linux_amd64 > ./yq \
+    && install -o root -g root -m 0755 yq /usr/local/bin/yq
+
+
 # Actual start of container build
 FROM docker.io/library/fedora:35
 
@@ -79,7 +107,10 @@ COPY --from=kubectl /usr/local/bin/kubectl /usr/local/bin/kubectl
 COPY --from=kubectl /usr/local/bin/kubectl-convert /usr/local/bin/kubectl-convert
 COPY --from=helm /usr/local/bin/helm /usr/local/bin/helm
 COPY --from=flux /usr/local/bin/flux /usr/local/bin/flux
+COPY --from=kustomize /usr/local/bin/kustomize /usr/local/bin/kustomize
+COPY --from=kubeval /usr/local/bin/kubeval /usr/local/bin/kubeval
 COPY --from=sops /usr/local/bin/sops /usr/local/bin/sops
+COPY --from=yq /usr/local/bin/yq /usr/local/bin/yq
 
 RUN true \
     && echo "command -v flux >/dev/null && . <(flux completion bash)" >> /root/.bashrc \
-- 
GitLab