Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api: Add a config option for vm-console-proxy and deprecate the feature gate #1018

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions api/v1beta2/ssp_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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"`
Expand Down
20 changes: 20 additions & 0 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions config/crd/bases/ssp.kubevirt.io_ssps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions data/crd/ssp.kubevirt.io_ssps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/operands/vm-console-proxy/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions internal/operands/vm-console-proxy/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand All @@ -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())
Expand Down Expand Up @@ -310,8 +310,8 @@ func getMockedRequest() common.Request {
Namespace: namespace,
},
Spec: ssp.SSPSpec{
FeatureGates: &ssp.FeatureGates{
DeployVmConsoleProxy: true,
TokenGenerationService: &ssp.TokenGenerationService{
Enabled: true,
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions tests/tests_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ func (s *newSspStrategy) Init() {
CommonTemplates: sspv1beta2.CommonTemplates{
Namespace: s.GetTemplatesNamespace(),
},
FeatureGates: &sspv1beta2.FeatureGates{
DeployVmConsoleProxy: true,
TokenGenerationService: &sspv1beta2.TokenGenerationService{
Enabled: true,
},
},
}
Expand Down
5 changes: 2 additions & 3 deletions tests/vm_console_proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down