Skip to content

Commit cea1d4e

Browse files
authored
Merge pull request kubernetes#94205 from jiahuif/cm-migration-config
add configuration for controller migration.
2 parents 8f09fcd + 5e4f445 commit cea1d4e

File tree

8 files changed

+329
-2
lines changed

8 files changed

+329
-2
lines changed

staging/publishing/rules.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,6 +1640,9 @@ rules:
16401640
branch: master
16411641
dir: staging/src/k8s.io/controller-manager
16421642
name: master
1643+
dependencies:
1644+
- repository: apimachinery
1645+
branch: master
16431646
- source:
16441647
branch: release-1.19
16451648
dir: staging/src/k8s.io/controller-manager

staging/src/k8s.io/controller-manager/BUILD

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ filegroup(
2121

2222
filegroup(
2323
name = "all-srcs",
24-
srcs = [":package-srcs"],
24+
srcs = [
25+
":package-srcs",
26+
"//staging/src/k8s.io/controller-manager/config:all-srcs",
27+
],
2528
tags = ["automanaged"],
2629
visibility = ["//visibility:public"],
2730
)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
load("@io_bazel_rules_go//go:def.bzl", "go_library")
2+
3+
go_library(
4+
name = "go_default_library",
5+
srcs = ["types.go"],
6+
importmap = "k8s.io/kubernetes/vendor/k8s.io/controller-manager/config",
7+
importpath = "k8s.io/controller-manager/config",
8+
visibility = ["//visibility:public"],
9+
deps = ["//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library"],
10+
)
11+
12+
filegroup(
13+
name = "package-srcs",
14+
srcs = glob(["**"]),
15+
tags = ["automanaged"],
16+
visibility = ["//visibility:private"],
17+
)
18+
19+
filegroup(
20+
name = "all-srcs",
21+
srcs = [
22+
":package-srcs",
23+
"//staging/src/k8s.io/controller-manager/config/v1alpha1:all-srcs",
24+
],
25+
tags = ["automanaged"],
26+
visibility = ["//visibility:public"],
27+
)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
Copyright 2020 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package config
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
// LeaderMigrationConfiguration provides versioned configuration for all migrating leader locks.
24+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
25+
type LeaderMigrationConfiguration struct {
26+
metav1.TypeMeta
27+
28+
// LeaderName is the name of the leader election resource that protects the migration
29+
// E.g. 1-20-KCM-to-1-21-CCM
30+
LeaderName string
31+
32+
// ResourceLock indicates the resource object type that will be used to lock
33+
// Should be "leases" or "endpoints"
34+
ResourceLock string
35+
36+
// ControllerLeaders contains a list of migrating leader lock configurations
37+
ControllerLeaders []ControllerLeaderConfiguration
38+
}
39+
40+
// ControllerLeaderConfiguration provides the configuration for a migrating leader lock.
41+
type ControllerLeaderConfiguration struct {
42+
// Name is the name of the controller being migrated
43+
// E.g. service-controller, route-controller, cloud-node-controller, etc
44+
Name string
45+
46+
// Component is the name of the component in which the controller should be running.
47+
// E.g. kube-controller-manager, cloud-controller-manager, etc
48+
Component string
49+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
load("@io_bazel_rules_go//go:def.bzl", "go_library")
2+
3+
go_library(
4+
name = "go_default_library",
5+
srcs = ["types.go"],
6+
importmap = "k8s.io/kubernetes/vendor/k8s.io/controller-manager/config/v1alpha1",
7+
importpath = "k8s.io/controller-manager/config/v1alpha1",
8+
visibility = ["//visibility:public"],
9+
deps = ["//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library"],
10+
)
11+
12+
filegroup(
13+
name = "package-srcs",
14+
srcs = glob(["**"]),
15+
tags = ["automanaged"],
16+
visibility = ["//visibility:private"],
17+
)
18+
19+
filegroup(
20+
name = "all-srcs",
21+
srcs = [":package-srcs"],
22+
tags = ["automanaged"],
23+
visibility = ["//visibility:public"],
24+
)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
Copyright 2020 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package config
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
// LeaderMigrationConfiguration provides versioned configuration for all migrating leader locks.
24+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
25+
type LeaderMigrationConfiguration struct {
26+
metav1.TypeMeta `json:",inline"`
27+
28+
// LeaderName is the name of the leader election resource that protects the migration
29+
// E.g. 1-20-KCM-to-1-21-CCM
30+
LeaderName string `json:"leaderName"`
31+
32+
// ResourceLock indicates the resource object type that will be used to lock
33+
// Should be "leases" or "endpoints"
34+
ResourceLock string `json:"resourceLock"`
35+
36+
// ControllerLeaders contains a list of migrating leader lock configurations
37+
ControllerLeaders []ControllerLeaderConfiguration `json:"controllerLeaders"`
38+
}
39+
40+
// ControllerLeaderConfiguration provides the configuration for a migrating leader lock.
41+
type ControllerLeaderConfiguration struct {
42+
// Name is the name of the controller being migrated
43+
// E.g. service-controller, route-controller, cloud-node-controller, etc
44+
Name string `json:"name"`
45+
46+
// Component is the name of the component in which the controller should be running.
47+
// E.g. kube-controller-manager, cloud-controller-manager, etc
48+
Component string `json:"component"`
49+
}

staging/src/k8s.io/controller-manager/go.mod

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ module k8s.io/controller-manager
44

55
go 1.15
66

7-
replace k8s.io/controller-manager => ../controller-manager
7+
require k8s.io/apimachinery v0.0.0
8+
9+
replace (
10+
k8s.io/apimachinery => ../apimachinery
11+
k8s.io/controller-manager => ../controller-manager
12+
)

0 commit comments

Comments
 (0)