From 40a60c7ac400009fd20d965e833aed25e7e5e9d0 Mon Sep 17 00:00:00 2001 From: Francesco Ilario Date: Mon, 18 Mar 2024 12:40:50 +0100 Subject: [PATCH] add PublicViewer config Signed-off-by: Francesco Ilario --- api/v1alpha1/toolchainconfig_types.go | 24 ++++++++++++++++++++ api/v1alpha1/usersignup_types.go | 1 + api/v1alpha1/zz_generated.deepcopy.go | 32 +++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/api/v1alpha1/toolchainconfig_types.go b/api/v1alpha1/toolchainconfig_types.go index 66875692..f3e363eb 100644 --- a/api/v1alpha1/toolchainconfig_types.go +++ b/api/v1alpha1/toolchainconfig_types.go @@ -32,6 +32,30 @@ type ToolchainConfigSpec struct { // Contains all member operator configurations for all member clusters // +optional Members Members `json:"members,omitempty"` + + // Contains all the configuration that applies to both host and member operators + // +optional + Global GlobalConfig `json:"global,omitempty"` +} + +// GlobalConfig contains all configuration that applies for both host and member operators +// +k8s:openapi-gen=true +type GlobalConfig struct { + // +optional + PublicViewer PublicViewerConfig `json:"publicViewer,omitempty"` +} + +// PublicViewer used to enable public-viewer support +// +k8s:openapi-gen=true +type PublicViewerConfig struct { + // +kubebuilder:default:=false + Enabled bool `json:"enabled"` + + // +kubebuilder:default:=public-viewer + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern=`^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` + Username string `json:"username,omitempty"` } // HostConfig contains all configuration parameters of the host operator diff --git a/api/v1alpha1/usersignup_types.go b/api/v1alpha1/usersignup_types.go index 5db5a942..e200ad26 100644 --- a/api/v1alpha1/usersignup_types.go +++ b/api/v1alpha1/usersignup_types.go @@ -92,6 +92,7 @@ const ( UserSignupPendingApprovalReason = "PendingApproval" UserSignupUserBanningReason = "Banning" UserSignupUserBannedReason = "Banned" + UserSignupUserReservedReason = "Reserved" UserSignupFailedToReadBannedUsersReason = "FailedToReadBannedUsers" UserSignupMissingUserEmailReason = "MissingUserEmail" UserSignupMissingUserEmailAnnotationReason = "MissingUserEmailAnnotation" diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index b5858a64..f2916c6c 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -485,6 +485,22 @@ func (in *GitHubSecret) DeepCopy() *GitHubSecret { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GlobalConfig) DeepCopyInto(out *GlobalConfig) { + *out = *in + out.PublicViewer = in.PublicViewer +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalConfig. +func (in *GlobalConfig) DeepCopy() *GlobalConfig { + if in == nil { + return nil + } + out := new(GlobalConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HostConfig) DeepCopyInto(out *HostConfig) { *out = *in @@ -1901,6 +1917,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 *PublicViewerConfig) DeepCopyInto(out *PublicViewerConfig) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PublicViewerConfig. +func (in *PublicViewerConfig) DeepCopy() *PublicViewerConfig { + if in == nil { + return nil + } + out := new(PublicViewerConfig) + 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 @@ -3276,6 +3307,7 @@ func (in *ToolchainConfigSpec) DeepCopyInto(out *ToolchainConfigSpec) { *out = *in in.Host.DeepCopyInto(&out.Host) in.Members.DeepCopyInto(&out.Members) + out.Global = in.Global } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ToolchainConfigSpec.