Skip to content

Commit

Permalink
add spacebindingrequest type to host and member operators (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfrancisc authored Aug 4, 2023
1 parent 7b55300 commit 047b143
Show file tree
Hide file tree
Showing 4 changed files with 287 additions and 2 deletions.
70 changes: 70 additions & 0 deletions api/v1alpha1/spacebindingrequest_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package v1alpha1

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

const (
// SpaceBindingRequestLabelKey is a label on the SpaceBinding, and will hold the name of the SpaceBindingRequest that created the SpaceBinding resource.
SpaceBindingRequestLabelKey = LabelKeyPrefix + "spacebindingrequest"
// SpaceBindingRequestNamespaceLabelKey is a label on the SpaceBinding, and will hold the namespace of the SpaceBindingRequest that created the SpaceBinding resource.
SpaceBindingRequestNamespaceLabelKey = LabelKeyPrefix + "spacebindingrequest-namespace"
)

// SpaceBindingRequestSpec defines the desired state of SpaceBindingRequest
// +k8s:openapi-gen=true
type SpaceBindingRequestSpec struct {
// MasterUserRecord is a required property introduced to retain the name of the MUR
// for which this SpaceBinding is provisioned.
MasterUserRecord string `json:"masterUserRecord"`

// SpaceRole is a required property which defines the role that will be granted to the MUR in the current Space by the SpaceBinding resource.
SpaceRole string `json:"spaceRole"`
}

// SpaceBindingRequestStatus defines the observed state of SpaceBinding
// +k8s:openapi-gen=true
type SpaceBindingRequestStatus struct {
// Conditions is an array of SpaceBindingRequest conditions
// Supported condition types:
// Provisioning, SpaceBindingNotReady and Ready
// +optional
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type
Conditions []Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
}

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

// SpaceBindingRequest is the Schema for the SpaceBindingRequest API
// +k8s:openapi-gen=true
// +kubebuilder:resource:scope=Namespaced
// +kubebuilder:printcolumn:name="MUR",type="string",JSONPath=`.spec.masterUserRecord`
// +kubebuilder:printcolumn:name="SpaceRole",type="string",JSONPath=`.spec.spaceRole`
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=`.status.conditions[?(@.type=="Ready")].status`
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=`.status.conditions[?(@.type=="Ready")].reason`
// +kubebuilder:validation:XPreserveUnknownFields
// +operator-sdk:gen-csv:customresourcedefinitions.displayName="SpaceBindingRequest"
type SpaceBindingRequest struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec SpaceBindingRequestSpec `json:"spec,omitempty"`
Status SpaceBindingRequestStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// SpaceBindingRequestList contains a list of SpaceBindingRequests
type SpaceBindingRequestList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []SpaceBindingRequest `json:"items"`
}

func init() {
SchemeBuilder.Register(&SpaceBindingRequest{}, &SpaceBindingRequestList{})
}
96 changes: 96 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

119 changes: 119 additions & 0 deletions api/v1alpha1/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions make/generate.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ API_VERSION:=v1alpha1

# how to dispatch the CRD files per repository (space-separated lists)
# !!! IMPORTANT !!! - when there is a new CRD added or an existing one removed or renamed, don't forget to change it also here: https://github.com/codeready-toolchain/toolchain-cicd/blob/master/scripts/add-cluster.sh#L52-L73
HOST_CLUSTER_CRDS:=masteruserrecords nstemplatetiers usersignups bannedusers notifications spaces spacebindings socialevents tiertemplates toolchainstatuses toolchainclusters toolchainconfigs usertiers proxyplugins spacerequests
MEMBER_CLUSTER_CRDS:=useraccounts nstemplatesets memberstatuses idlers toolchainclusters memberoperatorconfigs spacerequests workspaces
HOST_CLUSTER_CRDS:=masteruserrecords nstemplatetiers usersignups bannedusers notifications spaces spacebindings socialevents tiertemplates toolchainstatuses toolchainclusters toolchainconfigs usertiers proxyplugins spacerequests spacebindingrequests
MEMBER_CLUSTER_CRDS:=useraccounts nstemplatesets memberstatuses idlers toolchainclusters memberoperatorconfigs spacerequests workspaces spacebindingrequests

PATH_TO_CRD_BASES=config/crd/bases

Expand Down

0 comments on commit 047b143

Please sign in to comment.