diff --git a/api/v1beta2/ssp_types.go b/api/v1beta2/ssp_types.go index e66c0b449..7e77b03df 100644 --- a/api/v1beta2/ssp_types.go +++ b/api/v1beta2/ssp_types.go @@ -81,6 +81,9 @@ type SSPSpec struct { // TLSSecurityProfile is a configuration for the TLS. TLSSecurityProfile *ocpv1.TLSSecurityProfile `json:"tlsSecurityProfile,omitempty"` + // TokenGenerationService configures the service for generating tokens to access VNC for a VM. + TokenGenerationService *TokenGenerationService `json:"tokenGenerationService,omitempty"` + // CommonInstancetypes is the configuration of the common-instancetypes operand // // Deprecated: This functionality will be removed in a future release. @@ -116,6 +119,8 @@ type FeatureGates struct { // Deprecated: This field is ignored. DeployTektonTaskResources bool `json:"deployTektonTaskResources,omitempty"` + // +kubebuilder:deprecatedversion:warning="use the .spec.tokenGenerationService to enable vm-console-proxy" + // Deprecated: This field is ignored. DeployVmConsoleProxy bool `json:"deployVmConsoleProxy,omitempty"` // Enables deployment of the common-instancetypes bundles, defaults to true. @@ -138,6 +143,11 @@ func (t *DataImportCronTemplate) AsDataImportCron() cdiv1beta1.DataImportCron { } } +// TokenGenerationService configures the service for generating tokens to access VNC for a VM. +type TokenGenerationService struct { + Enabled bool `json:"enabled,omitempty"` +} + // SSPStatus defines the observed state of SSP type SSPStatus struct { lifecycleapi.Status `json:",inline"` diff --git a/api/v1beta2/zz_generated.deepcopy.go b/api/v1beta2/zz_generated.deepcopy.go index 78f82e163..2213b2aea 100644 --- a/api/v1beta2/zz_generated.deepcopy.go +++ b/api/v1beta2/zz_generated.deepcopy.go @@ -177,6 +177,11 @@ func (in *SSPSpec) DeepCopyInto(out *SSPSpec) { *out = new(v1.TLSSecurityProfile) (*in).DeepCopyInto(*out) } + if in.TokenGenerationService != nil { + in, out := &in.TokenGenerationService, &out.TokenGenerationService + *out = new(TokenGenerationService) + **out = **in + } if in.CommonInstancetypes != nil { in, out := &in.CommonInstancetypes, &out.CommonInstancetypes *out = new(CommonInstancetypes) @@ -278,3 +283,18 @@ func (in *TemplateValidator) DeepCopy() *TemplateValidator { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TokenGenerationService) DeepCopyInto(out *TokenGenerationService) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TokenGenerationService. +func (in *TokenGenerationService) DeepCopy() *TokenGenerationService { + if in == nil { + return nil + } + out := new(TokenGenerationService) + in.DeepCopyInto(out) + return out +} diff --git a/config/crd/bases/ssp.kubevirt.io_ssps.yaml b/config/crd/bases/ssp.kubevirt.io_ssps.yaml index 21ece4686..097ff9afe 100644 --- a/config/crd/bases/ssp.kubevirt.io_ssps.yaml +++ b/config/crd/bases/ssp.kubevirt.io_ssps.yaml @@ -4194,6 +4194,7 @@ spec: description: 'Deprecated: This field is ignored.' type: boolean deployVmConsoleProxy: + description: 'Deprecated: This field is ignored.' type: boolean type: object tektonPipelines: @@ -5478,6 +5479,13 @@ spec: - Custom type: string type: object + tokenGenerationService: + description: TokenGenerationService configures the service for generating + tokens to access VNC for a VM. + properties: + enabled: + type: boolean + type: object required: - commonTemplates type: object diff --git a/data/crd/ssp.kubevirt.io_ssps.yaml b/data/crd/ssp.kubevirt.io_ssps.yaml index de280c951..8672bc61d 100644 --- a/data/crd/ssp.kubevirt.io_ssps.yaml +++ b/data/crd/ssp.kubevirt.io_ssps.yaml @@ -4196,6 +4196,7 @@ spec: description: 'Deprecated: This field is ignored.' type: boolean deployVmConsoleProxy: + description: 'Deprecated: This field is ignored.' type: boolean type: object tektonPipelines: @@ -5480,6 +5481,13 @@ spec: - Custom type: string type: object + tokenGenerationService: + description: TokenGenerationService configures the service for generating + tokens to access VNC for a VM. + properties: + enabled: + type: boolean + type: object required: - commonTemplates type: object diff --git a/internal/operands/vm-console-proxy/reconcile.go b/internal/operands/vm-console-proxy/reconcile.go index 42bb0b564..66c652112 100644 --- a/internal/operands/vm-console-proxy/reconcile.go +++ b/internal/operands/vm-console-proxy/reconcile.go @@ -108,7 +108,7 @@ func (v *vmConsoleProxy) WatchClusterTypes() []operands.WatchType { } func (v *vmConsoleProxy) Reconcile(request *common.Request) ([]common.ReconcileResult, error) { - if request.Instance.Spec.FeatureGates == nil || !request.Instance.Spec.FeatureGates.DeployVmConsoleProxy { + if request.Instance.Spec.TokenGenerationService == nil || !request.Instance.Spec.TokenGenerationService.Enabled { cleanupResults, err := v.Cleanup(request) if err != nil { return nil, err diff --git a/internal/operands/vm-console-proxy/reconcile_test.go b/internal/operands/vm-console-proxy/reconcile_test.go index e364c9994..fee7defbb 100644 --- a/internal/operands/vm-console-proxy/reconcile_test.go +++ b/internal/operands/vm-console-proxy/reconcile_test.go @@ -249,7 +249,7 @@ var _ = Describe("VM Console Proxy Operand", func() { } }) - It("should delete resources when feature gate was disabled", func() { + It("should delete resources when TokenGenerationService is disabled", func() { _, err := operand.Reconcile(&request) Expect(err).ToNot(HaveOccurred()) @@ -264,7 +264,7 @@ var _ = Describe("VM Console Proxy Operand", func() { ExpectResourceExists(bundle.Deployment, request) ExpectResourceExists(bundle.ApiService, request) - request.Instance.Spec.FeatureGates.DeployVmConsoleProxy = false + request.Instance.Spec.TokenGenerationService.Enabled = false _, err = operand.Reconcile(&request) Expect(err).ToNot(HaveOccurred()) @@ -310,8 +310,8 @@ func getMockedRequest() common.Request { Namespace: namespace, }, Spec: ssp.SSPSpec{ - FeatureGates: &ssp.FeatureGates{ - DeployVmConsoleProxy: true, + TokenGenerationService: &ssp.TokenGenerationService{ + Enabled: true, }, }, }, diff --git a/tests/tests_suite_test.go b/tests/tests_suite_test.go index 5c92c28db..4fa830a38 100644 --- a/tests/tests_suite_test.go +++ b/tests/tests_suite_test.go @@ -121,8 +121,8 @@ func (s *newSspStrategy) Init() { CommonTemplates: sspv1beta2.CommonTemplates{ Namespace: s.GetTemplatesNamespace(), }, - FeatureGates: &sspv1beta2.FeatureGates{ - DeployVmConsoleProxy: true, + TokenGenerationService: &sspv1beta2.TokenGenerationService{ + Enabled: true, }, }, } diff --git a/tests/vm_console_proxy_test.go b/tests/vm_console_proxy_test.go index 7503e80eb..b1a85fc61 100644 --- a/tests/vm_console_proxy_test.go +++ b/tests/vm_console_proxy_test.go @@ -41,10 +41,9 @@ var _ = Describe("VM Console Proxy Operand", func() { strategy.SkipSspUpdateTestsIfNeeded() updateSsp(func(foundSsp *ssp.SSP) { - if foundSsp.Spec.FeatureGates == nil { - foundSsp.Spec.FeatureGates = &ssp.FeatureGates{} + foundSsp.Spec.TokenGenerationService = &ssp.TokenGenerationService{ + Enabled: true, } - foundSsp.Spec.FeatureGates.DeployVmConsoleProxy = true }) expectedLabels := expectedLabelsFor("vm-console-proxy", "vm-console-proxy")