Skip to content
This repository was archived by the owner on Oct 28, 2024. It is now read-only.

Commit 163817c

Browse files
fix nestedcomponent bugs (#42)
1 parent cc0d391 commit 163817c

23 files changed

+79
-186
lines changed

apis/controlplane/v1alpha4/nestedapiserver_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type NestedAPIServerStatus struct {
4141
}
4242

4343
//+kubebuilder:object:root=true
44-
//+kubebuilder:resource:scope=Namespaced,path=nestedapiservers,shortName=napiserver
44+
//+kubebuilder:resource:scope=Namespaced,path=nestedapiservers,shortName=nkas
4545
//+kubebuilder:categories=capi,capn
4646
//+kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase"
4747
//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"

apis/controlplane/v1alpha4/nestedcontrollermanager_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ type NestedControllerManagerStatus struct {
3636
}
3737

3838
//+kubebuilder:object:root=true
39+
//+kubebuilder:resource:scope=Namespaced,path=nestedcontrollermanager,shortName=nkcm
40+
//+kubebuilder:categories=capi,capn
41+
//+kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase"
42+
//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
3943
//+kubebuilder:subresource:status
4044

4145
// NestedControllerManager is the Schema for the nestedcontrollermanagers API

config/component-templates/nested-apiserver/nested-apiserver-statefulset-template.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ spec:
7272
timeoutSeconds: 30
7373
volumeMounts:
7474
- mountPath: /etc/kubernetes/pki/apiserver
75-
name: {{.nestedControlPlaneName}}-apiserver-client-crt
75+
name: {{.nestedControlPlaneName}}-apiserver
7676
readOnly: true
7777
- mountPath: /etc/kubernetes/pki/root
78-
name: {{.nestedControlPlaneName}}-apiserver
78+
name: {{.nestedControlPlaneName}}-ca
7979
readOnly: true
8080
- mountPath: /etc/kubernetes/pki/service-account
8181
name: {{.nestedControlPlaneName}}-sa
@@ -85,14 +85,14 @@ spec:
8585
searches:
8686
- cluster.local
8787
volumes:
88-
- name: {{.nestedControlPlaneName}}-apiserver-client-crt
89-
secret:
90-
defaultMode: 420
91-
secretName: {{.nestedControlPlaneName}}-apiserver-client-crt
9288
- name: {{.nestedControlPlaneName}}-apiserver
9389
secret:
9490
defaultMode: 420
9591
secretName: {{.nestedControlPlaneName}}-apiserver
92+
- name: {{.nestedControlPlaneName}}-ca
93+
secret:
94+
defaultMode: 420
95+
secretName: {{.nestedControlPlaneName}}-ca
9696
- name: {{.nestedControlPlaneName}}-sa
9797
secret:
9898
defaultMode: 420

config/component-templates/nested-controllermanager/nested-controllermanager-statefulset-template.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ spec:
5757
timeoutSeconds: 15
5858
volumeMounts:
5959
- mountPath: /etc/kubernetes/pki/root
60-
name: {{.nestedControlPlaneName}}-apiserver
60+
name: {{.nestedControlPlaneName}}-ca
6161
readOnly: true
6262
- mountPath: /etc/kubernetes/pki/service-account
6363
name: {{.nestedControlPlaneName}}-sa
@@ -66,10 +66,10 @@ spec:
6666
name: {{.nestedControllerManagerName}}-kubeconfig
6767
readOnly: true
6868
volumes:
69-
- name: {{.nestedControlPlaneName}}-apiserver
69+
- name: {{.nestedControlPlaneName}}-ca
7070
secret:
7171
defaultMode: 420
72-
secretName: {{.nestedControlPlaneName}}-apiserver
72+
secretName: {{.nestedControlPlaneName}}-ca
7373
- name: {{.nestedControlPlaneName}}-sa
7474
secret:
7575
defaultMode: 420
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
apiVersion: v1
22
kind: Service
33
metadata:
4-
name: {{.nestedetcdName}}
5-
namespace: {{.nestedetcdNamespace}}
4+
name: {{.nestedEtcdName}}
5+
namespace: {{.nestedEtcdNamespace}}
66
labels:
7-
component-name: {{.nestedetcdName}}
7+
component-name: {{.nestedEtcdName}}
88
spec:
99
publishNotReadyAddresses: true
1010
clusterIP: None
1111
selector:
12-
component-name: {{.nestedetcdName}}
12+
component-name: {{.nestedEtcdName}}

config/component-templates/nested-etcd/nested-etcd-statefulset-template.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,17 @@ spec:
7070
timeoutSeconds: 15
7171
volumeMounts:
7272
- mountPath: /etc/kubernetes/pki/etcd
73-
name: {{.nestedControlPlaneName}}-etcd-client-cert
73+
name: {{.nestedControlPlaneName}}-etcd
7474
readOnly: true
7575
- mountPath: /etc/kubernetes/pki/root
76-
name: {{.nestedControlPlaneName}}-etcd
76+
name: {{.nestedControlPlaneName}}-ca
7777
readOnly: true
7878
volumes:
79-
- name: {{.nestedControlPlaneName}}-etcd-client-cert
80-
secret:
81-
defaultMode: 420
82-
secretName: {{.nestedControlPlaneName}}-etcd-client-cert
8379
- name: {{.nestedControlPlaneName}}-etcd
8480
secret:
8581
defaultMode: 420
8682
secretName: {{.nestedControlPlaneName}}-etcd
83+
- name: {{.nestedControlPlaneName}}-ca
84+
secret:
85+
defaultMode: 420
86+
secretName: {{.nestedControlPlaneName}}-ca

config/crd/bases/controlplane.cluster.x-k8s.io_nestedapiservers.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ spec:
1414
listKind: NestedAPIServerList
1515
plural: nestedapiservers
1616
shortNames:
17-
- napiserver
17+
- nkas
1818
singular: nestedapiserver
1919
scope: Namespaced
2020
versions:

config/crd/bases/controlplane.cluster.x-k8s.io_nestedcontrollermanagers.yaml renamed to config/crd/bases/controlplane.cluster.x-k8s.io_nestedcontrollermanager.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,26 @@ metadata:
66
annotations:
77
controller-gen.kubebuilder.io/version: v0.4.1-0.20201002000720-57250aac17f6
88
creationTimestamp: null
9-
name: nestedcontrollermanagers.controlplane.cluster.x-k8s.io
9+
name: nestedcontrollermanager.controlplane.cluster.x-k8s.io
1010
spec:
1111
group: controlplane.cluster.x-k8s.io
1212
names:
1313
kind: NestedControllerManager
1414
listKind: NestedControllerManagerList
15-
plural: nestedcontrollermanagers
15+
plural: nestedcontrollermanager
16+
shortNames:
17+
- nkcm
1618
singular: nestedcontrollermanager
1719
scope: Namespaced
1820
versions:
19-
- name: v1alpha4
21+
- additionalPrinterColumns:
22+
- jsonPath: .status.phase
23+
name: Phase
24+
type: string
25+
- jsonPath: .metadata.creationTimestamp
26+
name: Age
27+
type: date
28+
name: v1alpha4
2029
schema:
2130
openAPIV3Schema:
2231
description: NestedControllerManager is the Schema for the nestedcontrollermanagers API

config/crd/kustomization.yaml

Lines changed: 0 additions & 30 deletions
This file was deleted.

config/crd/kustomizeconfig.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

config/crd/patches/cainjection_in_nestedapiservers.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

config/crd/patches/cainjection_in_nestedcontrollermanagers.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

config/crd/patches/cainjection_in_nestedcontrolplanes.yaml

Lines changed: 0 additions & 8 deletions
This file was deleted.

config/crd/patches/cainjection_in_nestedetcds.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

config/crd/patches/webhook_in_nestedapiservers.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

config/crd/patches/webhook_in_nestedcontrollermanagers.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

config/crd/patches/webhook_in_nestedcontrolplanes.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

config/crd/patches/webhook_in_nestedetcds.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

controllers/controlplane/consts.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,22 @@ limitations under the License.
1717
package controlplane
1818

1919
const (
20-
statefulsetOwnerKey = ".metadata.controller"
20+
statefulsetOwnerKeyNEtcd = ".metadata.netcd.controller"
21+
statefulsetOwnerKeyNKas = ".metadata.nkas.controller"
22+
statefulsetOwnerKeyNKcm = ".metadata.nkcm.controller"
2123
defaultEtcdStatefulSetURL = "https://raw.githubusercontent.com/kubernetes-sigs/" +
2224
"cluster-api-provider-nested/master/config/component-templates/" +
23-
"nestedetcd/nested-etcd-statefulset-template.yaml"
25+
"nested-etcd/nested-etcd-statefulset-template.yaml"
2426
defaultEtcdServiceURL = "https://raw.githubusercontent.com/kubernetes-sigs/" +
2527
"cluster-api-provider-nested/master/config/component-templates/" +
26-
"nestedetcd/nested-etcd-service-template.yaml"
28+
"nested-etcd/nested-etcd-service-template.yaml"
2729
defaultKASStatefulSetURL = "https://raw.githubusercontent.com/kubernetes-sigs/" +
2830
"cluster-api-provider-nested/master/config/component-templates/" +
29-
"nestedetcd/nested-apiserver-statefulset-template.yaml"
31+
"nested-apiserver/nested-apiserver-statefulset-template.yaml"
3032
defaultKASServiceURL = "https://raw.githubusercontent.com/kubernetes-sigs/" +
3133
"cluster-api-provider-nested/master/config/component-templates/" +
32-
"nestedetcd/nested-apiserver-service-template.yaml"
34+
"nested-apiserver/nested-apiserver-service-template.yaml"
35+
defaultKCMStatefulSetURL = "https://raw.githubusercontent.com/kubernetes-sigs/" +
36+
"cluster-api-provider-nested/master/config/component-templates/" +
37+
"nested-controllermanager/nested-controllermanager-statefulset-template.yaml"
3338
)

0 commit comments

Comments
 (0)