diff --git a/api/v1alpha1/banneduser_types.go b/api/v1alpha1/banneduser_types.go index 994f681e..a73a5ed9 100644 --- a/api/v1alpha1/banneduser_types.go +++ b/api/v1alpha1/banneduser_types.go @@ -25,6 +25,10 @@ type BannedUserSpec struct { // The e-mail address of the account that has been banned Email string `json:"email"` + + // Reason of the ban + // +optional + Reason string `json:"reason,omitempty"` } //+kubebuilder:object:root=true diff --git a/api/v1alpha1/docs/apiref.adoc b/api/v1alpha1/docs/apiref.adoc index 7983142c..477e55ff 100644 --- a/api/v1alpha1/docs/apiref.adoc +++ b/api/v1alpha1/docs/apiref.adoc @@ -201,6 +201,7 @@ BannedUserSpec defines the desired state of BannedUser |=== | Field | Description | Default | Validation | *`email`* __string__ | The e-mail address of the account that has been banned + | | +| *`reason`* __string__ | Reason of the ban + | | |=== @@ -3107,7 +3108,17 @@ TierTemplateSpec defines the desired state of TierTemplate | *`tierName`* __string__ | The tier of the template. For example: "basic", "advanced", or "team" + | | | *`type`* __string__ | The type of the template. For example: "code", "dev", "stage" or "cluster" + | | | *`revision`* __string__ | The revision of the corresponding template + | | -| *`template`* __xref:{anchor_prefix}-github-com-openshift-api-template-v1-template[$$Template$$]__ | Template contains an OpenShift Template to be used to provision either a user's namespace or cluster-wide resources + | | +| *`template`* __xref:{anchor_prefix}-github-com-openshift-api-template-v1-template[$$Template$$]__ | Template contains an OpenShift Template to be used to provision either a user's namespace or cluster-wide resources + +Note: this field will be removed in favor of the new TemplateObjects below. + | | +| *`templateObjects`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.2/#rawextension-runtime-pkg[$$RawExtension$$] array__ | TemplateObjects contains list of Unstructured Objects that can be parsed at runtime and will be applied as part of the tier provisioning. + + + +NOTE: when specifying variables as part of the objects list , those concatenated as part of other strings do not need to be wrapped inside quotes, + +while those that are not part of other strings do need to be wrapped in single quotes. This is required otherwise the yaml parser will error while trying to parse those resources containing variables. + +eg: https://docs.google.com/document/d/1x5SoBT80df9fmVsaDgAE6DE7hE6lzmNIK087JUmgaJs/edit#heading=h.2iuytpfnmul5 + + + +The template parameters values will be defined in the NSTemplateTier CRD. + | | |=== diff --git a/api/v1alpha1/tiertemplate_types.go b/api/v1alpha1/tiertemplate_types.go index d15f08c3..b1adeddd 100644 --- a/api/v1alpha1/tiertemplate_types.go +++ b/api/v1alpha1/tiertemplate_types.go @@ -3,6 +3,7 @@ package v1alpha1 import ( templatev1 "github.com/openshift/api/template/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" ) const ( @@ -28,7 +29,20 @@ type TierTemplateSpec struct { Revision string `json:"revision"` // Template contains an OpenShift Template to be used to provision either a user's namespace or cluster-wide resources + // Note: this field will be removed in favor of the new TemplateObjects below. Template templatev1.Template `json:"template"` + + // TemplateObjects contains list of Unstructured Objects that can be parsed at runtime and will be applied as part of the tier provisioning. + // + // NOTE: when specifying variables as part of the objects list , those concatenated as part of other strings do not need to be wrapped inside quotes, + // while those that are not part of other strings do need to be wrapped in single quotes. This is required otherwise the yaml parser will error while trying to parse those resources containing variables. + // eg: https://docs.google.com/document/d/1x5SoBT80df9fmVsaDgAE6DE7hE6lzmNIK087JUmgaJs/edit#heading=h.2iuytpfnmul5 + // + // The template parameters values will be defined in the NSTemplateTier CRD. + // +optional + // +listType=atomic + // +kubebuilder:pruning:PreserveUnknownFields + TemplateObjects []runtime.RawExtension `json:"templateObjects,omitempty" protobuf:"bytes,3,opt,name=templateObjects"` } //+kubebuilder:object:root=true diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index bd658802..6c152100 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -6,7 +6,7 @@ package v1alpha1 import ( - runtime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -3016,6 +3016,13 @@ func (in *TierTemplateList) DeepCopyObject() runtime.Object { func (in *TierTemplateSpec) DeepCopyInto(out *TierTemplateSpec) { *out = *in in.Template.DeepCopyInto(&out.Template) + if in.TemplateObjects != nil { + in, out := &in.TemplateObjects, &out.TemplateObjects + *out = make([]runtime.RawExtension, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TierTemplateSpec. diff --git a/api/v1alpha1/zz_generated.openapi.go b/api/v1alpha1/zz_generated.openapi.go index 91d99004..6ee9baf0 100644 --- a/api/v1alpha1/zz_generated.openapi.go +++ b/api/v1alpha1/zz_generated.openapi.go @@ -291,6 +291,13 @@ func schema_codeready_toolchain_api_api_v1alpha1_BannedUserSpec(ref common.Refer Format: "", }, }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "Reason of the ban", + Type: []string{"string"}, + Format: "", + }, + }, }, Required: []string{"email"}, }, @@ -4258,17 +4265,36 @@ func schema_codeready_toolchain_api_api_v1alpha1_TierTemplateSpec(ref common.Ref }, "template": { SchemaProps: spec.SchemaProps{ - Description: "Template contains an OpenShift Template to be used to provision either a user's namespace or cluster-wide resources", + Description: "Template contains an OpenShift Template to be used to provision either a user's namespace or cluster-wide resources Note: this field will be removed in favor of the new TemplateObjects below.", Default: map[string]interface{}{}, Ref: ref("github.com/openshift/api/template/v1.Template"), }, }, + "templateObjects": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "TemplateObjects contains list of Unstructured Objects that can be parsed at runtime and will be applied as part of the tier provisioning.\n\nNOTE: when specifying variables as part of the objects list , those concatenated as part of other strings do not need to be wrapped inside quotes, while those that are not part of other strings do need to be wrapped in single quotes. This is required otherwise the yaml parser will error while trying to parse those resources containing variables. eg: https://docs.google.com/document/d/1x5SoBT80df9fmVsaDgAE6DE7hE6lzmNIK087JUmgaJs/edit#heading=h.2iuytpfnmul5\n\nThe template parameters values will be defined in the NSTemplateTier CRD.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"), + }, + }, + }, + }, + }, }, Required: []string{"tierName", "type", "revision", "template"}, }, }, Dependencies: []string{ - "github.com/openshift/api/template/v1.Template"}, + "github.com/openshift/api/template/v1.Template", "k8s.io/apimachinery/pkg/runtime.RawExtension"}, } } diff --git a/make/generate.mk b/make/generate.mk index e4e57252..fbf340b8 100644 --- a/make/generate.mk +++ b/make/generate.mk @@ -25,7 +25,7 @@ LOCAL_GOPATH=`$(GO) env GOPATH` .PHONY: generate ## Generate deepcopy, openapi and CRD files after the API was modified -generate: generate-deepcopy-and-crds generate-openapi gen-crd-ref-docs dispatch-crds copy-reg-service-template +generate: generate-deepcopy-and-crds generate-openapi gen-crd-ref-docs dispatch-crds .PHONY: generate-deepcopy-and-crds generate-deepcopy-and-crds: remove-config controller-gen @@ -118,11 +118,6 @@ dispatch-crds: prepare-host-operator prepare-member-operator fi @echo "Dispatch successfuly finished \o/" -.PHONY: copy-reg-service-template -copy-reg-service-template: - cp ../registration-service/deploy/registration-service.yaml ../host-operator/deploy/registration-service/registration-service.yaml - - CONTROLLER_GEN = $(PROJECT_DIR)/bin/controller-gen controller-gen: ## Download controller-gen locally if necessary. GOBIN=$(PROJECT_DIR)/bin $(GO) install sigs.k8s.io/controller-tools/cmd/controller-gen