2022-09-05 03:06:08 -04:00
|
|
|
/*
|
|
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2022-07-21 08:41:07 -04:00
|
|
|
package versions
|
|
|
|
|
2022-07-22 09:05:04 -04:00
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
// ValidK8sVersion represents any of the three currently supported k8s versions.
|
|
|
|
type ValidK8sVersion string
|
|
|
|
|
|
|
|
// NewValidK8sVersion validates the given string and produces a new ValidK8sVersion object.
|
|
|
|
func NewValidK8sVersion(k8sVersion string) (ValidK8sVersion, error) {
|
|
|
|
if IsSupportedK8sVersion(k8sVersion) {
|
|
|
|
return ValidK8sVersion(k8sVersion), nil
|
|
|
|
}
|
|
|
|
return "", fmt.Errorf("invalid k8sVersion supplied: %s", k8sVersion)
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsSupportedK8sVersion checks if a given Kubernetes version is supported by Constellation.
|
|
|
|
func IsSupportedK8sVersion(version string) bool {
|
|
|
|
switch version {
|
2022-07-27 07:38:14 -04:00
|
|
|
case string(V1_22):
|
|
|
|
return true
|
2022-07-22 09:05:04 -04:00
|
|
|
case string(V1_23):
|
|
|
|
return true
|
2022-07-26 11:08:57 -04:00
|
|
|
case string(V1_24):
|
|
|
|
return true
|
2022-09-02 08:05:44 -04:00
|
|
|
case string(V1_25):
|
|
|
|
return true
|
2022-07-22 09:05:04 -04:00
|
|
|
default:
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-02 08:05:44 -04:00
|
|
|
// IsPreviewK8sVersion checks if a given Kubernetes version is still in preview and not fully supported.
|
|
|
|
func IsPreviewK8sVersion(version ValidK8sVersion) bool {
|
|
|
|
return version == V1_25
|
|
|
|
}
|
|
|
|
|
2022-07-21 08:41:07 -04:00
|
|
|
const (
|
|
|
|
// Constellation images.
|
|
|
|
// These images are built in a way that they support all versions currently listed in VersionConfigs.
|
2022-08-31 21:40:29 -04:00
|
|
|
KonnectivityAgentImage = "us.gcr.io/k8s-artifacts-prod/kas-network-proxy/proxy-agent:v0.0.32"
|
|
|
|
KonnectivityServerImage = "registry.k8s.io/kas-network-proxy/proxy-server:v0.0.32"
|
2022-10-04 10:44:44 -04:00
|
|
|
JoinImage = "ghcr.io/edgelesssys/constellation/join-service:v2.1.0-pre.0.20220928143744-c46d6e390f2d"
|
2022-09-12 09:17:27 -04:00
|
|
|
AccessManagerImage = "ghcr.io/edgelesssys/constellation/access-manager:v2.0.0"
|
|
|
|
KmsImage = "ghcr.io/edgelesssys/constellation/kmsserver:v2.0.0"
|
|
|
|
VerificationImage = "ghcr.io/edgelesssys/constellation/verification-service:v2.0.0"
|
2022-08-31 07:39:58 -04:00
|
|
|
GcpGuestImage = "ghcr.io/edgelesssys/gcp-guest-agent:20220713.00"
|
|
|
|
NodeOperatorCatalogImage = "ghcr.io/edgelesssys/constellation/node-operator-catalog"
|
2022-09-30 11:01:28 -04:00
|
|
|
NodeOperatorVersion = "v2.1.0-pre.0.20220927150426-f69db6f26ecb"
|
2022-08-31 07:39:58 -04:00
|
|
|
// TODO: switch node maintenance operator catalog back to upstream quay.io/medik8s/node-maintenance-operator-catalog
|
|
|
|
// once https://github.com/medik8s/node-maintenance-operator/issues/49 is resolved.
|
|
|
|
NodeMaintenanceOperatorCatalogImage = "ghcr.io/edgelesssys/constellation/node-maintenance-operator-catalog"
|
|
|
|
NodeMaintenanceOperatorVersion = "v0.13.1-alpha1"
|
2022-07-22 09:05:04 -04:00
|
|
|
|
|
|
|
// currently supported versions.
|
2022-09-02 07:57:57 -04:00
|
|
|
V1_22 ValidK8sVersion = "1.22"
|
|
|
|
V1_23 ValidK8sVersion = "1.23"
|
|
|
|
V1_24 ValidK8sVersion = "1.24"
|
2022-09-02 08:05:44 -04:00
|
|
|
V1_25 ValidK8sVersion = "1.25"
|
2022-09-02 07:59:49 -04:00
|
|
|
Default ValidK8sVersion = V1_23
|
2022-07-21 08:41:07 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
// versionConfigs holds download URLs for all required kubernetes components for every supported version.
|
2022-07-22 09:05:04 -04:00
|
|
|
var VersionConfigs map[ValidK8sVersion]KubernetesVersion = map[ValidK8sVersion]KubernetesVersion{
|
2022-07-27 07:38:14 -04:00
|
|
|
V1_22: {
|
|
|
|
PatchVersion: "1.22.12",
|
|
|
|
CNIPluginsURL: "https://github.com/containernetworking/plugins/releases/download/v1.1.1/cni-plugins-linux-amd64-v1.1.1.tgz",
|
|
|
|
CrictlURL: "https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.24.1/crictl-v1.24.1-linux-amd64.tar.gz",
|
|
|
|
KubeletServiceURL: "https://raw.githubusercontent.com/kubernetes/release/v0.13.0/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service",
|
|
|
|
KubeadmConfURL: "https://raw.githubusercontent.com/kubernetes/release/v0.13.0/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf",
|
|
|
|
KubeletURL: "https://storage.googleapis.com/kubernetes-release/release/v1.22.12/bin/linux/amd64/kubelet",
|
|
|
|
KubeadmURL: "https://storage.googleapis.com/kubernetes-release/release/v1.22.12/bin/linux/amd64/kubeadm",
|
|
|
|
KubectlURL: "https://storage.googleapis.com/kubernetes-release/release/v1.22.12/bin/linux/amd64/kubectl",
|
|
|
|
// CloudControllerManagerImageGCP is the CCM image used on GCP.
|
|
|
|
// TODO: use newer "cloud-provider-gcp" from https://github.com/kubernetes/cloud-provider-gcp when newer releases are available.
|
2022-08-03 05:46:11 -04:00
|
|
|
CloudControllerManagerImageGCP: "ghcr.io/edgelesssys/cloud-provider-gcp:v22",
|
2022-07-27 07:38:14 -04:00
|
|
|
// CloudControllerManagerImageAzure is the CCM image used on Azure.
|
|
|
|
CloudControllerManagerImageAzure: "mcr.microsoft.com/oss/kubernetes/azure-cloud-controller-manager:v1.1.18",
|
|
|
|
// CloudNodeManagerImageAzure is the cloud-node-manager image used on Azure.
|
|
|
|
CloudNodeManagerImageAzure: "mcr.microsoft.com/oss/kubernetes/azure-cloud-node-manager:v1.1.18",
|
|
|
|
// External service image. Depends on k8s version.
|
|
|
|
ClusterAutoscalerImage: "k8s.gcr.io/autoscaling/cluster-autoscaler:v1.22.3",
|
|
|
|
},
|
2022-07-22 09:05:04 -04:00
|
|
|
V1_23: {
|
2022-09-02 07:59:49 -04:00
|
|
|
PatchVersion: "1.23.9",
|
2022-07-21 08:41:07 -04:00
|
|
|
CNIPluginsURL: "https://github.com/containernetworking/plugins/releases/download/v1.1.1/cni-plugins-linux-amd64-v1.1.1.tgz",
|
|
|
|
CrictlURL: "https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.24.1/crictl-v1.24.1-linux-amd64.tar.gz",
|
|
|
|
KubeletServiceURL: "https://raw.githubusercontent.com/kubernetes/release/v0.13.0/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service",
|
|
|
|
KubeadmConfURL: "https://raw.githubusercontent.com/kubernetes/release/v0.13.0/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf",
|
2022-09-02 07:59:49 -04:00
|
|
|
KubeletURL: "https://storage.googleapis.com/kubernetes-release/release/v1.23.9/bin/linux/amd64/kubelet",
|
|
|
|
KubeadmURL: "https://storage.googleapis.com/kubernetes-release/release/v1.23.9/bin/linux/amd64/kubeadm",
|
|
|
|
KubectlURL: "https://storage.googleapis.com/kubernetes-release/release/v1.23.9/bin/linux/amd64/kubectl",
|
2022-07-21 08:41:07 -04:00
|
|
|
// CloudControllerManagerImageGCP is the CCM image used on GCP.
|
|
|
|
// TODO: use newer "cloud-provider-gcp" from https://github.com/kubernetes/cloud-provider-gcp when newer releases are available.
|
2022-08-03 05:46:11 -04:00
|
|
|
CloudControllerManagerImageGCP: "ghcr.io/edgelesssys/cloud-provider-gcp:v23",
|
2022-07-21 08:41:07 -04:00
|
|
|
// CloudControllerManagerImageAzure is the CCM image used on Azure.
|
|
|
|
CloudControllerManagerImageAzure: "mcr.microsoft.com/oss/kubernetes/azure-cloud-controller-manager:v1.23.11",
|
|
|
|
// CloudNodeManagerImageAzure is the cloud-node-manager image used on Azure.
|
|
|
|
CloudNodeManagerImageAzure: "mcr.microsoft.com/oss/kubernetes/azure-cloud-node-manager:v1.23.11",
|
|
|
|
// External service image. Depends on k8s version.
|
2022-07-27 07:38:14 -04:00
|
|
|
ClusterAutoscalerImage: "k8s.gcr.io/autoscaling/cluster-autoscaler:v1.23.1",
|
2022-07-21 08:41:07 -04:00
|
|
|
},
|
2022-07-26 11:08:57 -04:00
|
|
|
V1_24: {
|
|
|
|
PatchVersion: "1.24.3",
|
|
|
|
CNIPluginsURL: "https://github.com/containernetworking/plugins/releases/download/v1.1.1/cni-plugins-linux-amd64-v1.1.1.tgz",
|
|
|
|
CrictlURL: "https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.24.1/crictl-v1.24.1-linux-amd64.tar.gz",
|
|
|
|
KubeletServiceURL: "https://raw.githubusercontent.com/kubernetes/release/v0.13.0/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service",
|
|
|
|
KubeadmConfURL: "https://raw.githubusercontent.com/kubernetes/release/v0.13.0/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf",
|
|
|
|
KubeletURL: "https://storage.googleapis.com/kubernetes-release/release/v1.24.3/bin/linux/amd64/kubelet",
|
|
|
|
KubeadmURL: "https://storage.googleapis.com/kubernetes-release/release/v1.24.3/bin/linux/amd64/kubeadm",
|
|
|
|
KubectlURL: "https://storage.googleapis.com/kubernetes-release/release/v1.24.3/bin/linux/amd64/kubectl",
|
|
|
|
// CloudControllerManagerImageGCP is the CCM image used on GCP.
|
|
|
|
// TODO: use newer "cloud-provider-gcp" from https://github.com/kubernetes/cloud-provider-gcp when newer releases are available.
|
2022-08-03 05:46:11 -04:00
|
|
|
CloudControllerManagerImageGCP: "ghcr.io/edgelesssys/cloud-provider-gcp:v24",
|
2022-07-26 11:08:57 -04:00
|
|
|
// CloudControllerManagerImageAzure is the CCM image used on Azure.
|
|
|
|
CloudControllerManagerImageAzure: "mcr.microsoft.com/oss/kubernetes/azure-cloud-controller-manager:v1.24.3",
|
|
|
|
// CloudNodeManagerImageAzure is the cloud-node-manager image used on Azure.
|
|
|
|
CloudNodeManagerImageAzure: "mcr.microsoft.com/oss/kubernetes/azure-cloud-node-manager:v1.24.3",
|
|
|
|
// External service image. Depends on k8s version.
|
2022-09-02 07:59:49 -04:00
|
|
|
ClusterAutoscalerImage: "k8s.gcr.io/autoscaling/cluster-autoscaler:v1.23.1",
|
2022-07-26 11:08:57 -04:00
|
|
|
},
|
2022-09-02 08:05:44 -04:00
|
|
|
V1_25: {
|
|
|
|
PatchVersion: "1.25.0",
|
|
|
|
CNIPluginsURL: "https://github.com/containernetworking/plugins/releases/download/v1.1.1/cni-plugins-linux-amd64-v1.1.1.tgz",
|
|
|
|
CrictlURL: "https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.25.0/crictl-v1.25.0-linux-amd64.tar.gz",
|
|
|
|
KubeletServiceURL: "https://raw.githubusercontent.com/kubernetes/release/v0.13.0/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service",
|
|
|
|
KubeadmConfURL: "https://raw.githubusercontent.com/kubernetes/release/v0.13.0/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf",
|
|
|
|
KubeletURL: "https://storage.googleapis.com/kubernetes-release/release/v1.25.0/bin/linux/amd64/kubelet",
|
|
|
|
KubeadmURL: "https://storage.googleapis.com/kubernetes-release/release/v1.25.0/bin/linux/amd64/kubeadm",
|
|
|
|
KubectlURL: "https://storage.googleapis.com/kubernetes-release/release/v1.25.0/bin/linux/amd64/kubectl",
|
|
|
|
// CloudControllerManagerImageGCP is the CCM image used on GCP.
|
|
|
|
// TODO: use newer "cloud-provider-gcp" from https://github.com/kubernetes/cloud-provider-gcp when newer releases are available.
|
|
|
|
CloudControllerManagerImageGCP: "ghcr.io/edgelesssys/cloud-provider-gcp:v24",
|
|
|
|
// CloudControllerManagerImageAzure is the CCM image used on Azure.
|
|
|
|
CloudControllerManagerImageAzure: "mcr.microsoft.com/oss/kubernetes/azure-cloud-controller-manager:v1.24.4",
|
|
|
|
// CloudNodeManagerImageAzure is the cloud-node-manager image used on Azure.
|
|
|
|
CloudNodeManagerImageAzure: "mcr.microsoft.com/oss/kubernetes/azure-cloud-node-manager:v1.24.4",
|
|
|
|
// External service image. Depends on k8s version.
|
|
|
|
ClusterAutoscalerImage: "k8s.gcr.io/autoscaling/cluster-autoscaler:v1.23.1",
|
|
|
|
},
|
2022-07-21 08:41:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// KubernetesVersion bundles download URLs to all version-releated binaries necessary for installing/deploying a particular Kubernetes version.
|
|
|
|
type KubernetesVersion struct {
|
2022-07-22 09:05:04 -04:00
|
|
|
PatchVersion string
|
2022-07-27 07:38:14 -04:00
|
|
|
CNIPluginsURL string // No k8s version dependency.
|
|
|
|
CrictlURL string // k8s version dependency.
|
|
|
|
KubeletServiceURL string // No k8s version dependency.
|
|
|
|
KubeadmConfURL string // kubeadm/kubelet v1.11+.
|
|
|
|
KubeletURL string // k8s version dependency.
|
|
|
|
KubeadmURL string // k8s version dependency.
|
|
|
|
KubectlURL string // k8s version dependency.
|
2022-08-03 05:46:11 -04:00
|
|
|
CloudControllerManagerImageGCP string // Using self-built image until resolved: https://github.com/kubernetes/cloud-provider-gcp/issues/289
|
2022-07-27 07:38:14 -04:00
|
|
|
CloudControllerManagerImageAzure string // k8s version dependency.
|
|
|
|
CloudNodeManagerImageAzure string // k8s version dependency. Same version as above.
|
|
|
|
ClusterAutoscalerImage string // Matches k8s versioning scheme.
|
2022-07-21 08:41:07 -04:00
|
|
|
}
|