Skip to content

Commit 4ee3b82

Browse files
authored
admin-toolbox: add initial container version of admin-toolbox (#858)
* this new container aims to provide a simple environment with all the tools needed to administrate cloud environments with openstack, kubernetes and gardener * add initial Dockerfile, including inline documentation * add GitHub workflow to automatically build and push container Signed-off-by: Jan Klare <[email protected]>
1 parent db76ac6 commit 4ee3b82

File tree

3 files changed

+191
-0
lines changed

3 files changed

+191
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
name: Build admin-toolbox container image
3+
4+
"on":
5+
workflow_dispatch:
6+
push:
7+
paths:
8+
- .github/workflows/build-admin-toolbox-container-image.yml
9+
- admin-toolbox/**
10+
branches:
11+
- main
12+
pull_request:
13+
paths:
14+
- .github/workflows/build-admin-toolbox-container-image.yml
15+
- admin-toolbox/**
16+
17+
jobs:
18+
19+
build-admin-toolbox-container-image:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v5
24+
25+
- name: Install cosign
26+
uses: sigstore/[email protected]
27+
28+
- name: Setup docker
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Login to container registry
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ${{ secrets.DOCKER_REGISTRY }}
35+
username: ${{ secrets.DOCKER_USERNAME }}
36+
password: ${{ secrets.DOCKER_PASSWORD }}
37+
if: github.ref == 'refs/heads/main'
38+
39+
- name: Build container image
40+
run: scripts/build.sh
41+
env:
42+
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
43+
IMAGE: admin-toolbox
44+
REPOSITORY: osism/admin-toolbox
45+
46+
- name: Push container image
47+
run: |
48+
scripts/push.sh
49+
env:
50+
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
51+
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
52+
DTRACK_API_KEY: ${{ secrets.DTRACK_API_KEY }}
53+
DTRACK_SERVER: ${{ secrets.DTRACK_SERVER }}
54+
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
55+
IMAGE: admin-toolbox
56+
REPOSITORY: osism/admin-toolbox
57+
if: |
58+
github.repository == 'osism/container-images' &&
59+
github.ref == 'refs/heads/main'

admin-toolbox/Containerfile

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# OpenTofu Image to provide tofu binary for COPY command below
2+
FROM ghcr.io/opentofu/opentofu:minimal AS tofu
3+
4+
# Baseimage
5+
FROM alpine:3.22
6+
# 14MB
7+
8+
############## Set variables for easier modifications while building ###########
9+
10+
# ANSIBLE_INSTALLATION
11+
# set to "ansible" for full installation (~730MB)
12+
# set to "ansible-core" for minimal installation (~90MB)
13+
ARG ANSIBLE_PYTHON_MODULE="ansible-core"
14+
15+
# Version of kubectl to install
16+
# set to version from GitHub releases page here:
17+
# https://github.com/kubernetes/kubernetes/releases
18+
ARG KUBECTL_VERSION="v1.34.1"
19+
20+
# Version of k9s to install
21+
# set to version from GitHub releases page here:
22+
# https://github.com/derailed/k9s/releases
23+
ARG K9S_VERSION="v0.50.16"
24+
25+
# Version of helm to install
26+
# set to version from GitHub releases page here:
27+
# https://github.com/helm/helm/releases
28+
ARG HELM_VERSION="v3.19.0"
29+
30+
# Version of gardenlogin to install
31+
# set to version from GitHub releases page here:
32+
# https://github.com/gardener/gardenlogin/releases
33+
ARG GARDENLOGIN_VERSION="v0.7.1"
34+
35+
# Version of kubelogin to install
36+
# set to version from GitHub releases page here:
37+
# https://github.com/int128/kubelogin/releases
38+
ARG KUBELOGIN_VERSION="v1.34.2"
39+
40+
################################################################################
41+
42+
# Set default directory to work and run all commands from
43+
WORKDIR /workspace
44+
45+
# Install OpenTofu following the documentation here:
46+
# https://opentofu.org/docs/intro/install/docker/
47+
# + ~110MB
48+
COPY --from=tofu /usr/local/bin/tofu /usr/local/bin/tofu
49+
50+
# Install curl, tar, build utilities (like gcc and headers) and pip
51+
# to virtual .build-deps package to remove them later (keeping the image as
52+
# small as possible)
53+
#
54+
# Install python3-dev as direct dependency for Ansible and the openstackclient
55+
# (can not be removed later, since those depend on it)
56+
# + ~140MB
57+
#
58+
## Install Ansible (full) to virtual environment following the documentation here:
59+
## https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#pip-install
60+
## + ~730MB
61+
##
62+
## OR
63+
##
64+
## Install Ansible (ansible-core only) to virtual environment following the
65+
## documentation here:
66+
## https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#pip-install
67+
## + ~90MB
68+
#
69+
# Install openstackclient to virtual environment following the documentation
70+
# here:
71+
# https://docs.openstack.org/newton/user-guide/common/cli-install-openstack-command-line-clients.html
72+
# + ~200MB
73+
#
74+
# Install kubectl following the documentation here:
75+
# https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/
76+
# + ~80MB
77+
#
78+
# Install k9s with apk directly downloaded from the current GitHub releases
79+
# https://k9scli.io/topics/install/
80+
# + ~180MB
81+
#
82+
# Install helm from GitHub releases following the documentation here:
83+
# https://helm.sh/docs/intro/install/#from-the-binary-releases
84+
# + ~80MB
85+
#
86+
# Install gardenlogin from GitHub releases following the documentation here:
87+
# https://github.com/gardener/gardenlogin?tab=readme-ov-file#install-from-github-release
88+
# + ~90MB
89+
#
90+
# Install kubelogin from GitHub releases following the documentation here:
91+
# https://github.com/int128/kubelogin/tree/master?tab=readme-ov-file#getting-started
92+
# + ~20MB
93+
#
94+
# Cleanup virtual build-deps package
95+
96+
## Total image ~1.7GB with full ansible
97+
## Total image ~1.0GB with ansible-core
98+
RUN apk update --no-cache &&\
99+
apk add --no-cache --virtual .build-deps \
100+
curl gcc py3-pip tar musl-dev linux-headers &&\
101+
apk add --no-cache python3-dev &&\
102+
python3 -m venv ansible &&\
103+
source ansible/bin/activate &&\
104+
pip install "${ANSIBLE_PYTHON_MODULE}" &&\
105+
deactivate &&\
106+
python3 -m venv openstackclient &&\
107+
source openstackclient/bin/activate &&\
108+
pip install python-openstackclient &&\
109+
deactivate &&\
110+
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" &&\
111+
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl &&\
112+
rm kubectl &&\
113+
curl -LO "https://github.com/derailed/k9s/releases/download/${K9S_VERSION}/k9s_linux_amd64.apk" &&\
114+
apk add --allow-untrusted k9s_linux_amd64.apk &&\
115+
rm k9s_linux_amd64.apk &&\
116+
curl -LO "https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz" &&\
117+
tar -zxf "helm-${HELM_VERSION}-linux-amd64.tar.gz" &&\
118+
install -o root -g root -m 0755 linux-amd64/helm /usr/local/bin/helm &&\
119+
rm -r linux-amd64 &&\
120+
rm "helm-${HELM_VERSION}-linux-amd64.tar.gz" &&\
121+
curl -LO "https://github.com/gardener/gardenlogin/releases/download/${GARDENLOGIN_VERSION}/gardenlogin_linux_amd64" &&\
122+
install -o root -g root -m 0755 gardenlogin_linux_amd64 /usr/local/bin/gardenlogin &&\
123+
ln -s /usr/local/bin/gardenlogin /usr/local/bin/kubectl-gardenlogin &&\
124+
rm gardenlogin_linux_amd64 &&\
125+
curl -LO "https://github.com/int128/kubelogin/releases/download/${KUBELOGIN_VERSION}/kubelogin_linux_amd64.zip" &&\
126+
unzip kubelogin_linux_amd64.zip &&\
127+
install -o root -g root -m 0755 kubelogin /usr/local/bin/kubelogin &&\
128+
ln -s /usr/local/bin/kubelogin /usr/local/bin/kubectl-oidc_login &&\
129+
rm kubelogin README.md LICENSE &&\
130+
rm kubelogin_linux_amd64.zip &&\
131+
apk del .build-deps

admin-toolbox/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Containerfile

0 commit comments

Comments
 (0)