Skip to content

Commit 4fc829b

Browse files
committed
[ws-manager-mk2] Configure leader election
1 parent 75f43c1 commit 4fc829b

File tree

3 files changed

+41
-3
lines changed

3 files changed

+41
-3
lines changed

components/ws-manager-mk2/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func main() {
8989
Port: 9443,
9090
HealthProbeBindAddress: ":9090",
9191
LeaderElection: enableLeaderElection,
92-
LeaderElectionID: "0616d21e.gitpod.io",
92+
LeaderElectionID: "ws-manager-mk2.gitpod.io",
9393
Namespace: cfg.Manager.Namespace,
9494
})
9595
if err != nil {

install/installer/pkg/components/ws-manager-mk2/deployment.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
5353
RunAsUser: pointer.Int64(31002),
5454
},
5555
Containers: []corev1.Container{{
56-
Name: Component,
57-
Args: []string{"--config", "/config/config.json"},
56+
Name: Component,
57+
Args: []string{
58+
"--config", "/config/config.json",
59+
"--leader-elect",
60+
},
5861
Image: ctx.ImageName(ctx.Config.Repository, Component, ctx.VersionManifest.Components.WSManagerMk2.Version),
5962
ImagePullPolicy: corev1.PullIfNotPresent,
6063
Resources: common.ResourceRequirements(ctx, Component, Component, corev1.ResourceRequirements{

install/installer/pkg/components/ws-manager-mk2/role.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,41 @@ func role(ctx *common.RenderContext) ([]runtime.Object, error) {
6969
"update",
7070
},
7171
},
72+
// ConfigMap, Leases, and Events access is required for leader-election.
73+
{
74+
APIGroups: []string{""},
75+
Resources: []string{"configmaps"},
76+
Verbs: []string{
77+
"create",
78+
"delete",
79+
"get",
80+
"list",
81+
"patch",
82+
"update",
83+
"watch",
84+
},
85+
},
86+
{
87+
APIGroups: []string{"coordination.k8s.io"},
88+
Resources: []string{"leases"},
89+
Verbs: []string{
90+
"create",
91+
"delete",
92+
"get",
93+
"list",
94+
"patch",
95+
"update",
96+
"watch",
97+
},
98+
},
99+
{
100+
APIGroups: []string{""},
101+
Resources: []string{"events"},
102+
Verbs: []string{
103+
"create",
104+
"patch",
105+
},
106+
},
72107
},
73108
},
74109
}, nil

0 commit comments

Comments
 (0)