Skip to content

Commit c0f855a

Browse files
GCP fleet sync controller (#4043)
* [WIP] Sync GCP fleet memberships into KRM resources Signed-off-by: John Belamaric <[email protected]> * Additional fleet data - Rename `spec` to `data` since this is discovered data, not spec - Add resources for scopes and membership bindings - Add additional fields Signed-off-by: John Belamaric <[email protected]> * Add polling of scopes and bindings; not yet reconciled Signed-off-by: John Belamaric <[email protected]> * Refactor polling Signed-off-by: John Belamaric <[email protected]> * Add reconciliation of scopes and membership bindings Signed-off-by: John Belamaric <[email protected]> * Fix missing printf arg Signed-off-by: John Belamaric <[email protected]> * Add more labels, Scope field Signed-off-by: John Belamaric <[email protected]> --------- Signed-off-by: John Belamaric <[email protected]> Co-authored-by: Morten Torkildsen <[email protected]>
1 parent 9f1149a commit c0f855a

21 files changed

+2494
-53
lines changed

porch/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ TEST_GIT_SERVER_IMAGE ?= test-git-server
5050
# Only enable a subset of reconcilers in porch controllers by default. Use the RECONCILERS
5151
# env variable to specify a specific list of reconcilers or use
5252
# RECONCILERS=* to enable all known reconcilers.
53-
ALL_RECONCILERS="rootsyncsets,remoterootsyncsets,workloadidentitybindings,rootsyncdeployments,functiondiscovery,packagevariants,packagevariantsets,rootsyncrollouts"
53+
ALL_RECONCILERS="rootsyncsets,remoterootsyncsets,workloadidentitybindings,rootsyncdeployments,functiondiscovery,packagevariants,packagevariantsets,rootsyncrollouts,fleetsyncs"
5454
ifndef RECONCILERS
5555
ENABLED_RECONCILERS="rootsyncsets,remoterootsyncsets,workloadidentitybindings,functiondiscovery,packagevariants,packagevariantsets"
5656
else
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Copyright 2023 The kpt Authors
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+
# http://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+
---
16+
apiVersion: apiextensions.k8s.io/v1
17+
kind: CustomResourceDefinition
18+
metadata:
19+
annotations:
20+
controller-gen.kubebuilder.io/version: v0.8.0
21+
creationTimestamp: null
22+
name: fleetmembershipbindings.config.porch.kpt.dev
23+
spec:
24+
group: config.porch.kpt.dev
25+
names:
26+
kind: FleetMembershipBinding
27+
listKind: FleetMembershipBindingList
28+
plural: fleetmembershipbindings
29+
singular: fleetmembershipbinding
30+
scope: Namespaced
31+
versions:
32+
- name: v1alpha1
33+
schema:
34+
openAPIV3Schema:
35+
properties:
36+
apiVersion:
37+
description: 'APIVersion defines the versioned schema of this representation
38+
of an object. Servers should convert recognized schemas to the latest
39+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
40+
type: string
41+
data:
42+
description: Data contains the discovered (synced) information
43+
properties:
44+
binding:
45+
type: string
46+
labels:
47+
additionalProperties:
48+
type: string
49+
type: object
50+
location:
51+
type: string
52+
membership:
53+
type: string
54+
name:
55+
type: string
56+
project:
57+
type: string
58+
scope:
59+
type: string
60+
scopeFullName:
61+
type: string
62+
scopeLocation:
63+
type: string
64+
scopeProject:
65+
type: string
66+
state:
67+
properties:
68+
code:
69+
type: string
70+
type: object
71+
required:
72+
- membership
73+
type: object
74+
kind:
75+
description: 'Kind is a string value representing the REST resource this
76+
object represents. Servers may infer this from the endpoint the client
77+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
78+
type: string
79+
metadata:
80+
type: object
81+
status:
82+
type: object
83+
type: object
84+
served: true
85+
storage: true
86+
subresources:
87+
status: {}
88+
status:
89+
acceptedNames:
90+
kind: ""
91+
plural: ""
92+
conditions: []
93+
storedVersions: []
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Copyright 2023 The kpt Authors
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+
# http://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+
---
16+
apiVersion: apiextensions.k8s.io/v1
17+
kind: CustomResourceDefinition
18+
metadata:
19+
annotations:
20+
controller-gen.kubebuilder.io/version: v0.8.0
21+
creationTimestamp: null
22+
name: fleetmemberships.config.porch.kpt.dev
23+
spec:
24+
group: config.porch.kpt.dev
25+
names:
26+
kind: FleetMembership
27+
listKind: FleetMembershipList
28+
plural: fleetmemberships
29+
singular: fleetmembership
30+
scope: Namespaced
31+
versions:
32+
- name: v1alpha1
33+
schema:
34+
openAPIV3Schema:
35+
properties:
36+
apiVersion:
37+
description: 'APIVersion defines the versioned schema of this representation
38+
of an object. Servers should convert recognized schemas to the latest
39+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
40+
type: string
41+
data:
42+
description: Data contains the discovered (synced) information
43+
properties:
44+
description:
45+
type: string
46+
fullName:
47+
type: string
48+
labels:
49+
additionalProperties:
50+
type: string
51+
type: object
52+
location:
53+
type: string
54+
membership:
55+
type: string
56+
project:
57+
type: string
58+
state:
59+
properties:
60+
code:
61+
type: string
62+
type: object
63+
type: object
64+
kind:
65+
description: 'Kind is a string value representing the REST resource this
66+
object represents. Servers may infer this from the endpoint the client
67+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
68+
type: string
69+
metadata:
70+
type: object
71+
status:
72+
type: object
73+
type: object
74+
served: true
75+
storage: true
76+
subresources:
77+
status: {}
78+
status:
79+
acceptedNames:
80+
kind: ""
81+
plural: ""
82+
conditions: []
83+
storedVersions: []
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Copyright 2023 The kpt Authors
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+
# http://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+
---
16+
apiVersion: apiextensions.k8s.io/v1
17+
kind: CustomResourceDefinition
18+
metadata:
19+
annotations:
20+
controller-gen.kubebuilder.io/version: v0.8.0
21+
creationTimestamp: null
22+
name: fleetscopes.config.porch.kpt.dev
23+
spec:
24+
group: config.porch.kpt.dev
25+
names:
26+
kind: FleetScope
27+
listKind: FleetScopeList
28+
plural: fleetscopes
29+
singular: fleetscope
30+
scope: Namespaced
31+
versions:
32+
- name: v1alpha1
33+
schema:
34+
openAPIV3Schema:
35+
properties:
36+
apiVersion:
37+
description: 'APIVersion defines the versioned schema of this representation
38+
of an object. Servers should convert recognized schemas to the latest
39+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
40+
type: string
41+
data:
42+
description: Data contains the discovered (synced) information
43+
properties:
44+
fullName:
45+
type: string
46+
labels:
47+
additionalProperties:
48+
type: string
49+
type: object
50+
location:
51+
type: string
52+
project:
53+
type: string
54+
scope:
55+
type: string
56+
state:
57+
properties:
58+
code:
59+
type: string
60+
type: object
61+
type: object
62+
kind:
63+
description: 'Kind is a string value representing the REST resource this
64+
object represents. Servers may infer this from the endpoint the client
65+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
66+
type: string
67+
metadata:
68+
type: object
69+
status:
70+
type: object
71+
type: object
72+
served: true
73+
storage: true
74+
subresources:
75+
status: {}
76+
status:
77+
acceptedNames:
78+
kind: ""
79+
plural: ""
80+
conditions: []
81+
storedVersions: []

0 commit comments

Comments
 (0)