Skip to content

Commit

Permalink
add kubectl 1.23
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-codefresh authored Dec 7, 2022
1 parent 223ef44 commit e6e265b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ RUN apk update && apk add curl

RUN export ARCH=$([[ "$(uname -m)" == "aarch64" ]] && echo "arm64" || echo "amd64") && \
mkdir -p /tmp/kubectl-versions && cd /tmp/kubectl-versions \
curl -o kubectl1.23 -L https://storage.googleapis.com/kubernetes-release/release/v1.23.0/bin/linux/${ARCH}/kubectl && \
curl -o kubectl1.22 -L https://storage.googleapis.com/kubernetes-release/release/v1.22.0/bin/linux/${ARCH}/kubectl && \
curl -o kubectl1.21 -L https://storage.googleapis.com/kubernetes-release/release/v1.21.0/bin/linux/${ARCH}/kubectl && \
curl -o kubectl1.20 -L https://storage.googleapis.com/kubernetes-release/release/v1.20.0/bin/linux/${ARCH}/kubectl && \
Expand All @@ -22,6 +23,8 @@ RUN export ARCH=$([[ "$(uname -m)" == "aarch64" ]] && echo "arm64" || echo "amd6

FROM debian:bullseye-slim

RUN apt-get update -y && apt-get install busybox -y && ln -s /bin/busybox /usr/bin/[[

RUN adduser --gecos "" --disabled-password --home /home/cfu --shell /bin/bash cfu

#RUN apt update && apt upgrade && apt install bash # THIS IS NOT REQUIRED. BASH IS ALREADY INCLUDED IN BULLSEYE
Expand Down
14 changes: 10 additions & 4 deletions cf-deploy-kubernetes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fi
if [[ -n "${SERVER_VERSION}" ]]; then
# Statically define SERVER_VERSION from variable override
echo "Statically defined version: ${SERVER_VERSION}"
# Assign kubectl version
# Assign kubectl version
echo "Setting kubectl to version 1.${SERVER_VERSION}"
cp -f "/usr/local/bin/kubectl1.${SERVER_VERSION}" /usr/local/bin/kubectl 2>/dev/null
else
Expand All @@ -58,7 +58,8 @@ else
if (( "$SERVER_VERSION" == "19" )); then cp -f /usr/local/bin/kubectl1.19 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" == "20" )); then cp -f /usr/local/bin/kubectl1.20 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" == "21" )); then cp -f /usr/local/bin/kubectl1.21 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" >= "22" )); then cp -f /usr/local/bin/kubectl1.22 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" == "22" )); then cp -f /usr/local/bin/kubectl1.22 /usr/local/bin/kubectl; fi 2>/dev/null
if (( "$SERVER_VERSION" >= "23" )); then cp -f /usr/local/bin/kubectl1.23 /usr/local/bin/kubectl; fi 2>/dev/null
[ ! -f "${deployment_file}" ] && echo "Couldn't find $deployment_file file at $(pwd)" && exit 1;
fi

Expand All @@ -77,18 +78,23 @@ if [[ -n "${KUBE_CTL_TEST_VERSION}" ]]; then
fatal "Version Mismatch!!!"
exit 1
fi
fi
fi

DEPLOYMENT_FILE=${deployment_file}-$(date '+%y-%m-%d_%H-%M-%S').yml
$(dirname $0)/template.sh "$deployment_file" > "$DEPLOYMENT_FILE" || fatal "Failed to apply deployment template on $deployment_file"

if (( "$SERVER_VERSION" <= "17" )); then
dry_run_value=true
else
dry_run_value=client
fi

echo -e "\n\n---> Kubernetes objects to deploy in $deployment_file :"
KUBECTL_OBJECTS=/tmp/deployment.objects
kubectl $KUBECTL_ACTION \
--context "${KUBECONTEXT}" \
--namespace "${KUBERNETES_NAMESPACE}" \
--dry-run \
--dry-run=${dry_run_value} \
-f "$DEPLOYMENT_FILE" \
-o go-template \
--template '{{ if .items }}{{ range .items }}{{ printf "%-30s%-50s\n" .kind .metadata.name}}{{end}}{{else}}{{ printf "%-30s%-50s\n" .kind .metadata.name}}{{end}}' \
Expand Down
2 changes: 1 addition & 1 deletion service.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version: 16.2.0
version: 16.2.1

0 comments on commit e6e265b

Please sign in to comment.