Skip to content

Commit

Permalink
Progagate v-less version everywhere.
Browse files Browse the repository at this point in the history
  • Loading branch information
VannTen committed Jan 14, 2025
1 parent 263a260 commit 59e8f8f
Show file tree
Hide file tree
Showing 28 changed files with 77 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Requires=cri-dockerd.socket

[Service]
Type=notify
ExecStart={{ bin_dir }}/cri-dockerd --container-runtime-endpoint {{ cri_socket }} --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin --network-plugin=cni --pod-cidr={{ kube_pods_subnet }} --pod-infra-container-image={{ pod_infra_image_repo }}:{{ pod_infra_version }} --log-level {{ cri_dockerd_log_level }} {% if enable_dual_stack_networks %}--ipv6-dual-stack=True{% endif %}
ExecStart={{ bin_dir }}/cri-dockerd --container-runtime-endpoint {{ cri_socket }} --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin --network-plugin=cni --pod-cidr={{ kube_pods_subnet }} --pod-infra-container-image={{ pod_infra_image_repo }}:{{ pod_infra_image_tag }} --log-level {{ cri_dockerd_log_level }} {% if enable_dual_stack_networks %}--ipv6-dual-stack=True{% endif %}

ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
Expand Down
4 changes: 2 additions & 2 deletions roles/container-engine/cri-o/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ crio_libexec_dir: "/usr/libexec/crio"
crio_enable_metrics: false
crio_log_level: "info"
crio_metrics_port: "9090"
crio_pause_image: "{{ pod_infra_image_repo }}:{{ pod_infra_version }}"
crio_pause_image: "{{ pod_infra_image_repo }}:{{ pod_infra_image_tag }}"

# Registries defined within cri-o.
# By default unqualified images are not allowed for security reasons
Expand Down Expand Up @@ -37,7 +37,7 @@ crio_signature_policy: "{% if ansible_os_family == 'ClearLinux' %}/usr/share/def

crio_stream_port: "10010"

crio_required_version: "{{ kube_version | regex_replace('^v(?P<major>\\d+).(?P<minor>\\d+).(?P<patch>\\d+)$', '\\g<major>.\\g<minor>') }}"
crio_required_version: "{{ kube_version | regex_replace('^(?P<major>\\d+).(?P<minor>\\d+).(?P<patch>\\d+)$', '\\g<major>.\\g<minor>') }}"

crio_root: "/var/lib/containers/storage"

Expand Down
4 changes: 2 additions & 2 deletions roles/container-engine/cri-o/tasks/load_vars.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
- name: Cri-o | include vars/v1.29.yml
include_vars: v1.29.yml
when: crio_version is version("v1.29.0", operator=">=")
when: crio_version is version("1.29.0", operator=">=")

- name: Cri-o | include vars/v1.31.yml
include_vars: v1.31.yml
when: crio_version is version("v1.31.0", operator=">=")
when: crio_version is version("1.31.0", operator=">=")
4 changes: 2 additions & 2 deletions roles/container-engine/cri-o/tasks/reset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

- name: CRI-O | Remove cri-o apt repo
apt_repository:
repo: "deb {{ crio_download_crio }}{{ crio_version }}/{{ crio_kubic_debian_repo_name }}/ /"
repo: "deb {{ crio_download_crio }}v{{ crio_version }}/{{ crio_kubic_debian_repo_name }}/ /"
state: absent
filename: devel-kubic-libcontainers-stable-cri-o
when: crio_kubic_debian_repo_name is defined
Expand All @@ -36,7 +36,7 @@

- name: CRI-O | Remove CRI-O kubic yum repo
yum_repository:
name: "devel_kubic_libcontainers_stable_cri-o_{{ crio_version }}"
name: "devel_kubic_libcontainers_stable_cri-o_v{{ crio_version }}"
state: absent
when:
- ansible_os_family == "RedHat"
Expand Down
2 changes: 1 addition & 1 deletion roles/container-engine/cri-o/templates/crio.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ enable_metrics = {{ crio_enable_metrics | bool | lower }}
# The port on which the metrics server will listen.
metrics_port = {{ crio_metrics_port }}

{% if nri_enabled and crio_version is version('v1.26.0', operator='>=') %}
{% if nri_enabled and crio_version is version('1.26.0', operator='>=') %}
[crio.nri]

enable_nri=true
Expand Down
2 changes: 1 addition & 1 deletion roles/download/templates/kubeadm-images.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ nodeRegistration:
apiVersion: kubeadm.k8s.io/{{ kubeadm_config_api_version }}
kind: ClusterConfiguration
imageRepository: {{ kube_image_repo }}
kubernetesVersion: {{ kube_version }}
kubernetesVersion: v{{ kube_version }}
etcd:
{% if etcd_deployment_type == "kubeadm" %}
local:
Expand Down
5 changes: 3 additions & 2 deletions roles/etcd/tasks/install_host.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
command: "{{ bin_dir }}/etcd --version"
register: etcd_current_host_version
# There's a chance this play could run before etcd is installed at all
# TODO: figure out whether this happens. "A chance" is not enough information
ignore_errors: true
when: etcd_cluster_setup

Expand All @@ -11,14 +12,14 @@
notify: Restart etcd
when:
- etcd_cluster_setup
- etcd_version.lstrip('v') not in etcd_current_host_version.stdout | default('')
- etcd_version not in etcd_current_host_version.stdout | default('')

- name: Restart etcd-events if necessary
command: /bin/true
notify: Restart etcd-events
when:
- etcd_events_cluster_setup
- etcd_version.lstrip('v') not in etcd_current_host_version.stdout | default('')
- etcd_version not in etcd_current_host_version.stdout | default('')

- name: Install | Copy etcd binary from download dir
copy:
Expand Down
4 changes: 2 additions & 2 deletions roles/kubernetes-apps/argocd/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
argocd_enabled: false
argocd_version: v2.11.0
argocd_version: 2.11.0
argocd_namespace: argocd
# argocd_admin_password:
argocd_install_url: "https://raw.githubusercontent.com/argoproj/argo-cd/{{ argocd_version }}/manifests/install.yaml"
argocd_install_url: "https://raw.githubusercontent.com/argoproj/argo-cd/v{{ argocd_version }}/manifests/install.yaml"
2 changes: 1 addition & 1 deletion roles/kubernetes-apps/gateway_api/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
gateway_api_enabled: false
gateway_api_version: v1.1.0
gateway_api_version: 1.1.0
gateway_api_experimental_channel: false
2 changes: 1 addition & 1 deletion roles/kubernetes-apps/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ dependencies:
- role: kubernetes-apps/scheduler_plugins
when:
- scheduler_plugins_enabled
- kube_major_version is version('v1.29', '<')
- kube_major_version is version('1.29', '<')
- inventory_hostname == groups['kube_control_plane'][0]
tags:
- scheduler_plugins
Expand Down
4 changes: 2 additions & 2 deletions roles/kubernetes-apps/metallb/templates/metallb.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -1716,7 +1716,7 @@ spec:
value: memberlist
- name: METALLB_DEPLOYMENT
value: controller
image: "{{ metallb_controller_image_repo }}:{{ metallb_version }}"
image: "{{ metallb_controller_image_repo }}:v{{ metallb_version }}"
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down Expand Up @@ -1824,7 +1824,7 @@ spec:
secretKeyRef:
key: secretkey
name: memberlist
image: "{{ metallb_speaker_image_repo }}:{{ metallb_version }}"
image: "{{ metallb_speaker_image_repo }}:v{{ metallb_version }}"
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
6 changes: 3 additions & 3 deletions roles/kubernetes/control-plane/defaults/main/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ kube_apiserver_admission_event_rate_limits: {}
## PodSecurityAdmission plugin configuration
kube_pod_security_use_default: false
kube_pod_security_default_enforce: baseline
kube_pod_security_default_enforce_version: "{{ kube_major_version }}"
kube_pod_security_default_enforce_version: "v{{ kube_major_version }}"
kube_pod_security_default_audit: restricted
kube_pod_security_default_audit_version: "{{ kube_major_version }}"
kube_pod_security_default_audit_version: "v{{ kube_major_version }}"
kube_pod_security_default_warn: restricted
kube_pod_security_default_warn_version: "{{ kube_major_version }}"
kube_pod_security_default_warn_version: "v{{ kube_major_version }}"
kube_pod_security_exemptions_usernames: []
kube_pod_security_exemptions_runtime_class_names: []
kube_pod_security_exemptions_namespaces:
Expand Down
4 changes: 2 additions & 2 deletions roles/kubernetes/control-plane/tasks/kubeadm-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
command: >-
timeout -k 600s 600s
{{ bin_dir }}/kubeadm
upgrade apply -y {{ kube_version }}
upgrade apply -y v{{ kube_version }}
--certificate-renewal={{ kubeadm_upgrade_auto_cert_renewal }}
--ignore-preflight-errors={{ kubeadm_ignore_preflight_errors | join(',') }}
--allow-experimental-upgrades
Expand All @@ -34,7 +34,7 @@
command: >-
timeout -k 600s 600s
{{ bin_dir }}/kubeadm
upgrade apply -y {{ kube_version }}
upgrade apply -y v{{ kube_version }}
--certificate-renewal={{ kubeadm_upgrade_auto_cert_renewal }}
--ignore-preflight-errors={{ kubeadm_ignore_preflight_errors | join(',') }}
--allow-experimental-upgrades
Expand Down
2 changes: 1 addition & 1 deletion roles/kubernetes/control-plane/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
mode: "0640"
vars:
authz_config:
apiVersion: apiserver.config.k8s.io/{{ 'v1alpha1' if kube_version is version('v1.30.0', '<') else 'v1beta1' if kube_version is version('v1.32.0', '<') else 'v1' }}
apiVersion: apiserver.config.k8s.io/{{ 'v1alpha1' if kube_version is version('1.30.0', '<') else 'v1beta1' if kube_version is version('1.32.0', '<') else 'v1' }}
kind: AuthorizationConfiguration
authorizers: "{{ kube_apiserver_authorization_config_authorizers }}"
when: kube_apiserver_use_authorization_config_file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ featureGates:
{{ feature | replace("=", ": ") }}
{% endfor %}
{% endif %}
kubernetesVersion: {{ kube_version }}
kubernetesVersion: v{{ kube_version }}
{% if kubeadm_config_api_fqdn is defined %}
controlPlaneEndpoint: {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
{% else %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ featureGates:
{{ feature | replace("=", ": ") }}
{% endfor %}
{% endif %}
kubernetesVersion: {{ kube_version }}
kubernetesVersion: v{{ kube_version }}
{% if kubeadm_config_api_fqdn is defined %}
controlPlaneEndpoint: {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
{% else %}
Expand Down
2 changes: 1 addition & 1 deletion roles/kubernetes/node/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ eviction_hard_control_plane: {}
kubelet_status_update_frequency: 10s

# kube-vip
kube_vip_version: v0.8.0
kube_vip_version: 0.8.0

kube_vip_arp_enabled: false
kube_vip_interface:
Expand Down
2 changes: 1 addition & 1 deletion roles/kubespray-defaults/defaults/main/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ kube_proxy_mode: ipvs

# Kubeadm config api version
# If kube_version is v1.31 or higher, it will be v1beta4, otherwise it will be v1beta3.
kubeadm_config_api_version: "{{ 'v1beta4' if kube_version is version('v1.31.0', '>=') else 'v1beta3' }}"
kubeadm_config_api_version: "{{ 'v1beta4' if kube_version is version('1.31.0', '>=') else 'v1beta3' }}"

## The timeout for init first control-plane
kubeadm_init_timeout: 300s
Expand Down
2 changes: 1 addition & 1 deletion roles/kubespray-defaults/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
kube_proxy_deployed: "{{ 'addon/kube-proxy' not in kubeadm_init_phases_skip }}"

# The lowest version allowed to upgrade from (same as calico_version in the previous branch)
calico_min_version_required: "v3.19.4"
calico_min_version_required: "3.19.4"

containerd_min_version_required: "1.3.7"
8 changes: 4 additions & 4 deletions roles/network_plugin/calico/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,18 @@
block:
- name: Calico | Check if extra directory is needed
stat:
path: "{{ local_release_dir }}/calico-{{ calico_version }}-kdd-crds/{{ 'kdd' if (calico_version is version('v3.22.3', '<')) else 'crd' }}"
path: "{{ local_release_dir }}/calico-{{ calico_version }}-kdd-crds/{{ 'kdd' if (calico_version is version('3.22.3', '<')) else 'crd' }}"
register: kdd_path
- name: Calico | Set kdd path when calico < v3.22.3
set_fact:
calico_kdd_path: "{{ local_release_dir }}/calico-{{ calico_version }}-kdd-crds{{ '/kdd' if kdd_path.stat.exists is defined and kdd_path.stat.exists }}"
when:
- calico_version is version('v3.22.3', '<')
- name: Calico | Set kdd path when calico > v3.22.2
- calico_version is version('3.22.3', '<')
- name: Calico | Set kdd path when calico > 3.22.2
set_fact:
calico_kdd_path: "{{ local_release_dir }}/calico-{{ calico_version }}-kdd-crds{{ '/crd' if kdd_path.stat.exists is defined and kdd_path.stat.exists }}"
when:
- calico_version is version('v3.22.2', '>')
- calico_version is version('3.22.2', '>')
- name: Calico | Create calico manifests for kdd
assemble:
src: "{{ calico_kdd_path }}"
Expand Down
4 changes: 2 additions & 2 deletions roles/network_plugin/calico/tasks/peer_with_router.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@
"asNumber": "{{ item.as }}",
"node": "{{ inventory_hostname }}",
"peerIP": "{{ item.router_id }}",
{% if calico_version is version('v3.26.0', '>=') and (item.filters | default([]) | length > 0) %}
{% if calico_version is version('3.26.0', '>=') and (item.filters | default([]) | length > 0) %}
"filters": {{ item.filters }},
{% endif %}
{% if calico_version is version('v3.23.0', '>=') and (item.numallowedlocalasnumbers | default(0) > 0) %}
{% if calico_version is version('3.23.0', '>=') and (item.numallowedlocalasnumbers | default(0) > 0) %}
"numAllowedLocalASNumbers": {{ item.numallowedlocalasnumbers }},
{% endif %}
"sourceAddress": "{{ item.sourceaddress | default('UseNodeIP') }}"
Expand Down
4 changes: 2 additions & 2 deletions roles/network_plugin/calico/templates/calico-apiserver.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ spec:
initialDelaySeconds: 90
periodSeconds: 10
name: calico-apiserver
{% if calico_version is version('v3.28.0', '>=') %}
{% if calico_version is version('3.28.0', '>=') %}
readinessProbe:
httpGet:
path: /readyz
Expand Down Expand Up @@ -184,7 +184,7 @@ rules:
- create
- update
- delete
{% if calico_version is version('v3.28.0', '>=') %}
{% if calico_version is version('3.28.0', '>=') %}
- apiGroups:
- policy
resourceNames:
Expand Down
8 changes: 4 additions & 4 deletions roles/network_plugin/cilium/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cilium_enable_ipv6: false
cilium_l2announcements: false

# Cilium agent health port
cilium_agent_health_port: "{%- if cilium_version | regex_replace('v') is version('1.11.6', '>=') -%}9879{%- else -%}9876{%- endif -%}"
cilium_agent_health_port: "{%- if cilium_version is version('1.11.6', '>=') -%}9879{%- else -%}9876{%- endif -%}"

# Identity allocation mode selects how identities are shared between cilium
# nodes by setting how they are stored. The options are "crd" or "kvstore".
Expand Down Expand Up @@ -307,9 +307,9 @@ cilium_rolling_restart_wait_retries_count: 30
cilium_rolling_restart_wait_retries_delay_seconds: 10

# Cilium changed the default metrics exporter ports in 1.12
cilium_agent_scrape_port: "{{ cilium_version | regex_replace('v') is version('1.12', '>=') | ternary('9962', '9090') }}"
cilium_operator_scrape_port: "{{ cilium_version | regex_replace('v') is version('1.12', '>=') | ternary('9963', '6942') }}"
cilium_hubble_scrape_port: "{{ cilium_version | regex_replace('v') is version('1.12', '>=') | ternary('9965', '9091') }}"
cilium_agent_scrape_port: "{{ cilium_version is version('1.12', '>=') | ternary('9962', '9090') }}"
cilium_operator_scrape_port: "{{ cilium_version is version('1.12', '>=') | ternary('9963', '6942') }}"
cilium_hubble_scrape_port: "{{ cilium_version is version('1.12', '>=') | ternary('9965', '9091') }}"

# Cilium certgen args for generate certificate for hubble mTLS
cilium_certgen_args:
Expand Down
4 changes: 2 additions & 2 deletions roles/network_plugin/cilium/tasks/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
msg: "cilium_encryption_type must be either 'ipsec' or 'wireguard'"
when: cilium_encryption_enabled

- name: Stop if cilium_version is < v1.10.0
- name: Stop if cilium_version is < 1.10.0
assert:
that: cilium_version | regex_replace('v') is version(cilium_min_version_required, '>=')
that: cilium_version is version(cilium_min_version_required, '>=')
msg: "cilium_version is too low. Minimum version {{ cilium_min_version_required }}"

# TODO: Clean this task up when we drop backward compatibility support for `cilium_ipsec_enabled`
Expand Down
14 changes: 7 additions & 7 deletions roles/network_plugin/cilium/templates/cilium-operator/cr.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,22 @@ rules:
- ciliumlocalredirectpolicies
- ciliumlocalredirectpolicies/status
- ciliumlocalredirectpolicies/finalizers
{% if cilium_version | regex_replace('v') is version('1.11', '>=') %}
{% if cilium_version is version('1.11', '>=') %}
- ciliumendpointslices
{% endif %}
{% if cilium_version | regex_replace('v') is version('1.12', '>=') %}
{% if cilium_version is version('1.12', '>=') %}
- ciliumbgploadbalancerippools
- ciliumloadbalancerippools
- ciliumloadbalancerippools/status
- ciliumbgppeeringpolicies
- ciliumenvoyconfigs
{% endif %}
{% if cilium_version | regex_replace('v') is version('1.15', '>=') %}
{% if cilium_version is version('1.15', '>=') %}
- ciliumbgppeerconfigs
- ciliumbgpadvertisements
- ciliumbgpnodeconfigs
{% endif %}
{% if cilium_version | regex_replace('v') is version('1.16', '>=') %}
{% if cilium_version is version('1.16', '>=') %}
- ciliumbgpclusterconfigs
- ciliumbgpclusterconfigs/status
- ciliumbgpnodeconfigoverrides
Expand Down Expand Up @@ -134,7 +134,7 @@ rules:
- create
- get
- update
{% if cilium_version | regex_replace('v') is version('1.12', '>=') %}
{% if cilium_version is version('1.12', '>=') %}
- apiGroups:
- apiextensions.k8s.io
resources:
Expand All @@ -156,14 +156,14 @@ rules:
- ciliumlocalredirectpolicies.cilium.io
- ciliumnetworkpolicies.cilium.io
- ciliumnodes.cilium.io
{% if cilium_version | regex_replace('v') is version('1.14', '>=') %}
{% if cilium_version is version('1.14', '>=') %}
- ciliumnodeconfigs.cilium.io
- ciliumcidrgroups.cilium.io
- ciliuml2announcementpolicies.cilium.io
- ciliumpodippools.cilium.io
- ciliumloadbalancerippools.cilium.io
{% endif %}
{% if cilium_version | regex_replace('v') is version('1.15', '>=') %}
{% if cilium_version is version('1.15', '>=') %}
- ciliumbgpclusterconfigs.cilium.io
- ciliumbgppeerconfigs.cilium.io
- ciliumbgpadvertisements.cilium.io
Expand Down
Loading

0 comments on commit 59e8f8f

Please sign in to comment.