diff --git a/api/v1beta1/cryostat_conversion.go b/api/v1beta1/cryostat_conversion.go index bf6a7d73d..fd818f608 100644 --- a/api/v1beta1/cryostat_conversion.go +++ b/api/v1beta1/cryostat_conversion.go @@ -269,7 +269,11 @@ func convertTargetDiscoveryTo(srcOpts *TargetDiscoveryOptions) *operatorv1beta2. var dstOpts *operatorv1beta2.TargetDiscoveryOptions if srcOpts != nil { dstOpts = &operatorv1beta2.TargetDiscoveryOptions{ - BuiltInDiscoveryDisabled: srcOpts.BuiltInDiscoveryDisabled, + BuiltInDiscoveryDisabled: srcOpts.BuiltInDiscoveryDisabled, + DisableBuiltInPortNames: srcOpts.DisableBuiltInPortNames, + DiscoveryPortNames: srcOpts.DiscoveryPortNames, + DisableBuiltInPortNumbers: srcOpts.DisableBuiltInPortNumbers, + DiscoveryPortNumbers: srcOpts.DiscoveryPortNumbers, } } return dstOpts @@ -551,7 +555,11 @@ func convertTargetDiscoveryFrom(srcOpts *operatorv1beta2.TargetDiscoveryOptions) var dstOpts *TargetDiscoveryOptions if srcOpts != nil { dstOpts = &TargetDiscoveryOptions{ - BuiltInDiscoveryDisabled: srcOpts.BuiltInDiscoveryDisabled, + BuiltInDiscoveryDisabled: srcOpts.BuiltInDiscoveryDisabled, + DisableBuiltInPortNames: srcOpts.DisableBuiltInPortNames, + DiscoveryPortNames: srcOpts.DiscoveryPortNames, + DisableBuiltInPortNumbers: srcOpts.DisableBuiltInPortNumbers, + DiscoveryPortNumbers: srcOpts.DiscoveryPortNumbers, } } return dstOpts diff --git a/api/v1beta1/cryostat_conversion_test.go b/api/v1beta1/cryostat_conversion_test.go index 37b78304c..ae9129692 100644 --- a/api/v1beta1/cryostat_conversion_test.go +++ b/api/v1beta1/cryostat_conversion_test.go @@ -128,6 +128,10 @@ func tableEntries() []TableEntry { (*test.TestResources).NewCryostatWithAuthProperties), Entry("built-in discovery disabled", (*test.TestResources).NewCryostatWithBuiltInDiscoveryDisabledV1Beta1, (*test.TestResources).NewCryostatWithBuiltInDiscoveryDisabled), + Entry("discovery port custom config", (*test.TestResources).NewCryostatWithDiscoveryPortConfigV1Beta1, + (*test.TestResources).NewCryostatWithDiscoveryPortConfig), + Entry("discovery port config disabled", (*test.TestResources).NewCryostatWithBuiltInPortConfigDisabledV1Beta1, + (*test.TestResources).NewCryostatWithBuiltInPortConfigDisabled), Entry("JMX cache options", (*test.TestResources).NewCryostatWithJmxCacheOptionsSpecV1Beta1, (*test.TestResources).NewCryostatWithJmxCacheOptionsSpec), Entry("WS connections", (*test.TestResources).NewCryostatWithWsConnectionsSpecV1Beta1, diff --git a/api/v1beta2/cryostat_types.go b/api/v1beta2/cryostat_types.go index 1fc0d947d..22fbeeae3 100644 --- a/api/v1beta2/cryostat_types.go +++ b/api/v1beta2/cryostat_types.go @@ -548,6 +548,22 @@ 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. + // +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"` + // 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. + // +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"` + // 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"} + DiscoveryPortNumbers []int32 `json:"discoveryPortNumbers,omitempty"` } // JmxCredentialsDatabaseOptions provides configuration options to the Cryostat application's credentials database. diff --git a/api/v1beta2/zz_generated.deepcopy.go b/api/v1beta2/zz_generated.deepcopy.go index c1850c2d1..570167226 100644 --- a/api/v1beta2/zz_generated.deepcopy.go +++ b/api/v1beta2/zz_generated.deepcopy.go @@ -340,7 +340,7 @@ func (in *CryostatSpec) DeepCopyInto(out *CryostatSpec) { if in.TargetDiscoveryOptions != nil { in, out := &in.TargetDiscoveryOptions, &out.TargetDiscoveryOptions *out = new(TargetDiscoveryOptions) - **out = **in + (*in).DeepCopyInto(*out) } if in.JmxCredentialsDatabaseOptions != nil { in, out := &in.JmxCredentialsDatabaseOptions, &out.JmxCredentialsDatabaseOptions @@ -865,6 +865,16 @@ func (in *StorageConfiguration) DeepCopy() *StorageConfiguration { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TargetDiscoveryOptions) DeepCopyInto(out *TargetDiscoveryOptions) { *out = *in + if in.DiscoveryPortNames != nil { + in, out := &in.DiscoveryPortNames, &out.DiscoveryPortNames + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.DiscoveryPortNumbers != nil { + in, out := &in.DiscoveryPortNumbers, &out.DiscoveryPortNumbers + *out = make([]int32, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetDiscoveryOptions. diff --git a/bundle/manifests/cryostat-operator.clusterserviceversion.yaml b/bundle/manifests/cryostat-operator.clusterserviceversion.yaml index 83d78572a..f7cf6fee5 100644 --- a/bundle/manifests/cryostat-operator.clusterserviceversion.yaml +++ b/bundle/manifests/cryostat-operator.clusterserviceversion.yaml @@ -100,7 +100,7 @@ metadata: capabilities: Seamless Upgrades categories: Monitoring, Developer Tools containerImage: quay.io/cryostat/cryostat-operator:2.5.0-dev - createdAt: "2024-02-12T22:09:00Z" + createdAt: "2024-02-14T20:36:04Z" description: JVM monitoring and profiling tool operatorframework.io/initialization-resource: |- { @@ -490,11 +490,35 @@ spec: displayName: Target Discovery Options path: targetDiscoveryOptions - description: When true, the Cryostat application will disable the built-in - discovery mechanisms. Defaults to false + discovery mechanisms. Defaults to false. displayName: Disable Built-in Discovery 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. + displayName: Disable Built-in Port Names + path: targetDiscoveryOptions.disableBuiltInPortNames + 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. + displayName: Disable Built-in Port Numbers + path: targetDiscoveryOptions.disableBuiltInPortNumbers + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:booleanSwitch + - description: List of port names that the Cryostat application should look + for in order to consider a target as JMX connectable. + displayName: Discovery Port Names + path: targetDiscoveryOptions.discoveryPortNames + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:targetDiscoveryOptions.disableBuiltInPortNames:true + - description: List of port numbers that the Cryostat application should look + for in order to consider a target as JMX connectable. + displayName: Discovery Port Numbers + path: targetDiscoveryOptions.discoveryPortNumbers + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:targetDiscoveryOptions.disableBuiltInPortNumbers:true - description: List of TLS certificates to trust when connecting to targets. displayName: Trusted TLS Certificates path: trustedCertSecrets @@ -900,6 +924,30 @@ 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. + displayName: Disable Built-in Port Names + path: targetDiscoveryOptions.disableBuiltInPortNames + 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. + displayName: Disable Built-in Port Numbers + path: targetDiscoveryOptions.disableBuiltInPortNumbers + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:booleanSwitch + - description: List of port names that the Cryostat application should look + for in order to consider a target as JMX connectable. + displayName: Discovery Port Names + path: targetDiscoveryOptions.discoveryPortNames + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:targetDiscoveryOptions.disableBuiltInPortNames:true + - description: List of port numbers that the Cryostat application should look + for in order to consider a target as JMX connectable. + displayName: Discovery Port Numbers + path: targetDiscoveryOptions.discoveryPortNumbers + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:targetDiscoveryOptions.disableBuiltInPortNumbers:true - description: List of TLS certificates to trust when connecting to targets. displayName: Trusted TLS Certificates path: trustedCertSecrets @@ -1693,7 +1741,7 @@ spec: displayName: Target Discovery Options path: targetDiscoveryOptions - description: When true, the Cryostat application will disable the built-in - discovery mechanisms. Defaults to false. + discovery mechanisms. Defaults to false displayName: Disable Built-in Discovery path: targetDiscoveryOptions.builtInDiscoveryDisabled x-descriptors: diff --git a/bundle/manifests/operator.cryostat.io_clustercryostats.yaml b/bundle/manifests/operator.cryostat.io_clustercryostats.yaml index b117234a9..831ebbc1c 100644 --- a/bundle/manifests/operator.cryostat.io_clustercryostats.yaml +++ b/bundle/manifests/operator.cryostat.io_clustercryostats.yaml @@ -9355,6 +9355,27 @@ 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. + type: boolean + disableBuiltInPortNumbers: + description: When true, 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 + should look for in order to consider a target as JMX connectable. + items: + type: string + type: array + discoveryPortNumbers: + description: List of port numbers that the Cryostat application + should look for in order to consider a target as JMX connectable. + items: + format: int32 + type: integer + type: array type: object targetNamespaces: description: 'List of namespaces whose workloads Cryostat should be diff --git a/bundle/manifests/operator.cryostat.io_cryostats.yaml b/bundle/manifests/operator.cryostat.io_cryostats.yaml index 25ebf2503..347253aa9 100644 --- a/bundle/manifests/operator.cryostat.io_cryostats.yaml +++ b/bundle/manifests/operator.cryostat.io_cryostats.yaml @@ -9332,6 +9332,27 @@ 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. + type: boolean + disableBuiltInPortNumbers: + description: When true, 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 + should look for in order to consider a target as JMX connectable. + items: + type: string + type: array + discoveryPortNumbers: + description: List of port numbers that the Cryostat application + should look for in order to consider a target as JMX connectable. + items: + format: int32 + type: integer + type: array type: object targetNamespaces: description: 'List of namespaces whose workloads Cryostat should be diff --git a/config/crd/bases/operator.cryostat.io_clustercryostats.yaml b/config/crd/bases/operator.cryostat.io_clustercryostats.yaml index d92d831dc..29e232ec9 100644 --- a/config/crd/bases/operator.cryostat.io_clustercryostats.yaml +++ b/config/crd/bases/operator.cryostat.io_clustercryostats.yaml @@ -9345,6 +9345,27 @@ 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. + type: boolean + disableBuiltInPortNumbers: + description: When true, 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 + should look for in order to consider a target as JMX connectable. + items: + type: string + type: array + discoveryPortNumbers: + description: List of port numbers that the Cryostat application + should look for in order to consider a target as JMX connectable. + items: + format: int32 + type: integer + type: array type: object targetNamespaces: description: 'List of namespaces whose workloads Cryostat should be diff --git a/config/crd/bases/operator.cryostat.io_cryostats.yaml b/config/crd/bases/operator.cryostat.io_cryostats.yaml index 5de7ef336..af307be48 100644 --- a/config/crd/bases/operator.cryostat.io_cryostats.yaml +++ b/config/crd/bases/operator.cryostat.io_cryostats.yaml @@ -9322,6 +9322,27 @@ 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. + type: boolean + disableBuiltInPortNumbers: + description: When true, 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 + should look for in order to consider a target as JMX connectable. + items: + type: string + type: array + discoveryPortNumbers: + description: List of port numbers that the Cryostat application + should look for in order to consider a target as JMX connectable. + items: + format: int32 + type: integer + type: array type: object targetNamespaces: description: 'List of namespaces whose workloads Cryostat should be diff --git a/config/manifests/bases/cryostat-operator.clusterserviceversion.yaml b/config/manifests/bases/cryostat-operator.clusterserviceversion.yaml index 3c3207178..42891093d 100644 --- a/config/manifests/bases/cryostat-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/cryostat-operator.clusterserviceversion.yaml @@ -399,6 +399,30 @@ 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. + displayName: Disable Built-in Port Names + path: targetDiscoveryOptions.disableBuiltInPortNames + 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. + displayName: Disable Built-in Port Numbers + path: targetDiscoveryOptions.disableBuiltInPortNumbers + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:booleanSwitch + - description: List of port names that the Cryostat application should look + for in order to consider a target as JMX connectable. + displayName: Discovery Port Names + path: targetDiscoveryOptions.discoveryPortNames + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:targetDiscoveryOptions.disableBuiltInPortNames:true + - description: List of port numbers that the Cryostat application should look + for in order to consider a target as JMX connectable. + displayName: Discovery Port Numbers + path: targetDiscoveryOptions.discoveryPortNumbers + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:targetDiscoveryOptions.disableBuiltInPortNumbers:true - description: List of TLS certificates to trust when connecting to targets. displayName: Trusted TLS Certificates path: trustedCertSecrets @@ -1202,6 +1226,30 @@ 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. + displayName: Disable Built-in Port Names + path: targetDiscoveryOptions.disableBuiltInPortNames + 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. + displayName: Disable Built-in Port Numbers + path: targetDiscoveryOptions.disableBuiltInPortNumbers + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:booleanSwitch + - description: List of port names that the Cryostat application should look + for in order to consider a target as JMX connectable. + displayName: Discovery Port Names + path: targetDiscoveryOptions.discoveryPortNames + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:targetDiscoveryOptions.disableBuiltInPortNames:true + - description: List of port numbers that the Cryostat application should look + for in order to consider a target as JMX connectable. + displayName: Discovery Port Numbers + path: targetDiscoveryOptions.discoveryPortNumbers + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:fieldDependency:targetDiscoveryOptions.disableBuiltInPortNumbers:true - description: List of TLS certificates to trust when connecting to targets. displayName: Trusted TLS Certificates path: trustedCertSecrets diff --git a/internal/test/conversion.go b/internal/test/conversion.go index b1167a327..ab123ddd3 100644 --- a/internal/test/conversion.go +++ b/internal/test/conversion.go @@ -445,6 +445,24 @@ func (r *TestResources) NewCryostatWithBuiltInDiscoveryDisabledV1Beta1() *operat return cr } +func (r *TestResources) NewCryostatWithDiscoveryPortConfigV1Beta1() *operatorv1beta1.Cryostat { + cr := r.NewCryostatV1Beta1() + cr.Spec.TargetDiscoveryOptions = &operatorv1beta1.TargetDiscoveryOptions{ + DiscoveryPortNames: []string{"custom-port-name", "another-custom-port-name"}, + DiscoveryPortNumbers: []int32{9092, 9090}, + } + return cr +} + +func (r *TestResources) NewCryostatWithBuiltInPortConfigDisabledV1Beta1() *operatorv1beta1.Cryostat { + cr := r.NewCryostatV1Beta1() + cr.Spec.TargetDiscoveryOptions = &operatorv1beta1.TargetDiscoveryOptions{ + DisableBuiltInPortNames: true, + DisableBuiltInPortNumbers: true, + } + return cr +} + func (r *TestResources) NewCryostatWithJmxCacheOptionsSpecV1Beta1() *operatorv1beta1.Cryostat { cr := r.NewCryostatV1Beta1() cr.Spec.JmxCacheOptions = &operatorv1beta1.JmxCacheOptions{ diff --git a/internal/test/resources.go b/internal/test/resources.go index b2883741d..e12902889 100644 --- a/internal/test/resources.go +++ b/internal/test/resources.go @@ -551,7 +551,7 @@ func (r *TestResources) NewCryostatWithBuiltInDiscoveryDisabled() *model.Cryosta func (r *TestResources) NewCryostatWithDiscoveryPortConfig() *model.CryostatInstance { cr := r.NewCryostat() - cr.Spec.TargetDiscoveryOptions = &operatorv1beta1.TargetDiscoveryOptions{ + cr.Spec.TargetDiscoveryOptions = &operatorv1beta2.TargetDiscoveryOptions{ DiscoveryPortNames: []string{"custom-port-name", "another-custom-port-name"}, DiscoveryPortNumbers: []int32{9092, 9090}, } @@ -560,7 +560,7 @@ func (r *TestResources) NewCryostatWithDiscoveryPortConfig() *model.CryostatInst func (r *TestResources) NewCryostatWithBuiltInPortConfigDisabled() *model.CryostatInstance { cr := r.NewCryostat() - cr.Spec.TargetDiscoveryOptions = &operatorv1beta1.TargetDiscoveryOptions{ + cr.Spec.TargetDiscoveryOptions = &operatorv1beta2.TargetDiscoveryOptions{ DisableBuiltInPortNames: true, DisableBuiltInPortNumbers: true, }