Skip to content

Commit

Permalink
Support Kubernetes specific container images
Browse files Browse the repository at this point in the history
This commit adds container files with just kubernetes client and
removes the label as part of CNCF onboarding.

Signed-off-by: Naga Ravi Chaitanya Elluri <[email protected]>
  • Loading branch information
chaitanyaenr committed Jan 4, 2024
1 parent 83c6058 commit 331ea63
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 7 deletions.
6 changes: 2 additions & 4 deletions containers/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ FROM mcr.microsoft.com/azure-cli:latest as azure-cli

FROM registry.access.redhat.com/ubi8/ubi:latest

LABEL org.opencontainers.image.authors="Red Hat OpenShift Chaos Engineering"

ENV KUBECONFIG /root/.kube/config

# Copy azure client binary from azure-cli image
Expand All @@ -20,9 +18,9 @@ RUN yum install -y git python39 python3-pip jq gettext wget && \
pip3.9 install virtualenv && \
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq && chmod +x /usr/bin/yq

# Get Kubernetes and OpenShift clients from stable releases
# Setuo Kubernetes clients from stable releases
WORKDIR /tmp
RUN wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz && tar -xvf openshift-client-linux.tar.gz && cp oc /usr/local/bin/oc && cp kubectl /usr/local/bin/kubectl
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && chmod +x kubectl && mv ./kubectl /usr/local/bin/kubectl

WORKDIR /root/kraken

Expand Down
4 changes: 1 addition & 3 deletions containers/Dockerfile-ppc64le
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ FROM ppc64le/centos:8

FROM mcr.microsoft.com/azure-cli:latest as azure-cli

LABEL org.opencontainers.image.authors="Red Hat OpenShift Chaos Engineering"

ENV KUBECONFIG /root/.kube/config

# Copy azure client binary from azure-cli image
Expand All @@ -22,7 +20,7 @@ RUN yum install -y git python39 python3-pip jq gettext wget && \

# Get Kubernetes and OpenShift clients from stable releases
WORKDIR /tmp
RUN wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz && tar -xvf openshift-client-linux.tar.gz && cp oc /usr/local/bin/oc && cp kubectl /usr/local/bin/kubectl
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && chmod +x kubectl && mv ./kubectl /usr/local/bin/kubectl

WORKDIR /root/kraken

Expand Down
30 changes: 30 additions & 0 deletions containers/openshift/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Dockerfile for kraken

FROM mcr.microsoft.com/azure-cli:latest as azure-cli

FROM registry.access.redhat.com/ubi8/ubi:latest

LABEL org.opencontainers.image.authors="Red Hat OpenShift Chaos Engineering"

ENV KUBECONFIG /root/.kube/config

# Copy azure client binary from azure-cli image
COPY --from=azure-cli /usr/local/bin/az /usr/bin/az

# Install dependencies
RUN yum install -y git python39 python3-pip jq gettext wget && \
python3.9 -m pip install -U pip && \
git clone https://github.com/redhat-chaos/krkn.git --branch v1.5.2 /root/kraken && \
mkdir -p /root/.kube && cd /root/kraken && \
pip3.9 install -r requirements.txt && \
pip3.9 install virtualenv && \
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq && chmod +x /usr/bin/yq

# Get Kubernetes and OpenShift clients from stable releases
WORKDIR /tmp
RUN wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz && tar -xvf openshift-client-linux.tar.gz && cp oc /usr/local/bin/oc && cp kubectl /usr/local/bin/kubectl

WORKDIR /root/kraken

ENTRYPOINT ["python3.9", "run_kraken.py"]
CMD ["--config=config/config.yaml"]
29 changes: 29 additions & 0 deletions containers/openshift/Dockerfile-ppc64le
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Dockerfile for kraken

FROM ppc64le/centos:8

FROM mcr.microsoft.com/azure-cli:latest as azure-cli

LABEL org.opencontainers.image.authors="Red Hat OpenShift Chaos Engineering"

ENV KUBECONFIG /root/.kube/config

# Copy azure client binary from azure-cli image
COPY --from=azure-cli /usr/local/bin/az /usr/bin/az

# Install dependencies
RUN yum install -y git python39 python3-pip jq gettext wget && \
python3.9 -m pip install -U pip && \
git clone https://github.com/redhat-chaos/krkn.git --branch v1.5.2 /root/kraken && \
mkdir -p /root/.kube && cd /root/kraken && \
pip3.9 install -r requirements.txt && \
pip3.9 install virtualenv && \
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq && chmod +x /usr/bin/yq

# Get Kubernetes and OpenShift clients from stable releases
WORKDIR /tmp
RUN wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz && tar -xvf openshift-client-linux.tar.gz && cp oc /usr/local/bin/oc && cp kubectl /usr/local/bin/kubectl

WORKDIR /root/kraken

ENTRYPOINT python3.9 run_kraken.py --config=config/config.yaml
49 changes: 49 additions & 0 deletions containers/openshift/kraken.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
apiVersion: batch/v1
kind: Job
metadata:
name: kraken
spec:
parallelism: 1
completions: 1
template:
metadata:
labels:
tool: Kraken
spec:
serviceAccountName: useroot
containers:
- name: kraken
securityContext:
privileged: true
image: quay.io/redhat-chaos/krkn
command: ["/bin/sh", "-c"]
args: ["python3.9 run_kraken.py -c config/config.yaml"]
volumeMounts:
- mountPath: "/root/.kube"
name: config
- mountPath: "/root/kraken/config"
name: kraken-config
- mountPath: "/root/kraken/scenarios"
name: scenarios-config
- mountPath: "/root/kraken/scenarios/openshift"
name: scenarios-openshift-config
- mountPath: "/root/kraken/scenarios/kube"
name: scenarios-kube-config
restartPolicy: Never
volumes:
- name: config
configMap:
name: kube-config
- name: kraken-config
configMap:
name: kraken-config
- name: scenarios-config
configMap:
name: scenarios-config
- name: scenarios-openshift-config
configMap:
name: scenarios-openshift-config
- name: scenarios-kube-config
configMap:
name: scenarios-kube-config

0 comments on commit 331ea63

Please sign in to comment.