Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy virtualcluster control plane on master nodes #486

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ spec:
spec:
automountServiceAccountToken: false
hostNetwork: true
tolerations:
- key: "node-role.kubernetes.io/control-plane"
operator: "Exists"
effect: "NoSchedule"
containers:
- name: kube-apiserver
image: {{ .ImageRepository }}/kube-apiserver:{{ .Version }}
Expand Down Expand Up @@ -81,6 +85,12 @@ spec:
successThreshold: 1
timeoutSeconds: 15
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/control-plane
operator: Exists
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
Expand Down
21 changes: 19 additions & 2 deletions pkg/kubenest/manifest/controlplane/etcd/mainfests_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,27 @@ spec:
metadata:
labels:
virtualCluster-app: etcd
tolerations:
- operator: Exists
spec:
automountServiceAccountToken: false
tolerations:
- key: "node-role.kubernetes.io/control-plane"
operator: "Exists"
effect: "NoSchedule"
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/control-plane
operator: Exists
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: virtualCluster-app
operator: In
values: ["etcd"]
topologyKey: kubernetes.io/hostname
containers:
- name: etcd
image: {{ .ImageRepository }}/etcd:{{ .Version }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@ spec:
spec:
automountServiceAccountToken: false
priorityClassName: system-node-critical
tolerations:
- key: "node-role.kubernetes.io/control-plane"
operator: "Exists"
effect: "NoSchedule"
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/control-plane
operator: Exists
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,25 @@ spec:
virtualCluster-app: scheduler
spec:
automountServiceAccountToken: false
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
tolerations:
- key: "node-role.kubernetes.io/control-plane"
operator: "Exists"
effect: "NoSchedule"
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/control-plane
operator: Exists
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: virtualCluster-app
operator: In
values: ["scheduler"]
topologyKey: kubernetes.io/hostname
containers:
- name: scheduler
image: {{ .ImageRepository }}/scheduler:{{ .Version }}
Expand Down
10 changes: 5 additions & 5 deletions pkg/kubenest/tasks/manifests_components.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ func applyComponentsManifests(r workflow.RunData) error {
return err
}

templatedMapping := make(map[string]interface{}, 2)
templatedMapping["KUBE_PROXY_KUBECONFIG"] = string(secret.Data[constants.KubeConfig])
imageRepository, _ := util.GetImageMessage()
templatedMapping["ImageRepository"] = imageRepository

for _, component := range components {
klog.V(2).Infof("Deploy component %s", component.Name)

templatedMapping := make(map[string]interface{}, 2)
if component.Name == constants.VirtualClusterKubeProxyComponent {
templatedMapping["KUBE_PROXY_KUBECONFIG"] = string(secret.Data[constants.KubeConfig])
}
err = applyTemplatedManifests(dynamicClient, component.Path, templatedMapping)
if err != nil {
return err
Expand Down
Loading