From 4301ce916b3fd1501d784f50ec2c12a27862b8ea Mon Sep 17 00:00:00 2001 From: Francesco Ilario Date: Tue, 2 Jul 2024 10:56:55 +0200 Subject: [PATCH] add public-viewer config (#430) * add public-viewer config This commit adds the notion of Public-Viewer as described in [JIRA ASC-532](https://issues.redhat.com/browse/ASC-532). Signed-off-by: Francesco Ilario * move PublicViewerConfig into Host Signed-off-by: Francesco Ilario * refactor Signed-off-by: Francesco Ilario * update apiref.doc Signed-off-by: Francesco Ilario --------- Signed-off-by: Francesco Ilario Co-authored-by: Francisc Munteanu --- api/v1alpha1/docs/apiref.adoc | 25 +++++++++++++++++++++ api/v1alpha1/toolchainconfig_types.go | 16 ++++++++++++++ api/v1alpha1/zz_generated.deepcopy.go | 20 +++++++++++++++++ api/v1alpha1/zz_generated.openapi.go | 31 ++++++++++++++++++++++++++- 4 files changed, 91 insertions(+), 1 deletion(-) diff --git a/api/v1alpha1/docs/apiref.adoc b/api/v1alpha1/docs/apiref.adoc index d9f942fb..f0753e5c 100644 --- a/api/v1alpha1/docs/apiref.adoc +++ b/api/v1alpha1/docs/apiref.adoc @@ -612,6 +612,10 @@ HostConfig contains all configuration parameters of the host operator | *`toolchainStatus`* __xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-toolchainstatusconfig[$$ToolchainStatusConfig$$]__ | Keeps parameters concerned with the toolchainstatus + | | | *`users`* __xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-usersconfig[$$UsersConfig$$]__ | Keeps parameters concerned with user management + | | | *`spaceConfig`* __xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-spaceconfig[$$SpaceConfig$$]__ | Keeps parameters necessary for configuring Space provisioning functionality + | | +| *`publicViewerConfig`* __xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-publicviewerconfiguration[$$PublicViewerConfiguration$$]__ | Contains the PublicViewer configuration. + +IMPORTANT: To provide a consistent User-Experience, each user + +the space has been directly shared with should have at least + +the same permissions the kubesaw-authenticated user has. + | | |=== @@ -1986,6 +1990,27 @@ Supported condition types: ConditionReady + | | |=== +[id="{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-publicviewerconfiguration"] +==== PublicViewerConfiguration + + + +Configuration to enable the PublicViewer support + + + +.Appears In: +**** +- xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-hostconfig[$$HostConfig$$] +**** + +[cols="20a,50a,15a,15a", options="header"] +|=== +| Field | Description | Default | Validation +| *`enabled`* __boolean__ | Defines whether the PublicViewer support should be enabled or not + | false | +|=== + + [id="{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-registrationserviceanalyticsconfig"] ==== RegistrationServiceAnalyticsConfig diff --git a/api/v1alpha1/toolchainconfig_types.go b/api/v1alpha1/toolchainconfig_types.go index 0f9d0cd9..1d934b17 100644 --- a/api/v1alpha1/toolchainconfig_types.go +++ b/api/v1alpha1/toolchainconfig_types.go @@ -79,6 +79,13 @@ type HostConfig struct { // Keeps parameters necessary for configuring Space provisioning functionality // +optional SpaceConfig SpaceConfig `json:"spaceConfig,omitempty"` + + // Contains the PublicViewer configuration. + // IMPORTANT: To provide a consistent User-Experience, each user + // the space has been directly shared with should have at least + // the same permissions the kubesaw-authenticated user has. + //+optional + PublicViewerConfig *PublicViewerConfiguration `json:"publicViewerConfig,omitempty"` } // Members contains all configuration for member operators @@ -563,6 +570,15 @@ type SpaceConfig struct { SpaceBindingRequestEnabled *bool `json:"spaceBindingRequestEnabled,omitempty"` } +// Configuration to enable the PublicViewer support +// +k8s:openapi-gen=true +type PublicViewerConfiguration struct { + // Defines whether the PublicViewer support should be enabled or not + //+required + //+kubebuilder:default:=false + Enabled bool `json:"enabled"` +} + //+kubebuilder:object:root=true //+kubebuilder:subresource:status diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 12dd8baf..c5ee8a71 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -504,6 +504,11 @@ func (in *HostConfig) DeepCopyInto(out *HostConfig) { in.ToolchainStatus.DeepCopyInto(&out.ToolchainStatus) in.Users.DeepCopyInto(&out.Users) in.SpaceConfig.DeepCopyInto(&out.SpaceConfig) + if in.PublicViewerConfig != nil { + in, out := &in.PublicViewerConfig, &out.PublicViewerConfig + *out = new(PublicViewerConfiguration) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HostConfig. @@ -1902,6 +1907,21 @@ func (in *ProxyPluginStatus) DeepCopy() *ProxyPluginStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PublicViewerConfiguration) DeepCopyInto(out *PublicViewerConfiguration) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PublicViewerConfiguration. +func (in *PublicViewerConfiguration) DeepCopy() *PublicViewerConfiguration { + if in == nil { + return nil + } + out := new(PublicViewerConfiguration) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RegistrationServiceAnalyticsConfig) DeepCopyInto(out *RegistrationServiceAnalyticsConfig) { *out = *in diff --git a/api/v1alpha1/zz_generated.openapi.go b/api/v1alpha1/zz_generated.openapi.go index 58a3e438..0206e555 100644 --- a/api/v1alpha1/zz_generated.openapi.go +++ b/api/v1alpha1/zz_generated.openapi.go @@ -82,6 +82,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/codeready-toolchain/api/api/v1alpha1.ProxyPlugin": schema_codeready_toolchain_api_api_v1alpha1_ProxyPlugin(ref), "github.com/codeready-toolchain/api/api/v1alpha1.ProxyPluginSpec": schema_codeready_toolchain_api_api_v1alpha1_ProxyPluginSpec(ref), "github.com/codeready-toolchain/api/api/v1alpha1.ProxyPluginStatus": schema_codeready_toolchain_api_api_v1alpha1_ProxyPluginStatus(ref), + "github.com/codeready-toolchain/api/api/v1alpha1.PublicViewerConfiguration": schema_codeready_toolchain_api_api_v1alpha1_PublicViewerConfiguration(ref), "github.com/codeready-toolchain/api/api/v1alpha1.RegistrationServiceAnalyticsConfig": schema_codeready_toolchain_api_api_v1alpha1_RegistrationServiceAnalyticsConfig(ref), "github.com/codeready-toolchain/api/api/v1alpha1.RegistrationServiceAuthConfig": schema_codeready_toolchain_api_api_v1alpha1_RegistrationServiceAuthConfig(ref), "github.com/codeready-toolchain/api/api/v1alpha1.RegistrationServiceConfig": schema_codeready_toolchain_api_api_v1alpha1_RegistrationServiceConfig(ref), @@ -761,11 +762,17 @@ func schema_codeready_toolchain_api_api_v1alpha1_HostConfig(ref common.Reference Ref: ref("github.com/codeready-toolchain/api/api/v1alpha1.SpaceConfig"), }, }, + "publicViewerConfig": { + SchemaProps: spec.SchemaProps{ + Description: "Contains the PublicViewer configuration. IMPORTANT: To provide a consistent User-Experience, each user the space has been directly shared with should have at least the same permissions the kubesaw-authenticated user has.", + Ref: ref("github.com/codeready-toolchain/api/api/v1alpha1.PublicViewerConfiguration"), + }, + }, }, }, }, Dependencies: []string{ - "github.com/codeready-toolchain/api/api/v1alpha1.AutomaticApprovalConfig", "github.com/codeready-toolchain/api/api/v1alpha1.DeactivationConfig", "github.com/codeready-toolchain/api/api/v1alpha1.MetricsConfig", "github.com/codeready-toolchain/api/api/v1alpha1.NotificationsConfig", "github.com/codeready-toolchain/api/api/v1alpha1.RegistrationServiceConfig", "github.com/codeready-toolchain/api/api/v1alpha1.SpaceConfig", "github.com/codeready-toolchain/api/api/v1alpha1.TiersConfig", "github.com/codeready-toolchain/api/api/v1alpha1.ToolchainStatusConfig", "github.com/codeready-toolchain/api/api/v1alpha1.UsersConfig"}, + "github.com/codeready-toolchain/api/api/v1alpha1.AutomaticApprovalConfig", "github.com/codeready-toolchain/api/api/v1alpha1.DeactivationConfig", "github.com/codeready-toolchain/api/api/v1alpha1.MetricsConfig", "github.com/codeready-toolchain/api/api/v1alpha1.NotificationsConfig", "github.com/codeready-toolchain/api/api/v1alpha1.PublicViewerConfiguration", "github.com/codeready-toolchain/api/api/v1alpha1.RegistrationServiceConfig", "github.com/codeready-toolchain/api/api/v1alpha1.SpaceConfig", "github.com/codeready-toolchain/api/api/v1alpha1.TiersConfig", "github.com/codeready-toolchain/api/api/v1alpha1.ToolchainStatusConfig", "github.com/codeready-toolchain/api/api/v1alpha1.UsersConfig"}, } } @@ -2548,6 +2555,28 @@ func schema_codeready_toolchain_api_api_v1alpha1_ProxyPluginStatus(ref common.Re } } +func schema_codeready_toolchain_api_api_v1alpha1_PublicViewerConfiguration(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Configuration to enable the PublicViewer support", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "enabled": { + SchemaProps: spec.SchemaProps{ + Description: "Defines whether the PublicViewer support should be enabled or not", + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"enabled"}, + }, + }, + } +} + func schema_codeready_toolchain_api_api_v1alpha1_RegistrationServiceAnalyticsConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{