Skip to content

Commit 52a7727

Browse files
iQQBotkylos101
andauthored
[node-labeler] Refactor node labeling to use taints instead of labels (#20652)
* [node-labeler] Refactor node labeling to use taints instead of labels * [agent-smith] Add toleration to daemonset * Add workspace component tolerations to various Gitpod components if it running in Full installation * Apply suggestions from code review Co-authored-by: Kyle Brennan <[email protected]> * Update components/node-labeler/cmd/run.go Co-authored-by: Kyle Brennan <[email protected]> --------- Co-authored-by: Kyle Brennan <[email protected]>
1 parent 1becba7 commit 52a7727

File tree

26 files changed

+383
-71
lines changed

26 files changed

+383
-71
lines changed

components/node-labeler/cmd/run.go

Lines changed: 276 additions & 68 deletions
Large diffs are not rendered by default.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright (c) 2025 Gitpod GmbH. All rights reserved.
2+
// Licensed under the GNU Affero General Public License (AGPL).
3+
// See License.AGPL.txt in the project root for license information.
4+
5+
package common
6+
7+
import (
8+
configv1 "github.com/gitpod-io/gitpod/installer/pkg/config/v1"
9+
corev1 "k8s.io/api/core/v1"
10+
)
11+
12+
const (
13+
RegistryFacadeTaintKey = "gitpod.io/registry-facade-not-ready"
14+
WsDaemonTaintKey = "gitpod.io/ws-daemon-not-ready"
15+
)
16+
17+
func WithTolerationWorkspaceComponentNotReady(ctx *RenderContext) []corev1.Toleration {
18+
if ctx.Config.Kind != configv1.InstallationFull {
19+
return []corev1.Toleration{}
20+
}
21+
return []corev1.Toleration{
22+
{
23+
Key: RegistryFacadeTaintKey,
24+
Operator: corev1.TolerationOpExists,
25+
Effect: corev1.TaintEffectNoSchedule,
26+
},
27+
{
28+
Key: WsDaemonTaintKey,
29+
Operator: corev1.TolerationOpExists,
30+
Effect: corev1.TaintEffectNoSchedule,
31+
},
32+
}
33+
}

install/installer/pkg/components/agent-smith/daemonset.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ func daemonset(ctx *common.RenderContext) ([]runtime.Object, error) {
105105
},
106106
common.CAVolume(),
107107
},
108+
Tolerations: []corev1.Toleration{
109+
{
110+
Effect: corev1.TaintEffectNoSchedule,
111+
Operator: corev1.TolerationOpExists,
112+
},
113+
},
108114
},
109115
},
110116
UpdateStrategy: common.DaemonSetRolloutStrategy(),

install/installer/pkg/components/blobserve/deployment.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
168168
FailureThreshold: 3,
169169
},
170170
}, *common.KubeRBACProxyContainer(ctx)},
171+
Tolerations: common.WithTolerationWorkspaceComponentNotReady(ctx),
171172
},
172173
},
173174
},

install/installer/pkg/components/content-service/deployment.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
8888
},
8989
}, *common.KubeRBACProxyContainer(ctx),
9090
},
91+
Tolerations: common.WithTolerationWorkspaceComponentNotReady(ctx),
9192
}
9293

9394
err = common.AddStorageMounts(ctx, &podSpec, Component)

install/installer/pkg/components/dashboard/deployment.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
8686
TimeoutSeconds: 1,
8787
},
8888
}},
89+
Tolerations: common.WithTolerationWorkspaceComponentNotReady(ctx),
8990
},
9091
},
9192
},

install/installer/pkg/components/database/incluster/helm.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ var Helm = common.CompositeHelmFunc(
2525
return nil, err
2626
}
2727

28+
tolerations, err := helm.WithTolerationWorkspaceComponentNotReadyYaml(cfg)
29+
if err != nil {
30+
return nil, err
31+
}
32+
tolerationsTemplate, err := helm.KeyFileValue("mysql.primary.tolerations", tolerations)
33+
if err != nil {
34+
return nil, err
35+
}
36+
2837
imageRegistry := common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL)
2938

3039
type EnvVar struct {
@@ -73,6 +82,7 @@ var Helm = common.CompositeHelmFunc(
7382
FileValues: []string{
7483
primaryAffinityTemplate,
7584
extraEnvVarsTemplate,
85+
tolerationsTemplate,
7686
},
7787
},
7888
}, nil

install/installer/pkg/components/docker-registry/helm.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,25 @@ var Helm = common.CompositeHelmFunc(
6565
)
6666
}
6767

68+
tolerations, err := helm.WithTolerationWorkspaceComponentNotReadyYaml(cfg)
69+
if err != nil {
70+
return nil, err
71+
}
72+
tolerationsTemplate, err := helm.KeyFileValue("docker-registry.tolerations", tolerations)
73+
if err != nil {
74+
return nil, err
75+
}
76+
6877
registryValues = append(registryValues, helm.KeyValue("docker-registry.persistence.enabled", enablePersistence))
6978

7079
return &common.HelmConfig{
7180
Enabled: inCluster,
7281
Values: &values.Options{
7382
Values: registryValues,
83+
// This is too complex to be sent as a string
84+
FileValues: []string{
85+
tolerationsTemplate,
86+
},
7487
},
7588
}, nil
7689
}),

install/installer/pkg/components/ide-metrics/deployment.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
120120
},
121121
*common.KubeRBACProxyContainerWithConfig(ctx),
122122
},
123-
Volumes: volumes,
123+
Volumes: volumes,
124+
Tolerations: common.WithTolerationWorkspaceComponentNotReady(ctx),
124125
},
125126
},
126127
},

install/installer/pkg/components/ide-proxy/deployment.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
8282
TimeoutSeconds: 1,
8383
},
8484
}},
85+
Tolerations: common.WithTolerationWorkspaceComponentNotReady(ctx),
8586
},
8687
},
8788
},

0 commit comments

Comments
 (0)