From 703872fb57876099fef69ddf6a6ddb757bb2da9c Mon Sep 17 00:00:00 2001 From: Bryan Florkiewicz Date: Mon, 7 Oct 2024 16:54:30 -0400 Subject: [PATCH] RHCLOUD-33912: update crd spec to match chrome-service --- api/v1alpha1/frontend_types.go | 50 +++++++-- api/v1alpha1/zz_generated.deepcopy.go | 103 ++++++++++++++++++ .../crd/bases/cloud.redhat.com_frontends.yaml | 59 ++++++++++ 3 files changed, 201 insertions(+), 11 deletions(-) diff --git a/api/v1alpha1/frontend_types.go b/api/v1alpha1/frontend_types.go index f9bd8ac2..cb4ccaff 100644 --- a/api/v1alpha1/frontend_types.go +++ b/api/v1alpha1/frontend_types.go @@ -76,26 +76,54 @@ type FrontendDeployments struct { } type FedModule struct { - ManifestLocation string `json:"manifestLocation" yaml:"manifestLocation"` - Modules []Module `json:"modules,omitempty" yaml:"modules,omitempty"` - ModuleID string `json:"moduleID,omitempty" yaml:"moduleID,omitempty"` - Config *apiextensions.JSON `json:"config,omitempty" yaml:"config,omitempty"` - FullProfile *bool `json:"fullProfile,omitempty" yaml:"fullProfile,omitempty"` + ManifestLocation string `json:"manifestLocation" yaml:"manifestLocation"` + Modules []Module `json:"modules,omitempty" yaml:"modules,omitempty"` + ModuleID string `json:"moduleID,omitempty" yaml:"moduleID,omitempty"` + Config *apiextensions.JSON `json:"config,omitempty" yaml:"config,omitempty"` // Type does not match what is currently in chrome-service spec + ModuleConfig *ModuleConfig `json:"moduleConfig,omitempty" yaml:"moduleConfig,omitempty"` + FullProfile *bool `json:"fullProfile,omitempty" yaml:"fullProfile,omitempty"` + DefaultDocumentTitle string `json:"defaultDocumentTitle,omitempty" yaml:"defaultDocumentTitle,omitempty"` + IsFedramp *bool `json:"isFedramp,omitempty" yaml:"isFedramp,omitempty"` + Analytics *Analytics `json:"analytics,omitempty" yaml:"analytics,omitempty"` } type Module struct { ID string `json:"id" yaml:"id"` Module string `json:"module" yaml:"module"` Routes []Route `json:"routes" yaml:"routes"` - Dependencies []string `json:"dependencies,omitempty" yaml:"dependencies,omitempty"` - OptionalDependencies []string `json:"optionalDependencies,omitempty" yaml:"optionalDependencies,omitempty"` + Dependencies []string `json:"dependencies,omitempty" yaml:"dependencies,omitempty"` // not in the current chrome-service spec + OptionalDependencies []string `json:"optionalDependencies,omitempty" yaml:"optionalDependencies,omitempty"` // not in the current chrome-service spec +} + +type ModuleConfig struct { + SupportCaseData SupportCaseData `json:"supportCaseData,omitempty" yaml:"supportCaseData,omitempty"` + SSOScopes []string `json:"ssoScopes,omitempty" yaml:"ssoScopes,omitempty"` } type Route struct { - Pathname string `json:"pathname" yaml:"pathname"` - Dynamic bool `json:"dynamic,omitempty" yaml:"dynamic,omitempty"` - Exact bool `json:"exact,omitempty" yaml:"exact,omitempty"` - Props *apiextensions.JSON `json:"props,omitempty" yaml:"props,omitempty"` + Pathname string `json:"pathname" yaml:"pathname"` + Dynamic bool `json:"dynamic,omitempty" yaml:"dynamic,omitempty"` + Exact bool `json:"exact,omitempty" yaml:"exact,omitempty"` + Props *apiextensions.JSON `json:"props,omitempty" yaml:"props,omitempty"` + FullProfile bool `json:"fullProfile,omitempty" yaml:"fullProfile,omitempty"` + IsFedramp bool `json:"isFedramp,omitempty" yaml:"isFedramp,omitempty"` + SupportCaseData *SupportCaseData `json:"supportCaseData,omitempty" yaml:"supportCaseData,omitempty"` + Permissions []Permission `json:"permissions,omitempty" yaml:"permissions,omitempty"` +} + +type Analytics struct { + APIKey string `json:"APIKey" yaml:"APIKey"` +} + +type SupportCaseData struct { + Version string `json:"version" yaml:"version"` + Product string `json:"product" yaml:"product"` +} + +type Permission struct { + Method string `json:"method" yaml:"method"` + Apps []string `json:"apps,omitempty" yaml:"apps,omitempty"` + Args []string `json:"args,omitempty" yaml:"args,omitempty"` // TODO validate array item type (string?) } // +kubebuilder:object:root=true diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 12f4ba7c..48fcf114 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -46,6 +46,21 @@ func (in *APIInfo) DeepCopy() *APIInfo { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Analytics) DeepCopyInto(out *Analytics) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Analytics. +func (in *Analytics) DeepCopy() *Analytics { + if in == nil { + return nil + } + out := new(Analytics) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Bundle) DeepCopyInto(out *Bundle) { *out = *in @@ -276,11 +291,26 @@ func (in *FedModule) DeepCopyInto(out *FedModule) { *out = new(apiextensionsv1.JSON) (*in).DeepCopyInto(*out) } + if in.ModuleConfig != nil { + in, out := &in.ModuleConfig, &out.ModuleConfig + *out = new(ModuleConfig) + (*in).DeepCopyInto(*out) + } if in.FullProfile != nil { in, out := &in.FullProfile, &out.FullProfile *out = new(bool) **out = **in } + if in.IsFedramp != nil { + in, out := &in.IsFedramp, &out.IsFedramp + *out = new(bool) + **out = **in + } + if in.Analytics != nil { + in, out := &in.Analytics, &out.Analytics + *out = new(Analytics) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FedModule. @@ -607,6 +637,27 @@ func (in *Module) DeepCopy() *Module { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ModuleConfig) DeepCopyInto(out *ModuleConfig) { + *out = *in + out.SupportCaseData = in.SupportCaseData + if in.SSOScopes != nil { + in, out := &in.SSOScopes, &out.SSOScopes + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleConfig. +func (in *ModuleConfig) DeepCopy() *ModuleConfig { + if in == nil { + return nil + } + out := new(ModuleConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MonitoringConfig) DeepCopyInto(out *MonitoringConfig) { *out = *in @@ -622,6 +673,31 @@ func (in *MonitoringConfig) DeepCopy() *MonitoringConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Permission) DeepCopyInto(out *Permission) { + *out = *in + if in.Apps != nil { + in, out := &in.Apps, &out.Apps + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Args != nil { + in, out := &in.Args, &out.Args + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Permission. +func (in *Permission) DeepCopy() *Permission { + if in == nil { + return nil + } + out := new(Permission) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Route) DeepCopyInto(out *Route) { *out = *in @@ -630,6 +706,18 @@ func (in *Route) DeepCopyInto(out *Route) { *out = new(apiextensionsv1.JSON) (*in).DeepCopyInto(*out) } + if in.SupportCaseData != nil { + in, out := &in.SupportCaseData, &out.SupportCaseData + *out = new(SupportCaseData) + **out = **in + } + if in.Permissions != nil { + in, out := &in.Permissions, &out.Permissions + *out = make([]Permission, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Route. @@ -656,3 +744,18 @@ func (in *ServiceMonitorConfig) DeepCopy() *ServiceMonitorConfig { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SupportCaseData) DeepCopyInto(out *SupportCaseData) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SupportCaseData. +func (in *SupportCaseData) DeepCopy() *SupportCaseData { + if in == nil { + return nil + } + out := new(SupportCaseData) + in.DeepCopyInto(out) + return out +} diff --git a/config/crd/bases/cloud.redhat.com_frontends.yaml b/config/crd/bases/cloud.redhat.com_frontends.yaml index 560c6afc..95cb6103 100644 --- a/config/crd/bases/cloud.redhat.com_frontends.yaml +++ b/config/crd/bases/cloud.redhat.com_frontends.yaml @@ -92,12 +92,40 @@ spec: type: string module: properties: + analytics: + properties: + APIKey: + type: string + required: + - APIKey + type: object config: x-kubernetes-preserve-unknown-fields: true + defaultDocumentTitle: + type: string fullProfile: type: boolean + isFedramp: + type: boolean manifestLocation: type: string + moduleConfig: + properties: + ssoScopes: + items: + type: string + type: array + supportCaseData: + properties: + product: + type: string + version: + type: string + required: + - product + - version + type: object + type: object moduleID: type: string modules: @@ -122,10 +150,41 @@ spec: type: boolean exact: type: boolean + fullProfile: + type: boolean + isFedramp: + type: boolean pathname: type: string + permissions: + items: + properties: + apps: + items: + type: string + type: array + args: + items: + type: string + type: array + method: + type: string + required: + - method + type: object + type: array props: x-kubernetes-preserve-unknown-fields: true + supportCaseData: + properties: + product: + type: string + version: + type: string + required: + - product + - version + type: object required: - pathname type: object