From: garciadeblas Date: Sun, 30 Nov 2025 18:54:43 +0000 (+0100) Subject: Install client tools (flux,kubectl,etc.) in osmclient docker image X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F61%2F15561%2F3;p=osm%2Fdevops.git Install client tools (flux,kubectl,etc.) in osmclient docker image Change-Id: Ibc65e63ce8dcce3af5eaa08e8eb632b460b59112 Signed-off-by: garciadeblas --- diff --git a/docker/osmclient/Dockerfile b/docker/osmclient/Dockerfile index 643ff3e7..b412a950 100644 --- a/docker/osmclient/Dockerfile +++ b/docker/osmclient/Dockerfile @@ -76,7 +76,11 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \ RUN rm -f /etc/apt/apt.conf.d/proxy.conf COPY --from=INSTALL /usr/bin/osm /usr/bin/osm -COPY charm.sh /usr/sbin/charm +COPY scripts/charm.sh /usr/sbin/charm + +# Add additional client tools +COPY scripts/install-client-tools.sh /tmp/install-client-tools.sh +RUN bash /tmp/install-client-tools.sh && rm /tmp/install-client-tools.sh # Creating the user for the app RUN groupadd -g 1000 appuser && \ diff --git a/docker/osmclient/charm.sh b/docker/osmclient/charm.sh deleted file mode 100755 index 75e7a47e..00000000 --- a/docker/osmclient/charm.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -####################################################################################### -# Copyright ETSI Contributors and Others. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. -# See the License for the specific language governing permissions and -# limitations under the License. -####################################################################################### - -# Workaround for charm build - -function build() { - echo "$@" - charm-build "$@" -} - -params="$@" -delete=build - -params=("${params[@]/$delete}") - -build $params diff --git a/docker/osmclient/scripts/charm.sh b/docker/osmclient/scripts/charm.sh new file mode 100755 index 00000000..75e7a47e --- /dev/null +++ b/docker/osmclient/scripts/charm.sh @@ -0,0 +1,31 @@ +#!/bin/bash +####################################################################################### +# Copyright ETSI Contributors and Others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +####################################################################################### + +# Workaround for charm build + +function build() { + echo "$@" + charm-build "$@" +} + +params="$@" +delete=build + +params=("${params[@]/$delete}") + +build $params diff --git a/docker/osmclient/scripts/install-client-tools.sh b/docker/osmclient/scripts/install-client-tools.sh new file mode 100755 index 00000000..774205d8 --- /dev/null +++ b/docker/osmclient/scripts/install-client-tools.sh @@ -0,0 +1,117 @@ +#!/bin/bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e -o pipefail + +export DEBIAN_FRONTEND=noninteractive +apt-get update + +# Install git, curl, tar +DEBIAN_FRONTEND=noninteractive apt-get install -y git curl tar + +# Helm +HELM_VERSION="v3.15.1" +# Helm releases can be found here: https://github.com/helm/helm/releases +if ! [[ "$(helm version --short 2>/dev/null)" =~ ^v3.* ]]; then + # Helm is not installed. Install helm + echo "Helm3 is not installed, installing ..." + curl https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz -o helm-${HELM_VERSION}.tar.gz + tar -zxvf helm-${HELM_VERSION}.tar.gz + mv linux-amd64/helm /usr/local/bin/helm + rm -r linux-amd64 + rm helm-${HELM_VERSION}.tar.gz +else + echo "Helm3 is already installed. Skipping installation..." +fi +helm version || FATAL_TRACK k8scluster "Could not obtain helm version. Maybe helm client was not installed" +helm repo add stable https://charts.helm.sh/stable || FATAL_TRACK k8scluster "Helm repo stable could not be added" +helm repo update || FATAL_TRACK k8scluster "Helm repo stable could not be updated" +echo "helm installed" + +# Install kubectl client +K8S_CLIENT_VERSION="v1.29.3" +curl -LO "https://dl.k8s.io/release/${K8S_CLIENT_VERSION}/bin/linux/amd64/kubectl" +install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl +rm kubectl +echo "kubectl installed" + +# Install `gnupg` and `gpg` - Typically pre-installed in Ubuntu +DEBIAN_FRONTEND=noninteractive apt-get install gnupg gpg -y +echo "gnupg and gpg installed" + +# Install `sops` +curl -LO https://github.com/getsops/sops/releases/download/v3.8.1/sops-v3.8.1.linux.amd64 +mv sops-v3.8.1.linux.amd64 /usr/local/bin/sops +chmod +x /usr/local/bin/sops +echo "sops client installed" + +# Install `envsubst` +DEBIAN_FRONTEND=noninteractive apt-get install gettext-base -y +echo "envsubst installed" + +# Install `age` +AGE_VERSION="v1.1.0" +curl -LO https://github.com/FiloSottile/age/releases/download/${AGE_VERSION}/age-${AGE_VERSION}-linux-amd64.tar.gz +tar xvfz age-${AGE_VERSION}-linux-amd64.tar.gz +mv age/age age/age-keygen /usr/local/bin/ +chmod +x /usr/local/bin/age* +rm -rf age age-${AGE_VERSION}-linux-amd64.tar.gz +echo "age installed" + +# (Only for Gitea) Install `apg` +DEBIAN_FRONTEND=noninteractive apt-get install apg -y +echo "apg installed" + +# # (Only for Minio) `kubectl minio` plugin and Minio Client +MINIO_CLIENT_VERSION="5.0.12" +if [ -n "${INSTALL_MINIO}" ]; then + curl https://github.com/minio/operator/releases/download/v${MINIO_CLIENT_VERSION}/kubectl-minio_${MINIO_CLIENT_VERSION}_linux_amd64 -Lo kubectl-minio + curl https://dl.min.io/client/mc/release/linux-amd64/mc -o minioc + chmod +x kubectl-minio minioc + mv kubectl-minio minioc /usr/local/bin/ + # (Only for HTTPS Ingress for Minio tenant) Install `openssl` + DEBIAN_FRONTEND=noninteractive apt-get install openssl -y +fi +echo "minio client installed" + +# Flux client +FLUX_CLI_VERSION="2.4.0" +curl -s https://fluxcd.io/install.sh | FLUX_VERSION=${FLUX_CLI_VERSION} bash +# Autocompletion +. <(flux completion bash) +echo "flux client installed" + +# Argo client +ARGO_VERSION="v3.5.7" +curl -sLO https://github.com/argoproj/argo-workflows/releases/download/${ARGO_VERSION}/argo-linux-amd64.gz +gunzip argo-linux-amd64.gz +chmod +x argo-linux-amd64 +mv ./argo-linux-amd64 /usr/local/bin/argo +echo "argo client installed" + +# Kustomize +KUSTOMIZE_VERSION="5.4.3" +curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s -- ${KUSTOMIZE_VERSION} +install -o root -g root -m 0755 kustomize /usr/local/bin/kustomize +rm kustomize +echo "kustomized installed" + +# yq +VERSION=v4.33.3 +BINARY=yq_linux_amd64 +curl -L https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY} -o yq +mv yq /usr/local/bin/yq +chmod +x /usr/local/bin/yq +echo "yq installed"