Skip to content

Commit

Permalink
comment fixes and default version change
Browse files Browse the repository at this point in the history
  • Loading branch information
niam0522 committed Nov 28, 2024
1 parent 61ca9fd commit 25b7abf
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 19 deletions.
6 changes: 3 additions & 3 deletions documentation/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ By default, the installer uses the following parameters:

| Parameter | Default Value | Description |
|---------------------------------------------------------|----------------------------------------------------------|----------------------------------------------------------------------------------------|
| kubernetesVersion | `v1.28.12` | |
| kubernetesVersion | `v1.30.3` | |
| controlPlaneEndpoint | `{{ cluster_name }}:6443` | |
| networking.podSubnet | `10.128.0.0/14` for IPv4 or `fd02::/48` for IPv6 | |
| networking.serviceSubnet | `172.30.0.0/16` for IPv4 or `fd03::/112` for IPv6 | |
Expand Down Expand Up @@ -1174,12 +1174,12 @@ services:

#### Kubernetes version

By default, the `v1.28.12` version of the Kubernetes is installed. See the table of supported versions for details in [Supported versions section](#supported-versions). However, we recommend that you explicitly specify the version you are about to install. This version applies into all the dependent parameters - images, binaries, rpms, configurations: all these are downloaded and used according to your choice. To specify the version, use the following parameter as in example:
By default, the `v1.30.3` version of the Kubernetes is installed. See the table of supported versions for details in [Supported versions section](#supported-versions). However, we recommend that you explicitly specify the version you are about to install. This version applies into all the dependent parameters - images, binaries, rpms, configurations: all these are downloaded and used according to your choice. To specify the version, use the following parameter as in example:

```yaml
services:
kubeadm:
kubernetesVersion: v1.28.12
kubernetesVersion: v1.30.3
```

### Service Account Issuer
Expand Down
2 changes: 2 additions & 0 deletions kubemarine/patches/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
from typing import List

from kubemarine.core.patch import Patch
from kubemarine.patches.p1_pin_kubernetes_version import PinKubernetesVersion

patches: List[Patch] = [
PinKubernetesVersion(),
]
"""
List of patches that is sorted according to the Patch.priority() before execution.
Expand Down
50 changes: 50 additions & 0 deletions kubemarine/patches/p1_pin_kubernetes_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright 2021-2023 NetCracker Technology Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from textwrap import dedent

from kubemarine.core.action import Action
from kubemarine.core.patch import InventoryOnlyPatch
from kubemarine.core.resources import DynamicResources


class TheAction(Action):
def __init__(self) -> None:
super().__init__("Set previous default Kubernetes version", recreate_inventory=True)

def run(self, res: DynamicResources) -> None:
logger = res.logger()
inventory = res.inventory()
if 'kubernetesVersion' not in inventory.get('services', {}).get('kubeadm', {}):
logger.debug("Set services.kubeadm.kubernetesVersion = v1.28.12 in the inventory")
inventory.setdefault('services', {}).setdefault('kubeadm', {})['kubernetesVersion'] = 'v1.28.12'
else:
logger.info("Skipping the patch as services.kubeadm.kubernetesVersion is explicitly provided.")


class PinKubernetesVersion(InventoryOnlyPatch):
def __init__(self) -> None:
super().__init__("pin_kubernetes_version")

@property
def action(self) -> Action:
return TheAction()

@property
def description(self) -> str:
return dedent(
f"""\
The patch sets previous default Kubernetes version in the inventory if the version was not explicitly specified.
""".rstrip()
)
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ calico:
v1.28.12:
version: v3.29.1
v1.29.1:
version: v3.27.4
version: v3.29.1
v1.29.4:
version: v3.27.4
version: v3.29.1
v1.29.7:
version: v3.29.1
v1.30.1:
version: v3.27.4
version: v3.29.1
v1.30.3:
version: v3.29.1
v1.31.1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,17 @@ calicoctl:
version: v3.29.1
sha1: 00be749d257eee5035d3ba408aca15fcaf8be7c2
v1.29.1:
version: v3.27.4
sha1: df6672fd1e1f9b2ba65567a04383af6bbffc2cd2
version: v3.29.1
sha1: 00be749d257eee5035d3ba408aca15fcaf8be7c2
v1.29.4:
version: v3.27.4
sha1: df6672fd1e1f9b2ba65567a04383af6bbffc2cd2
version: v3.29.1
sha1: 00be749d257eee5035d3ba408aca15fcaf8be7c2
v1.29.7:
version: v3.29.1
sha1: 00be749d257eee5035d3ba408aca15fcaf8be7c2
v1.30.1:
version: v3.27.4
sha1: df6672fd1e1f9b2ba65567a04383af6bbffc2cd2
version: v3.29.1
sha1: 00be749d257eee5035d3ba408aca15fcaf8be7c2
v1.30.3:
version: v3.29.1
sha1: 00be749d257eee5035d3ba408aca15fcaf8be7c2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ compatibility_map:
local-path-provisioner: v0.0.27
crictl: v1.30.0
v1.29.1:
calico: v3.27.4
calico: v3.29.1
nginx-ingress-controller: v1.9.6
kubernetes-dashboard: v2.7.0
local-path-provisioner: v0.0.26
crictl: v1.29.0
v1.29.4:
calico: v3.27.4
calico: v3.29.1
nginx-ingress-controller: v1.10.1
kubernetes-dashboard: v2.7.0
local-path-provisioner: v0.0.26
Expand All @@ -97,7 +97,7 @@ compatibility_map:
local-path-provisioner: v0.0.27
crictl: v1.30.0
v1.30.1:
calico: v3.27.4
calico: v3.29.1
nginx-ingress-controller: v1.10.1
kubernetes-dashboard: v2.7.0
local-path-provisioner: v0.0.26
Expand Down
2 changes: 1 addition & 1 deletion kubemarine/resources/configurations/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ services:
kubeadm:
apiVersion: 'kubeadm.k8s.io/v1beta3'
kind: ClusterConfiguration
kubernetesVersion: v1.28.12
kubernetesVersion: v1.30.3
controlPlaneEndpoint: '{{ cluster_name }}:6443'
imageRepository: registry.k8s.io
dns: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"properties": {
"kubernetesVersion": {
"type": "string",
"default": "v1.27.13",
"default": "v1.30.3",
"description": "Specify the version to install and maintain. This version applies into all the dependent parameters - images, binaries, rpms, configurations."
},
"imageRepository": {
Expand Down
6 changes: 4 additions & 2 deletions test/unit/test_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,16 @@ class PrimitiveValuesAsString(unittest.TestCase):
def test_default_enrichment(self):
inventory = demo.generate_inventory(**demo.ALLINONE)
inventory['services'].setdefault('cri', {})['containerRuntime'] = 'containerd'
inventory['services'].setdefault('kubeadm', {})['kubernetesVersion'] = 'v1.28.12'
inventory['services'].setdefault('kubeadm', {})['kubernetesVersion'] = 'v1.30.3'


cluster = demo.new_cluster(inventory)
inventory = cluster.inventory

self.assertEqual(True, inventory['services']['cri']['containerdConfig']
['plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options']['SystemdCgroup'])
self.assertNotIn('min', inventory['services']['kubeadm_kube-proxy']['conntrack'])
self.assertIn('min', inventory['services']['kubeadm_kube-proxy']['conntrack'])


nginx_ingress_ports = inventory['plugins']['nginx-ingress-controller']['ports']
self.assertEqual(20080, [port for port in nginx_ingress_ports if port['name'] == 'http'][0]['hostPort'])
Expand Down

0 comments on commit 25b7abf

Please sign in to comment.