Skip to content

Commit 89e82fd

Browse files
committed
Different config map for Leader Election per deployment
Change configmap for leader election. This is so that we can apply changes per deployment. Also changed resolvers leader election name so that we can avoid conflict with controllers config if we install in same namespace.
1 parent 6a857f7 commit 89e82fd

10 files changed

+114
-10
lines changed

config/200-role.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ rules:
2929
- apiGroups: [""]
3030
resources: ["configmaps"]
3131
verbs: ["get"]
32-
resourceNames: ["config-logging", "config-observability", "feature-flags", "config-leader-election", "config-registry-cert"]
32+
resourceNames: ["config-logging", "config-observability", "feature-flags", "config-leader-election-controller", "config-registry-cert"]
3333
---
3434
kind: Role
3535
apiVersion: rbac.authorization.k8s.io/v1
@@ -48,7 +48,7 @@ rules:
4848
- apiGroups: [""]
4949
resources: ["configmaps"]
5050
verbs: ["get"]
51-
resourceNames: ["config-logging", "config-observability", "config-leader-election", "feature-flags"]
51+
resourceNames: ["config-logging", "config-observability", "config-leader-election-webhook", "feature-flags"]
5252
- apiGroups: [""]
5353
resources: ["secrets"]
5454
verbs: ["list", "watch"]
@@ -77,7 +77,7 @@ rules:
7777
- apiGroups: [""]
7878
resources: ["configmaps"]
7979
verbs: ["get"]
80-
resourceNames: ["config-logging", "config-observability", "feature-flags", "config-leader-election", "config-registry-cert"]
80+
resourceNames: ["config-logging", "config-observability", "feature-flags", "config-leader-election-events", "config-registry-cert"]
8181
---
8282
kind: Role
8383
apiVersion: rbac.authorization.k8s.io/v1

config/config-leader-election.yaml renamed to config/config-leader-election-controller.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
apiVersion: v1
1616
kind: ConfigMap
1717
metadata:
18-
name: config-leader-election
18+
name: config-leader-election-controller
1919
namespace: tekton-pipelines
2020
labels:
2121
app.kubernetes.io/instance: default
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright 2023 Tekton Authors LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: v1
16+
kind: ConfigMap
17+
metadata:
18+
name: config-leader-election-events
19+
namespace: tekton-pipelines
20+
labels:
21+
app.kubernetes.io/instance: default
22+
app.kubernetes.io/part-of: tekton-pipelines
23+
data:
24+
_example: |
25+
################################
26+
# #
27+
# EXAMPLE CONFIGURATION #
28+
# #
29+
################################
30+
# This block is not actually functional configuration,
31+
# but serves to illustrate the available configuration
32+
# options and document them in a way that is accessible
33+
# to users that `kubectl edit` this config map.
34+
#
35+
# These sample configuration options may be copied out of
36+
# this example block and unindented to be in the data block
37+
# to actually change the configuration.
38+
# lease-duration is how long non-leaders will wait to try to acquire the
39+
# lock; 15 seconds is the value used by core kubernetes controllers.
40+
lease-duration: "60s"
41+
# renew-deadline is how long a leader will try to renew the lease before
42+
# giving up; 10 seconds is the value used by core kubernetes controllers.
43+
renew-deadline: "40s"
44+
# retry-period is how long the leader election client waits between tries of
45+
# actions; 2 seconds is the value used by core kubernetes controllers.
46+
retry-period: "10s"
47+
# buckets is the number of buckets used to partition key space of each
48+
# Reconciler. If this number is M and the replica number of the controller
49+
# is N, the N replicas will compete for the M buckets. The owner of a
50+
# bucket will take care of the reconciling for the keys partitioned into
51+
# that bucket.
52+
buckets: "1"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright 2023 Tekton Authors LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: v1
16+
kind: ConfigMap
17+
metadata:
18+
name: config-leader-election-webhook
19+
namespace: tekton-pipelines
20+
labels:
21+
app.kubernetes.io/instance: default
22+
app.kubernetes.io/part-of: tekton-pipelines
23+
data:
24+
_example: |
25+
################################
26+
# #
27+
# EXAMPLE CONFIGURATION #
28+
# #
29+
################################
30+
# This block is not actually functional configuration,
31+
# but serves to illustrate the available configuration
32+
# options and document them in a way that is accessible
33+
# to users that `kubectl edit` this config map.
34+
#
35+
# These sample configuration options may be copied out of
36+
# this example block and unindented to be in the data block
37+
# to actually change the configuration.
38+
# lease-duration is how long non-leaders will wait to try to acquire the
39+
# lock; 15 seconds is the value used by core kubernetes controllers.
40+
lease-duration: "60s"
41+
# renew-deadline is how long a leader will try to renew the lease before
42+
# giving up; 10 seconds is the value used by core kubernetes controllers.
43+
renew-deadline: "40s"
44+
# retry-period is how long the leader election client waits between tries of
45+
# actions; 2 seconds is the value used by core kubernetes controllers.
46+
retry-period: "10s"
47+
# buckets is the number of buckets used to partition key space of each
48+
# Reconciler. If this number is M and the replica number of the controller
49+
# is N, the N replicas will compete for the M buckets. The owner of a
50+
# bucket will take care of the reconciling for the keys partitioned into
51+
# that bucket.
52+
buckets: "1"

config/controller.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ spec:
101101
- name: CONFIG_FEATURE_FLAGS_NAME
102102
value: feature-flags
103103
- name: CONFIG_LEADERELECTION_NAME
104-
value: config-leader-election
104+
value: config-leader-election-controller
105105
- name: CONFIG_SPIRE
106106
value: config-spire
107107
- name: SSL_CERT_FILE

config/events.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ spec:
8383
- name: CONFIG_OBSERVABILITY_NAME
8484
value: config-observability
8585
- name: CONFIG_LEADERELECTION_NAME
86-
value: config-leader-election
86+
value: config-leader-election-events
8787
- name: SSL_CERT_FILE
8888
value: /etc/config-registry-cert/cert
8989
- name: SSL_CERT_DIR

config/resolvers/config-leader-election.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
apiVersion: v1
1616
kind: ConfigMap
1717
metadata:
18-
name: config-leader-election
18+
name: config-leader-election-resolvers
1919
namespace: tekton-pipelines-resolvers
2020
labels:
2121
app.kubernetes.io/component: resolvers

config/resolvers/resolvers-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ spec:
8989
- name: CONFIG_FEATURE_FLAGS_NAME
9090
value: feature-flags
9191
- name: CONFIG_LEADERELECTION_NAME
92-
value: config-leader-election
92+
value: config-leader-election-resolvers
9393
- name: METRICS_DOMAIN
9494
value: tekton.dev/resolution
9595
# Override this env var to set a private hub api endpoint

config/webhook.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ spec:
9898
- name: CONFIG_OBSERVABILITY_NAME
9999
value: config-observability
100100
- name: CONFIG_LEADERELECTION_NAME
101-
value: config-leader-election
101+
value: config-leader-election-webhook
102102
- name: CONFIG_FEATURE_FLAGS_NAME
103103
value: feature-flags
104104
# If you change PROBES_PORT, you will also need to change the

docs/enabling-ha.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ kubectl -n tekton-pipelines scale deployment tekton-pipelines-controller --repli
3838

3939
### Configuring Leader Election
4040

41-
Leader election can be configured in [config-leader-election.yaml](./../config/config-leader-election.yaml). The ConfigMap defines the following parameters:
41+
Leader election can be configured in [config-leader-election.yaml](./../config/config-leader-election-controller.yaml). The ConfigMap defines the following parameters:
4242

4343
| Parameter | Default |
4444
| -------------------- | -------- |

0 commit comments

Comments
 (0)