diff --git a/api/v1beta1/cryostat_conversion.go b/api/v1beta1/cryostat_conversion.go index 0d8bc4424..915917749 100644 --- a/api/v1beta1/cryostat_conversion.go +++ b/api/v1beta1/cryostat_conversion.go @@ -245,11 +245,11 @@ func convertTargetDiscoveryTo(srcOpts *TargetDiscoveryOptions) *operatorv1beta2. var dstOpts *operatorv1beta2.TargetDiscoveryOptions if srcOpts != nil { dstOpts = &operatorv1beta2.TargetDiscoveryOptions{ - BuiltInDiscoveryDisabled: srcOpts.BuiltInDiscoveryDisabled, - DisableBuiltInPortNames: srcOpts.DisableBuiltInPortNames, - DiscoveryPortNames: srcOpts.DiscoveryPortNames, - DisableBuiltInPortNumbers: srcOpts.DisableBuiltInPortNumbers, - DiscoveryPortNumbers: srcOpts.DiscoveryPortNumbers, + BuiltInDiscoveryDisabled: srcOpts.BuiltInDiscoveryDisabled, + BuiltInPortNamesDisabled: srcOpts.DisableBuiltInPortNames, + DiscoveryPortNames: srcOpts.DiscoveryPortNames, + BuiltInPortNumbersDisabled: srcOpts.DisableBuiltInPortNumbers, + DiscoveryPortNumbers: srcOpts.DiscoveryPortNumbers, } } return dstOpts @@ -508,9 +508,9 @@ func convertTargetDiscoveryFrom(srcOpts *operatorv1beta2.TargetDiscoveryOptions) if srcOpts != nil { dstOpts = &TargetDiscoveryOptions{ BuiltInDiscoveryDisabled: srcOpts.BuiltInDiscoveryDisabled, - DisableBuiltInPortNames: srcOpts.DisableBuiltInPortNames, + DisableBuiltInPortNames: srcOpts.BuiltInPortNamesDisabled, DiscoveryPortNames: srcOpts.DiscoveryPortNames, - DisableBuiltInPortNumbers: srcOpts.DisableBuiltInPortNumbers, + DisableBuiltInPortNumbers: srcOpts.BuiltInPortNumbersDisabled, DiscoveryPortNumbers: srcOpts.DiscoveryPortNumbers, } } diff --git a/api/v1beta2/cryostat_types.go b/api/v1beta2/cryostat_types.go index c93a30c24..920bcbf35 100644 --- a/api/v1beta2/cryostat_types.go +++ b/api/v1beta2/cryostat_types.go @@ -585,18 +585,18 @@ type TargetDiscoveryOptions struct { // +optional // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Disable Built-in Discovery",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"} BuiltInDiscoveryDisabled bool `json:"builtInDiscoveryDisabled,omitempty"` - // When true, the Cryostat application will use the default port name jfr-jmx to look for JMX connectable targets. + // When false and discoveryPortNames is empty, the Cryostat application will use the default port name jfr-jmx to look for JMX connectable targets. // +optional // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Disable Built-in Port Names",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"} - DisableBuiltInPortNames bool `json:"disableBuiltInPortNames,omitempty"` + BuiltInPortNamesDisabled bool `json:"builtInPortNamesDisabled,omitempty"` // List of port names that the Cryostat application should look for in order to consider a target as JMX connectable. // +optional // +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldDependency:targetDiscoveryOptions.disableBuiltInPortNames:true"} DiscoveryPortNames []string `json:"discoveryPortNames,omitempty"` - // When true, the Cryostat application will use the default port number 9091 to look for JMX connectable targets. + // When false and discoveryPortNumbers is empty, the Cryostat application will use the default port number 9091 to look for JMX connectable targets. // +optional // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Disable Built-in Port Numbers",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"} - DisableBuiltInPortNumbers bool `json:"disableBuiltInPortNumbers,omitempty"` + BuiltInPortNumbersDisabled bool `json:"builtInPortNumbersDisabled,omitempty"` // List of port numbers that the Cryostat application should look for in order to consider a target as JMX connectable. // +optional // +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldDependency:targetDiscoveryOptions.disableBuiltInPortNumbers:true"} diff --git a/bundle/manifests/cryostat-operator.clusterserviceversion.yaml b/bundle/manifests/cryostat-operator.clusterserviceversion.yaml index abeaef42e..db3cefe5e 100644 --- a/bundle/manifests/cryostat-operator.clusterserviceversion.yaml +++ b/bundle/manifests/cryostat-operator.clusterserviceversion.yaml @@ -53,7 +53,7 @@ metadata: capabilities: Seamless Upgrades categories: Monitoring, Developer Tools containerImage: quay.io/cryostat/cryostat-operator:3.0.0-dev - createdAt: "2024-05-20T05:12:58Z" + createdAt: "2024-05-22T04:36:29Z" description: JVM monitoring and profiling tool operatorframework.io/initialization-resource: |- { @@ -845,16 +845,16 @@ spec: path: targetDiscoveryOptions.builtInDiscoveryDisabled x-descriptors: - urn:alm:descriptor:com.tectonic.ui:booleanSwitch - - description: When true, the Cryostat application will use the default port - name jfr-jmx to look for JMX connectable targets. + - description: When false and discoveryPortNames is empty, the Cryostat application + will use the default port name jfr-jmx to look for JMX connectable targets. displayName: Disable Built-in Port Names - path: targetDiscoveryOptions.disableBuiltInPortNames + path: targetDiscoveryOptions.builtInPortNamesDisabled x-descriptors: - urn:alm:descriptor:com.tectonic.ui:booleanSwitch - - description: When true, the Cryostat application will use the default port - number 9091 to look for JMX connectable targets. + - description: When false and discoveryPortNumbers is empty, the Cryostat application + will use the default port number 9091 to look for JMX connectable targets. displayName: Disable Built-in Port Numbers - path: targetDiscoveryOptions.disableBuiltInPortNumbers + path: targetDiscoveryOptions.builtInPortNumbersDisabled x-descriptors: - urn:alm:descriptor:com.tectonic.ui:booleanSwitch - description: List of port names that the Cryostat application should look diff --git a/bundle/manifests/operator.cryostat.io_cryostats.yaml b/bundle/manifests/operator.cryostat.io_cryostats.yaml index b095d06d1..e144bdb44 100644 --- a/bundle/manifests/operator.cryostat.io_cryostats.yaml +++ b/bundle/manifests/operator.cryostat.io_cryostats.yaml @@ -9715,13 +9715,15 @@ spec: description: When true, the Cryostat application will disable the built-in discovery mechanisms. Defaults to false type: boolean - disableBuiltInPortNames: - description: When true, the Cryostat application will use the - default port name jfr-jmx to look for JMX connectable targets. + builtInPortNamesDisabled: + description: When false and discoveryPortNames is empty, the Cryostat + application will use the default port name jfr-jmx to look for + JMX connectable targets. type: boolean - disableBuiltInPortNumbers: - description: When true, the Cryostat application will use the - default port number 9091 to look for JMX connectable targets. + builtInPortNumbersDisabled: + description: When false and discoveryPortNumbers is empty, the + Cryostat application will use the default port number 9091 to + look for JMX connectable targets. type: boolean discoveryPortNames: description: List of port names that the Cryostat application diff --git a/config/crd/bases/operator.cryostat.io_cryostats.yaml b/config/crd/bases/operator.cryostat.io_cryostats.yaml index 3102d2e92..10da32ef3 100644 --- a/config/crd/bases/operator.cryostat.io_cryostats.yaml +++ b/config/crd/bases/operator.cryostat.io_cryostats.yaml @@ -9705,13 +9705,15 @@ spec: description: When true, the Cryostat application will disable the built-in discovery mechanisms. Defaults to false type: boolean - disableBuiltInPortNames: - description: When true, the Cryostat application will use the - default port name jfr-jmx to look for JMX connectable targets. + builtInPortNamesDisabled: + description: When false and discoveryPortNames is empty, the Cryostat + application will use the default port name jfr-jmx to look for + JMX connectable targets. type: boolean - disableBuiltInPortNumbers: - description: When true, the Cryostat application will use the - default port number 9091 to look for JMX connectable targets. + builtInPortNumbersDisabled: + description: When false and discoveryPortNumbers is empty, the + Cryostat application will use the default port number 9091 to + look for JMX connectable targets. type: boolean discoveryPortNames: description: List of port names that the Cryostat application diff --git a/config/manifests/bases/cryostat-operator.clusterserviceversion.yaml b/config/manifests/bases/cryostat-operator.clusterserviceversion.yaml index 831922035..15e3c1b4e 100644 --- a/config/manifests/bases/cryostat-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/cryostat-operator.clusterserviceversion.yaml @@ -390,16 +390,16 @@ spec: path: targetDiscoveryOptions.builtInDiscoveryDisabled x-descriptors: - urn:alm:descriptor:com.tectonic.ui:booleanSwitch - - description: When true, the Cryostat application will use the default port - name jfr-jmx to look for JMX connectable targets. + - description: When false and discoveryPortNames is empty, the Cryostat application + will use the default port name jfr-jmx to look for JMX connectable targets. displayName: Disable Built-in Port Names - path: targetDiscoveryOptions.disableBuiltInPortNames + path: targetDiscoveryOptions.builtInPortNamesDisabled x-descriptors: - urn:alm:descriptor:com.tectonic.ui:booleanSwitch - - description: When true, the Cryostat application will use the default port - number 9091 to look for JMX connectable targets. + - description: When false and discoveryPortNumbers is empty, the Cryostat application + will use the default port number 9091 to look for JMX connectable targets. displayName: Disable Built-in Port Numbers - path: targetDiscoveryOptions.disableBuiltInPortNumbers + path: targetDiscoveryOptions.builtInPortNumbersDisabled x-descriptors: - urn:alm:descriptor:com.tectonic.ui:booleanSwitch - description: List of port names that the Cryostat application should look diff --git a/internal/controllers/common/resource_definitions/resource_definitions.go b/internal/controllers/common/resource_definitions/resource_definitions.go index 2caf52ab6..cd15306fb 100644 --- a/internal/controllers/common/resource_definitions/resource_definitions.go +++ b/internal/controllers/common/resource_definitions/resource_definitions.go @@ -1099,13 +1099,13 @@ func NewCoreContainer(cr *model.CryostatInstance, specs *ServiceSpecs, imageTag if len(cr.Spec.TargetDiscoveryOptions.DiscoveryPortNames) > 0 { k8sDiscoveryPortNames = strings.Join(cr.Spec.TargetDiscoveryOptions.DiscoveryPortNames[:], ",") - } else if cr.Spec.TargetDiscoveryOptions.DisableBuiltInPortNames { + } else if cr.Spec.TargetDiscoveryOptions.BuiltInPortNamesDisabled { k8sDiscoveryPortNames = "" } if len(cr.Spec.TargetDiscoveryOptions.DiscoveryPortNumbers) > 0 { k8sDiscoveryPortNumbers = strings.Trim(strings.ReplaceAll(fmt.Sprint(cr.Spec.TargetDiscoveryOptions.DiscoveryPortNumbers), " ", ","), "[]") - } else if cr.Spec.TargetDiscoveryOptions.DisableBuiltInPortNumbers { + } else if cr.Spec.TargetDiscoveryOptions.BuiltInPortNumbersDisabled { k8sDiscoveryPortNumbers = "" } } diff --git a/internal/controllers/reconciler_test.go b/internal/controllers/reconciler_test.go index 65f5e27db..e73e433d3 100644 --- a/internal/controllers/reconciler_test.go +++ b/internal/controllers/reconciler_test.go @@ -2618,8 +2618,8 @@ func (t *cryostatTestInput) checkMainPodTemplate(deployment *appsv1.Deployment, len(cr.Spec.TargetDiscoveryOptions.DiscoveryPortNumbers) > 0 builtInDiscoveryDisabled := cr.Spec.TargetDiscoveryOptions != nil && cr.Spec.TargetDiscoveryOptions.BuiltInDiscoveryDisabled builtInPortConfigDisabled := cr.Spec.TargetDiscoveryOptions != nil && - cr.Spec.TargetDiscoveryOptions.DisableBuiltInPortNames && - cr.Spec.TargetDiscoveryOptions.DisableBuiltInPortNumbers + cr.Spec.TargetDiscoveryOptions.BuiltInPortNamesDisabled && + cr.Spec.TargetDiscoveryOptions.BuiltInPortNumbersDisabled dbSecretProvided := cr.Spec.DatabaseOptions != nil && cr.Spec.DatabaseOptions.SecretName != nil t.checkCoreContainer(&coreContainer, ingress, reportsUrl, diff --git a/internal/test/resources.go b/internal/test/resources.go index 9fb75bc41..357d9594a 100644 --- a/internal/test/resources.go +++ b/internal/test/resources.go @@ -483,8 +483,8 @@ func (r *TestResources) NewCryostatWithDiscoveryPortConfig() *model.CryostatInst func (r *TestResources) NewCryostatWithBuiltInPortConfigDisabled() *model.CryostatInstance { cr := r.NewCryostat() cr.Spec.TargetDiscoveryOptions = &operatorv1beta2.TargetDiscoveryOptions{ - DisableBuiltInPortNames: true, - DisableBuiltInPortNumbers: true, + BuiltInPortNamesDisabled: true, + BuiltInPortNumbersDisabled: true, } return cr }