Unverified Commit 0291bd35 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #56015 from luxas/kubeadm_fix_selfhosting_bug

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. kubeadm: Fix a small bug in the self-hosting code **What this PR does / why we need it**: `apps/v1beta2` requires that `DaemonSet.spec.selector.matchLabels` equals `DaemonSet.spec.template.metadata.labels`. Without this change, the API server rejects the DaemonSet in the validation stage. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ``` @kubernetes/sig-cluster-lifecycle-pr-reviews @xiangpengzhao
parents f0ce7ca0 2a047211
...@@ -141,6 +141,9 @@ func BuildDaemonSet(name string, podSpec *v1.PodSpec, mutators map[string][]PodS ...@@ -141,6 +141,9 @@ func BuildDaemonSet(name string, podSpec *v1.PodSpec, mutators map[string][]PodS
Labels: BuildSelfhostedComponentLabels(name), Labels: BuildSelfhostedComponentLabels(name),
}, },
Spec: apps.DaemonSetSpec{ Spec: apps.DaemonSetSpec{
Selector: &metav1.LabelSelector{
MatchLabels: BuildSelfhostedComponentLabels(name),
},
Template: v1.PodTemplateSpec{ Template: v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: BuildSelfhostedComponentLabels(name), Labels: BuildSelfhostedComponentLabels(name),
......
...@@ -113,6 +113,9 @@ metadata: ...@@ -113,6 +113,9 @@ metadata:
name: self-hosted-kube-apiserver name: self-hosted-kube-apiserver
namespace: kube-system namespace: kube-system
spec: spec:
selector:
matchLabels:
k8s-app: self-hosted-kube-apiserver
template: template:
metadata: metadata:
creationTimestamp: null creationTimestamp: null
...@@ -271,6 +274,9 @@ metadata: ...@@ -271,6 +274,9 @@ metadata:
name: self-hosted-kube-controller-manager name: self-hosted-kube-controller-manager
namespace: kube-system namespace: kube-system
spec: spec:
selector:
matchLabels:
k8s-app: self-hosted-kube-controller-manager
template: template:
metadata: metadata:
creationTimestamp: null creationTimestamp: null
...@@ -398,6 +404,9 @@ metadata: ...@@ -398,6 +404,9 @@ metadata:
name: self-hosted-kube-scheduler name: self-hosted-kube-scheduler
namespace: kube-system namespace: kube-system
spec: spec:
selector:
matchLabels:
k8s-app: self-hosted-kube-scheduler
template: template:
metadata: metadata:
creationTimestamp: null creationTimestamp: null
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment