Skip to content

Commit

Permalink
Additional fleet data
Browse files Browse the repository at this point in the history
- 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>
  • Loading branch information
johnbelamaric committed Sep 20, 2023
1 parent 5529eb7 commit 470449b
Show file tree
Hide file tree
Showing 10 changed files with 730 additions and 89 deletions.
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
Expand Up @@ -38,27 +38,36 @@ spec:
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
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
spec:
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
Expand Down
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: []
21 changes: 13 additions & 8 deletions porch/controllers/fleetsyncs/api/v1alpha1/fleetmembership_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

type FleetMembershipSpec struct {
type FleetMembershipData struct {
FullName string `json:"fullName,omitempty"`
Project string `json:"project,omitempty"`
Location string `json:"location,omitempty"`
Membership string `json:"membership,omitempty"`
Description string `json:"description,omitempty"`

Labels map[string]string `json:"labels,omitempty"`
Expand All @@ -33,12 +37,12 @@ type MembershipState struct {
type MembershipStateCode string

const (
CodeUnspecified MembershipStateCode = "unspecified"
CodeCreating MembershipStateCode = "creating"
CodeReady MembershipStateCode = "ready"
CodeDeleting MembershipStateCode = "deleting"
CodeUpdating MembershipStateCode = "updating"
CodeServiceUpdating MembershipStateCode = "serviceupdating"
MSCodeUnspecified MembershipStateCode = "unspecified"
MSCodeCreating MembershipStateCode = "creating"
MSCodeReady MembershipStateCode = "ready"
MSCodeDeleting MembershipStateCode = "deleting"
MSCodeUpdating MembershipStateCode = "updating"
MSCodeServiceUpdating MembershipStateCode = "serviceupdating"
)

type FleetMembershipStatus struct {
Expand All @@ -51,7 +55,8 @@ type FleetMembership struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec FleetMembershipSpec `json:"spec,omitempty"`
// Data contains the discovered (synced) information
Data FleetMembershipData `json:"data,omitempty"`
Status FleetMembershipStatus `json:"status,omitempty"`
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// 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.

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

type FleetMembershipBindingData struct {
FullName string `json:"name,omitempty"`
Project string `json:"project,omitempty"`
Location string `json:"location,omitempty"`
Membership string `json:"membership",omitempty"`
Binding string `json:"binding,omitempty"`

ScopeFullName string `json:"scopeFullName,omitempty"`
ScopeProject string `json:"scopeProject,omitempty"`
ScopeLocation string `json:"scopeLocation,omitempty"`
Scope string `json:"scope,omitempty"`

Labels map[string]string `json:"labels,omitempty"`

State MembershipBindingState `json:"state,omitempty"`
}

type MembershipBindingState struct {
Code MembershipBindingStateCode `json:"code,omitempty"`
}

type MembershipBindingStateCode string

const (
MBSCodeUnspecified MembershipBindingStateCode = "unspecified"
MBSCodeCreating MembershipBindingStateCode = "creating"
MBSCodeReady MembershipBindingStateCode = "ready"
MBSCodeDeleting MembershipBindingStateCode = "deleting"
MBSCodeUpdating MembershipBindingStateCode = "updating"
)

type FleetMembershipBindingStatus struct {
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

type FleetMembershipBinding struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// Data contains the discovered (synced) information
Data FleetMembershipBindingData `json:"data,omitempty"`
Status FleetMembershipBindingStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

type FleetMembershipBindingList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []FleetMembershipBinding `json:"items"`
}

func init() {
SchemeBuilder.Register(&FleetMembershipBinding{}, &FleetMembershipBindingList{})
}
Loading

0 comments on commit 470449b

Please sign in to comment.