Skip to content

Commit

Permalink
Merge pull request #704 from Netcracker/CPDEV-108608_Close_all_high_a…
Browse files Browse the repository at this point in the history
…nd_critical_vulnerabilities_in_Kubemarine

[CPDEV-108608] Close_all_high_and_critical_vulnerabilities_Kubemarine
  • Loading branch information
theboringstuff authored Nov 28, 2024
2 parents c90bc68 + 248e63b commit 119cabb
Show file tree
Hide file tree
Showing 18 changed files with 12,655 additions and 291 deletions.
35 changes: 3 additions & 32 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 Expand Up @@ -5995,35 +5995,6 @@ If the task is skipped, then it is not able to schedule the cumulative point. Fo

The tables below shows the correspondence of versions that are supported and is used during the installation:

## Default Dependent Components Versions for Kubernetes Versions v1.26.11
| Type | Name | Versions | | | | | | | Note |
|----------|----------------------------------------------------------------|------------------|------------------------------|--------------|--------------|-------------------|-----------|-----------|------------------------------------------------------------------------------------------------------------|
| | | CentOS RHEL 7.5+ | CentOS RHEL Oracle Linux 8.4 | Ubuntu 20.04,22.04 | Ubuntu 24.04 | Oracle Linux 7.5+ | RHEL 8.6+ | RockyLinux 8.6+ | |
| binaries | kubeadm | v1.26.11 | v1.26.11 | v1.26.11 | unsupported | v1.26.11 | v1.26.11 | v1.26.11 | SHA1: 3d634ce0bf8db1ab5a9ea723443e7bce042c865b |
| | kubelet | v1.26.11 | v1.26.11 | v1.26.11 | unsupported | v1.26.11 | v1.26.11 | v1.26.11 | SHA1: 497d7785658f4b247404580a821c22958f7a4b93 |
| | kubectl | v1.26.11 | v1.26.11 | v1.26.11 | unsupported | v1.26.11 | v1.26.11 | v1.26.11 | SHA1: df1fa17ce624c2a3e6a05b26157f93719b640bfa |
| | calicoctl | v3.26.4 | v3.26.4 | v3.26.4 | unsupported | v3.26.4 | v3.26.4 | v3.26.4 | SHA1: 46875b3d28318553fe382db0766a0916f2556217 Required only if calico is installed. |
| | crictl | v1.28.0 | v1.28.0 | v1.28.0 | unsupported | v1.28.0 | v1.28.0 | v1.28.0 | SHA1: 1199411456ab5a1e0dd9524724f15e92aa3f9da7 |
| rpms | containerd.io | 1.6.* | 1.6.* | 1.6.* | unsupported | 1.6.* | 1.6.* | 1.6.* | |
| | haproxy/rh-haproxy | 1.8 | 1.8 | 2.* | unsupported | 1.8 | 1.8 | 1.8 | Required only if balancers are presented in the deployment scheme. |
| | keepalived | 1.3 | 2.1 | 2.* | unsupported | 1.3 | 2.1 | 2.1 | Required only if VRRP is presented in the deployment scheme. |
| images | registry.k8s.io/kube-apiserver | v1.26.11 | v1.26.11 | v1.26.11 | unsupported | v1.26.11 | v1.26.11 | v1.26.11 | |
| | registry.k8s.io/kube-controller-manager | v1.26.11 | v1.26.11 | v1.26.11 | unsupported | v1.26.11 | v1.26.11 | v1.26.11 | |
| | registry.k8s.io/kube-proxy | v1.26.11 | v1.26.11 | v1.26.11 | unsupported | v1.26.11 | v1.26.11 | v1.26.11 | |
| | registry.k8s.io/kube-scheduler | v1.26.11 | v1.26.11 | v1.26.11 | unsupported | v1.26.11 | v1.26.11 | v1.26.11 | |
| | registry.k8s.io/coredns | v1.9.3 | v1.9.3 | v1.9.3 | unsupported | v1.9.3 | v1.9.3 | v1.9.3 | |
| | registry.k8s.io/pause | 3.9 | 3.9 | 3.9 | unsupported | 3.9 | 3.9 | 3.9 | |
| | registry.k8s.io/etcd | 3.5.9-0 | 3.5.9-0 | 3.5.9-0 | unsupported | 3.5.9-0 | 3.5.9-0 | 3.5.9-0 | |
| | calico/typha | v3.26.4 | v3.26.4 | v3.26.4 | unsupported | v3.26.4 | v3.26.4 | v3.26.4 | Required only if Typha is enabled in Calico config. |
| | calico/cni | v3.26.4 | v3.26.4 | v3.26.4 | unsupported | v3.26.4 | v3.26.4 | v3.26.4 | |
| | calico/node | v3.26.4 | v3.26.4 | v3.26.4 | unsupported | v3.26.4 | v3.26.4 | v3.26.4 | |
| | calico/kube-controllers | v3.26.4 | v3.26.4 | v3.26.4 | unsupported | v3.26.4 | v3.26.4 | v3.26.4 | |
| | calico/apiserver | v3.26.4 | v3.26.4 | v3.26.4 | unsupported | v3.26.4 | v3.26.4 | v3.26.4 | Required only if API server is enabled in Calico config. |
| | registry.k8s.io/ingress-nginx/controller | v1.8.4 | v1.8.4 | v1.8.4 | unsupported | v1.8.4 | v1.8.4 | v1.8.4 | |
| | registry.k8s.io/kube-webhook-certgen | v20231011-8b53cabe0 | v20231011-8b53cabe0 | v20231011-8b53cabe0 | unsupported | v20231011-8b53cabe0 | v20231011-8b53cabe0 | v20231011-8b53cabe0 | |
| | kubernetesui/dashboard | v2.7.0 | v2.7.0 | v2.7.0 | unsupported | v2.7.0 | v2.7.0 | v2.7.0 | Required only if Kubernetes Dashboard plugin is set to be installed. |
| | kubernetesui/metrics-scraper | v1.0.8 | v1.0.8 | v1.0.8 | unsupported | v1.0.8 | v1.0.8 | v1.0.8 | Required only if Kubernetes Dashboard plugin is set to be installed. |
| | rancher/local-path-provisioner | v0.0.25 | v0.0.25 | v0.0.25 | unsupported | v0.0.25 | v0.0.25 | v0.0.25 | Required only if local-path provisioner plugin is set to be installed. |

## Default Dependent Components Versions for Kubernetes Versions v1.27.13
| Type | Name | Versions | | | | | | | Note |
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()
)
24 changes: 22 additions & 2 deletions kubemarine/patches/software_upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@
# The order of upgrade of defined by the implementation.

thirdparties:
calicoctl: []
calicoctl:
- v1.28.6
- v1.28.8
- v1.28.9
- v1.28.12
- v1.29.1
- v1.29.4
- v1.29.7
- v1.30.1
- v1.30.3
- v1.31.1
crictl: []
packages:
containerd:
Expand All @@ -31,7 +41,17 @@ packages:
version_rhel9: false
version_debian: false
plugins:
calico: []
calico:
- v1.28.6
- v1.28.8
- v1.28.9
- v1.28.12
- v1.29.1
- v1.29.4
- v1.29.7
- v1.30.1
- v1.30.3
- v1.31.1
nginx-ingress-controller: []
kubernetes-dashboard: []
local-path-provisioner: []
Loading

0 comments on commit 119cabb

Please sign in to comment.