-
Notifications
You must be signed in to change notification settings - Fork 21
feat: add Kubernetes 1.33 support and upgrade Calico to 3.30.0 #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
8443e14
ef090ce
4a9d248
02d5148
1d8ecd0
eb7042e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,65 @@ | ||
# Base layer | ||
FROM ubuntu:22.04 AS baseline | ||
|
||
RUN apt-get update && apt-get upgrade -y --no-install-recommends \ | ||
&& apt-get install -y python3 python3-dev python3-pip curl unzip gnupg --no-install-recommends \ | ||
&& apt-get install -y \ | ||
python3 python3-dev python3-pip \ | ||
curl unzip gnupg lsb-release ca-certificates software-properties-common \ | ||
--no-install-recommends \ | ||
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 1 \ | ||
&& update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Layers used for building/downloading/installing tools | ||
|
||
# Tool building layer | ||
FROM baseline AS tool_builder | ||
|
||
ARG HELM_VERSION=3.17.1 | ||
ARG KUBECTL_VERSION=1.30.10 | ||
ARG TERRAFORM_VERSION=1.10.5-* | ||
ARG KUBECTL_VERSION=1.32.7 | ||
|
||
WORKDIR /build | ||
ARG TERRAFORM_VERSION=1.10.5 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this compatible with the older syntax? Just making sure ;) |
||
|
||
WORKDIR /build | ||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
RUN curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add - \ | ||
&& echo "deb [arch=amd64] https://apt.releases.hashicorp.com focal main" > /etc/apt/sources.list.d/tf.list \ | ||
&& apt-get update \ | ||
&& curl -sLO https://dl.k8s.io/release/v$KUBECTL_VERSION/bin/linux/amd64/kubectl && chmod 755 ./kubectl \ | ||
&& curl -ksLO https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 && chmod 755 get-helm-3 \ | ||
&& ./get-helm-3 --version v$HELM_VERSION --no-sudo \ | ||
&& apt-get install -y terraform=$TERRAFORM_VERSION --no-install-recommends \ | ||
|
||
# Install kubectl | ||
RUN curl -sLO https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl \ | ||
&& chmod 755 ./kubectl | ||
|
||
# Install helm | ||
RUN curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 -o get-helm-3 \ | ||
&& chmod 755 get-helm-3 \ | ||
&& ./get-helm-3 --version v${HELM_VERSION} --no-sudo | ||
|
||
# Install terraform (APT + fallback to binary) | ||
RUN set -e \ | ||
&& curl -fsSL https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/share/keyrings/hashicorp.gpg \ | ||
&& echo "deb [signed-by=/usr/share/keyrings/hashicorp.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" > /etc/apt/sources.list.d/hashicorp.list \ | ||
&& apt-get update || true \ | ||
&& (apt-get install -y terraform=${TERRAFORM_VERSION} --no-install-recommends || \ | ||
(echo "APT install failed. Falling back to direct download..." && \ | ||
curl -fsSL https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -o terraform.zip \ | ||
&& unzip terraform.zip \ | ||
&& mv terraform /usr/bin/terraform \ | ||
&& chmod +x /usr/bin/terraform \ | ||
&& rm terraform.zip)) \ | ||
Comment on lines
+24
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A single RUN command creates a single layer in docker. Not sure why you have broken these items out. Especially since kubectl is one of the lower or base layer. Any change there causes all other RUN commands and build option to rebuild. If that is the intent, then fine, but I am sure you are increasing the size of the docker container.
Comment on lines
+35
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this a problem? Never saw where |
||
&& apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Installation steps | ||
|
||
# Final image with tools and dependencies | ||
FROM baseline | ||
|
||
RUN apt-get update && apt-get -y install git sshpass jq \ | ||
# Install additional packages | ||
RUN apt-get update && apt-get install -y \ | ||
git sshpass jq \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy tools from builder stage | ||
COPY --from=tool_builder /usr/local/bin/helm /usr/local/bin/helm | ||
COPY --from=tool_builder /build/kubectl /usr/local/bin/kubectl | ||
COPY --from=tool_builder /usr/bin/terraform /usr/bin/terraform | ||
|
||
# Copy your source | ||
WORKDIR /viya4-iac-k8s | ||
COPY . /viya4-iac-k8s/ | ||
|
||
|
@@ -53,4 +79,4 @@ ENV TF_VAR_ansible_vars=/workspace/ansible-vars.yaml | |
ENV ANSIBLE_CONFIG=/viya4-iac-k8s/ansible.cfg | ||
|
||
VOLUME ["/workspace"] | ||
ENTRYPOINT ["/viya4-iac-k8s/docker-entrypoint.sh"] | ||
ENTRYPOINT ["/viya4-iac-k8s/docker-entrypoint.sh"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. File needs a correct line ending. This can be done in VS Code automatically. This usually happens when switching between windows/linux or your editor, i.e. nano or something strips the last line without adding the correct file ending. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,14 +7,21 @@ | |
# | ||
# kubeadm Configuration : https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta2/ | ||
# | ||
{% if kubernetes_version is version('1.26.0', 'lt', version_type='semver') %} | ||
apiVersion: kubeadm.k8s.io/v1beta2 | ||
{% else %} | ||
{% if kubernetes_version is version('1.31.0', 'lt', version_type='semver') %} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a breaking change? Asking as you've removed the previous logic. If the code is no longer compatible with any previous version, then its a breaking change. This is a process and logistical call on your teams part. Make sure this one creates a new primary version of the tooling. |
||
apiVersion: kubeadm.k8s.io/v1beta3 | ||
{% elif kubernetes_version is version('1.33.0', 'lt', version_type='semver') %} | ||
apiVersion: kubeadm.k8s.io/v1beta4 | ||
{% else %} | ||
apiVersion: kubeadm.k8s.io/v1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. kubeadm only has v1beta3 and v1beta4 listed. There is no v1 listed at this time. As long as you're sure it will not break things if someone has entered the wrong k8s version this may be fine. I would only add these once available. Link to reference site for this repo - https://kubernetes.io/docs/reference/config-api/ Latest version of kubeadm config api - https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta4/ |
||
{% endif %} | ||
kind: ClusterConfiguration | ||
certificatesDir: /etc/kubernetes/pki | ||
kubernetesVersion: v{{ kubernetes_version }} | ||
clusterName: "{{ kubernetes_cluster_name }}" | ||
controlPlaneEndpoint: "{{ kubernetes_vip_fqdn }}:6443" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the port static? I have seen where this can change, but not sure if that's a configurable value here. |
||
|
||
imageRepository: registry.k8s.io | ||
|
||
apiServer: | ||
certSANs: | ||
- "{{ kubernetes_vip_fqdn }}" | ||
|
@@ -37,7 +44,11 @@ clusterName: "{{ kubernetes_cluster_name }}" | |
# | ||
# Kubelet Configuration : https://kubernetes.io/docs/reference/config-api/kubelet-config.v1beta1/ | ||
# | ||
{% if kubernetes_version is version('1.31.0', 'lt', version_type='semver') %} | ||
apiVersion: kubelet.config.k8s.io/v1beta1 | ||
{% else %} | ||
apiVersion: kubelet.config.k8s.io/v1beta2 | ||
{% endif %} | ||
Comment on lines
+47
to
+51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see v1beta2 for this config. Only v1beta1 and v1alpha1 along with v1. This needs to change. Link - https://kubernetes.io/docs/reference/config-api/kubelet-config.v1/ |
||
kind: KubeletConfiguration | ||
authentication: | ||
anonymous: | ||
|
@@ -51,11 +62,15 @@ cgroupDriver: systemd | |
# | ||
# kube-proxy Configuration : https://kubernetes.io/docs/reference/config-api/kube-proxy-config.v1alpha1/ | ||
# | ||
{% if kubernetes_version is version('1.31.0', 'lt', version_type='semver') %} | ||
apiVersion: kubeproxy.config.k8s.io/v1alpha1 | ||
{% else %} | ||
apiVersion: kubeproxy.config.k8s.io/v1beta1 | ||
{% endif %} | ||
Comment on lines
+68
to
+69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There seem to be lots of additions here that are not in the current docs. Please provide info as to where you're finding these apis vs the official doc here - https://kubernetes.io/docs/reference/config-api/kube-proxy-config.v1alpha1/ I believe I am using the latest docs from kubernetes. |
||
kind: KubeProxyConfiguration | ||
mode: "ipvs" | ||
ipvs: | ||
strictARP: true | ||
metricsBindAddress: "0.0.0.0:10249" | ||
enableProfiling: true | ||
clusterCIDR: "{{ kubernetes_pod_subnet }}" | ||
clusterCIDR: "{{ kubernetes_pod_subnet }}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix line ending |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,8 +47,9 @@ | |
# | ||
- name: Kill the unattended-upgrade task if it's running | ||
ansible.builtin.shell: | | ||
killall -q -9 unattended-upgrade 2>&1 /dev/null | ||
ignore_errors: true | ||
if pgrep -x unattended-upgrade >/dev/null; then | ||
killall -q -9 unattended-upgrade | ||
fi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This now fails if the kill does not work? Again, logic change here. Please explain |
||
tags: | ||
- install | ||
- update | ||
|
@@ -57,7 +58,12 @@ | |
ansible.builtin.apt: | ||
name: unattended-upgrades | ||
state: absent | ||
|
||
purge: true | ||
register: apt_remove_result | ||
until: apt_remove_result is succeeded | ||
retries: 5 # retry up to 5 times | ||
delay: 30 # wait 30s between retries | ||
tags: | ||
- install | ||
- update | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the extra lines, but wondering about lsb-release, ca-certificates, and software-properties-common