Skip to content

Commit

Permalink
GCP fleet sync controller (#4043)
Browse files Browse the repository at this point in the history
* [WIP] Sync GCP fleet memberships into KRM resources

Signed-off-by: John Belamaric <jbelamaric@google.com>

* 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 <jbelamaric@google.com>

* Add polling of scopes and bindings; not yet reconciled

Signed-off-by: John Belamaric <jbelamaric@google.com>

* Refactor polling

Signed-off-by: John Belamaric <jbelamaric@google.com>

* Add reconciliation of scopes and membership bindings

Signed-off-by: John Belamaric <jbelamaric@google.com>

* Fix missing printf arg

Signed-off-by: John Belamaric <jbelamaric@google.com>

* Add more labels, Scope field

Signed-off-by: John Belamaric <jbelamaric@google.com>

---------

Signed-off-by: John Belamaric <jbelamaric@google.com>
Co-authored-by: Morten Torkildsen <mortent@google.com>
  • Loading branch information
johnbelamaric and mortent committed Sep 27, 2023
1 parent 9f1149a commit c0f855a
Show file tree
Hide file tree
Showing 21 changed files with 2,494 additions and 53 deletions.
2 changes: 1 addition & 1 deletion porch/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ TEST_GIT_SERVER_IMAGE ?= test-git-server
# Only enable a subset of reconcilers in porch controllers by default. Use the RECONCILERS
# env variable to specify a specific list of reconcilers or use
# RECONCILERS=* to enable all known reconcilers.
ALL_RECONCILERS="rootsyncsets,remoterootsyncsets,workloadidentitybindings,rootsyncdeployments,functiondiscovery,packagevariants,packagevariantsets,rootsyncrollouts"
ALL_RECONCILERS="rootsyncsets,remoterootsyncsets,workloadidentitybindings,rootsyncdeployments,functiondiscovery,packagevariants,packagevariantsets,rootsyncrollouts,fleetsyncs"
ifndef RECONCILERS
ENABLED_RECONCILERS="rootsyncsets,remoterootsyncsets,workloadidentitybindings,functiondiscovery,packagevariants,packagevariantsets"
else
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Copyright 2023 The kpt Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
creationTimestamp: null
name: fleetmembershipbindings.config.porch.kpt.dev
spec:
group: config.porch.kpt.dev
names:
kind: FleetMembershipBinding
listKind: FleetMembershipBindingList
plural: fleetmembershipbindings
singular: fleetmembershipbinding
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
data:
description: Data contains the discovered (synced) information
properties:
binding:
type: string
labels:
additionalProperties:
type: string
type: object
location:
type: string
membership:
type: string
name:
type: string
project:
type: string
scope:
type: string
scopeFullName:
type: string
scopeLocation:
type: string
scopeProject:
type: string
state:
properties:
code:
type: string
type: object
required:
- membership
type: object
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
status:
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Copyright 2023 The kpt Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
creationTimestamp: null
name: fleetmemberships.config.porch.kpt.dev
spec:
group: config.porch.kpt.dev
names:
kind: FleetMembership
listKind: FleetMembershipList
plural: fleetmemberships
singular: fleetmembership
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
data:
description: Data contains the discovered (synced) information
properties:
description:
type: string
fullName:
type: string
labels:
additionalProperties:
type: string
type: object
location:
type: string
membership:
type: string
project:
type: string
state:
properties:
code:
type: string
type: object
type: object
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
status:
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Copyright 2023 The kpt Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
creationTimestamp: null
name: fleetscopes.config.porch.kpt.dev
spec:
group: config.porch.kpt.dev
names:
kind: FleetScope
listKind: FleetScopeList
plural: fleetscopes
singular: fleetscope
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
data:
description: Data contains the discovered (synced) information
properties:
fullName:
type: string
labels:
additionalProperties:
type: string
type: object
location:
type: string
project:
type: string
scope:
type: string
state:
properties:
code:
type: string
type: object
type: object
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
status:
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Loading

0 comments on commit c0f855a

Please sign in to comment.