Skip to content

Commit

Permalink
Remove unused hyperkube and kubelet repository (#1134)
Browse files Browse the repository at this point in the history
Signed-off-by: Artiom Diomin <kron82@gmail.com>
  • Loading branch information
kron4eg authored Dec 15, 2021
1 parent 5b6f0f9 commit 791cfbc
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 66 deletions.
23 changes: 5 additions & 18 deletions cmd/machine-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ import (
"strings"
"time"

"github.com/docker/distribution/reference"
"github.com/prometheus/client_golang/prometheus"

osmv1alpha1 "k8c.io/operating-system-manager/pkg/crd/osm/v1alpha1"

clusterv1alpha1 "github.com/kubermatic/machine-controller/pkg/apis/cluster/v1alpha1"
Expand Down Expand Up @@ -81,7 +79,6 @@ var (
nodeInsecureRegistries string
nodeRegistryMirrors string
nodePauseImage string
nodeKubeletRepository string
nodeContainerRuntime string
podCidr string
nodePortRange string
Expand Down Expand Up @@ -165,7 +162,7 @@ func main() {
flag.StringVar(&nodeInsecureRegistries, "node-insecure-registries", "", "Comma separated list of registries which should be configured as insecure on the container runtime")
flag.StringVar(&nodeRegistryMirrors, "node-registry-mirrors", "", "Comma separated list of Docker image mirrors")
flag.StringVar(&nodePauseImage, "node-pause-image", "", "Image for the pause container including tag. If not set, the kubelet default will be used: https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/")
flag.StringVar(&nodeKubeletRepository, "node-kubelet-repository", "quay.io/kubermatic/kubelet", "Repository for the kubelet container. Only has effect on Flatcar Linux.")
flag.String("node-kubelet-repository", "quay.io/kubermatic/kubelet", "[NO-OP] Repository for the kubelet container. Has no effects.")
flag.StringVar(&nodeContainerRuntime, "node-container-runtime", "docker", "container-runtime to deploy")
flag.Var(&nodeContainerdRegistryMirrors, "node-containerd-registry-mirrors", "Configure registry mirrors endpoints. Can be used multiple times to specify multiple mirrors")
flag.StringVar(&caBundleFile, "ca-bundle", "", "path to a file containing all PEM-encoded CA certificates (will be used instead of the host's certificates if set)")
Expand Down Expand Up @@ -209,15 +206,6 @@ func main() {
klog.Fatalf("failed to add osmv1alpha1 api to scheme: %v", err)
}

// Check if the kubelet image has a tag set
kubeletRepoRef, err := reference.Parse(nodeKubeletRepository)
if err != nil {
klog.Fatalf("failed to parse -node-kubelet-repository %s: %v", nodeKubeletRepository, err)
}
if _, ok := kubeletRepoRef.(reference.NamedTagged); ok {
klog.Fatalf("-node-kubelet-repository must not contain a tag. The tag will be dynamically set for each Machine.")
}

cfg, err := clientcmd.BuildConfigFromFlags(masterURL, kubeconfig)
if err != nil {
klog.Fatalf("error building kubeconfig: %v", err)
Expand Down Expand Up @@ -285,11 +273,10 @@ func main() {
skipEvictionAfter: skipEvictionAfter,
nodeCSRApprover: nodeCSRApprover,
node: machinecontroller.NodeSettings{
ClusterDNSIPs: clusterDNSIPs,
HTTPProxy: nodeHTTPProxy,
KubeletRepository: nodeKubeletRepository,
NoProxy: nodeNoProxy,
PauseImage: nodePauseImage,
ClusterDNSIPs: clusterDNSIPs,
HTTPProxy: nodeHTTPProxy,
NoProxy: nodeNoProxy,
PauseImage: nodePauseImage,
ContainerRuntime: containerruntime.Get(
nodeContainerRuntime,
containerruntime.WithInsecureRegistries(insecureRegistries),
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ require (
github.com/coreos/container-linux-config-transpiler v0.9.0
github.com/davecgh/go-spew v1.1.1
github.com/digitalocean/godo v1.54.0
github.com/docker/distribution v2.7.1+incompatible
github.com/ghodss/yaml v1.0.0
github.com/go-test/deep v1.0.7
github.com/google/uuid v1.1.2
Expand Down
2 changes: 0 additions & 2 deletions pkg/apis/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ type UserDataRequest struct {
HTTPProxy string
NoProxy string
PauseImage string
HyperkubeImage string
KubeletRepository string
KubeletFeatureGates map[string]bool
ContainerRuntime containerruntime.Config
PodCIDR string
Expand Down
6 changes: 0 additions & 6 deletions pkg/controller/machine/machine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ type NodeSettings struct {
RegistryMirrors []string
// Translates to --pod-infra-container-image on the kubelet. If not set, the kubelet will default it.
PauseImage string
// The hyperkube image to use. Currently only Container Linux and Flatcar Linux uses it.
HyperkubeImage string
// The kubelet repository to use. Currently only Flatcar Linux uses it.
KubeletRepository string
// Translates to feature gates on the kubelet.
// Default: RotateKubeletServerCertificate=true
KubeletFeatureGates map[string]bool
Expand Down Expand Up @@ -732,8 +728,6 @@ func (r *Reconciler) ensureInstanceExistsForMachine(
ExternalCloudProvider: externalCloudProvider,
DNSIPs: r.nodeSettings.ClusterDNSIPs,
PauseImage: r.nodeSettings.PauseImage,
HyperkubeImage: r.nodeSettings.HyperkubeImage,
KubeletRepository: r.nodeSettings.KubeletRepository,
KubeletFeatureGates: kubeletFeatureGates,
NoProxy: r.nodeSettings.NoProxy,
HTTPProxy: r.nodeSettings.HTTPProxy,
Expand Down
17 changes: 0 additions & 17 deletions pkg/userdata/flatcar/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ import (
userdatahelper "github.com/kubermatic/machine-controller/pkg/userdata/helper"
)

const (
lessThen119Check = "< 1.19"
)

// Provider is a pkg/userdata/plugin.Provider implementation.
type Provider struct{}

Expand Down Expand Up @@ -86,17 +82,6 @@ func (p Provider) UserData(req plugin.UserDataRequest) (string, error) {
flatcarConfig.DisableUpdateEngine = true
}

kubeletImage := req.KubeletRepository
lessThen119, err := semver.NewConstraint(lessThen119Check)
if err != nil {
return "", err
}

if lessThen119.Check(kubeletVersion) {
kubeletImage = req.HyperkubeImage
}
kubeletImage = kubeletImage + ":v" + kubeletVersion.String()

crEngine := req.ContainerRuntime.Engine(kubeletVersion)
crScript, err := crEngine.ScriptFor(providerconfigtypes.OperatingSystemFlatcar)
if err != nil {
Expand All @@ -114,7 +99,6 @@ func (p Provider) UserData(req plugin.UserDataRequest) (string, error) {
FlatcarConfig *Config
Kubeconfig string
KubernetesCACert string
KubeletImage string
KubeletVersion string
NodeIPScript string
ExtraKubeletFlags []string
Expand All @@ -128,7 +112,6 @@ func (p Provider) UserData(req plugin.UserDataRequest) (string, error) {
FlatcarConfig: flatcarConfig,
Kubeconfig: kubeconfigString,
KubernetesCACert: kubernetesCACert,
KubeletImage: kubeletImage,
KubeletVersion: kubeletVersion.String(),
NodeIPScript: userdatahelper.SetupNodeIPEnvScript(),
ExtraKubeletFlags: crEngine.KubeletFlags(),
Expand Down
22 changes: 0 additions & 22 deletions pkg/userdata/flatcar/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ type userDataTestCase struct {
insecureRegistries []string
registryMirrors map[string][]string
pauseImage string
hyperkubeImage string
kubeletImage string
containerruntime string
}

Expand Down Expand Up @@ -153,8 +151,6 @@ func TestUserDataGeneration(t *testing.T) {
DisableAutoUpdate: true,
ProvisioningUtility: Ignition,
},
hyperkubeImage: "for-kubernetes-less-then-1.19/hyperkubeImage",
kubeletImage: "for-kubernetes-more-then-1.19/kubeletImage",
},
{
name: "ignition_v1.20.11",
Expand Down Expand Up @@ -186,8 +182,6 @@ func TestUserDataGeneration(t *testing.T) {
DisableAutoUpdate: true,
ProvisioningUtility: Ignition,
},
hyperkubeImage: "for-kubernetes-less-then-1.19/hyperkubeImage",
kubeletImage: "for-kubernetes-more-then-1.19/kubeletImage",
},
{
name: "ignition_v1.21.5",
Expand Down Expand Up @@ -219,8 +213,6 @@ func TestUserDataGeneration(t *testing.T) {
DisableAutoUpdate: true,
ProvisioningUtility: Ignition,
},
hyperkubeImage: "for-kubernetes-less-then-1.19/hyperkubeImage",
kubeletImage: "for-kubernetes-more-then-1.19/kubeletImage",
},
{
name: "ignition_v1.22.2",
Expand Down Expand Up @@ -252,8 +244,6 @@ func TestUserDataGeneration(t *testing.T) {
DisableAutoUpdate: true,
ProvisioningUtility: Ignition,
},
hyperkubeImage: "for-kubernetes-less-then-1.19/hyperkubeImage",
kubeletImage: "for-kubernetes-more-then-1.19/kubeletImage",
},
{
name: "cloud-init_v1.19.15",
Expand Down Expand Up @@ -285,8 +275,6 @@ func TestUserDataGeneration(t *testing.T) {
DisableAutoUpdate: true,
ProvisioningUtility: CloudInit,
},
hyperkubeImage: "for-kubernetes-less-then-1.19/hyperkubeImage",
kubeletImage: "for-kubernetes-more-then-1.19/kubeletImage",
},
{
name: "cloud-init_v1.20.11",
Expand Down Expand Up @@ -318,8 +306,6 @@ func TestUserDataGeneration(t *testing.T) {
DisableAutoUpdate: true,
ProvisioningUtility: CloudInit,
},
hyperkubeImage: "for-kubernetes-less-then-1.19/hyperkubeImage",
kubeletImage: "for-kubernetes-more-then-1.19/kubeletImage",
},
{
name: "cloud-init_v1.21.5",
Expand Down Expand Up @@ -351,8 +337,6 @@ func TestUserDataGeneration(t *testing.T) {
DisableAutoUpdate: true,
ProvisioningUtility: CloudInit,
},
hyperkubeImage: "for-kubernetes-less-then-1.19/hyperkubeImage",
kubeletImage: "for-kubernetes-more-then-1.19/kubeletImage",
},
{
name: "cloud-init_v1.22.2",
Expand Down Expand Up @@ -384,8 +368,6 @@ func TestUserDataGeneration(t *testing.T) {
DisableAutoUpdate: true,
ProvisioningUtility: CloudInit,
},
hyperkubeImage: "for-kubernetes-less-then-1.19/hyperkubeImage",
kubeletImage: "for-kubernetes-more-then-1.19/kubeletImage",
},
{
name: "containerd",
Expand All @@ -408,8 +390,6 @@ func TestUserDataGeneration(t *testing.T) {
DisableAutoUpdate: true,
ProvisioningUtility: CloudInit,
},
hyperkubeImage: "for-kubernetes-less-then-1.19/hyperkubeImage",
kubeletImage: "for-kubernetes-more-then-1.19/kubeletImage",
},
}

Expand Down Expand Up @@ -450,8 +430,6 @@ func TestUserDataGeneration(t *testing.T) {
HTTPProxy: test.httpProxy,
NoProxy: test.noProxy,
PauseImage: test.pauseImage,
HyperkubeImage: test.hyperkubeImage,
KubeletRepository: test.kubeletImage,
KubeletFeatureGates: kubeletFeatureGates,
ContainerRuntime: containerruntime.Get(
test.containerruntime,
Expand Down

0 comments on commit 791cfbc

Please sign in to comment.