Skip to content

Commit

Permalink
merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Matsuoka committed Feb 14, 2024
2 parents 464dc5f + a552021 commit 02818ef
Show file tree
Hide file tree
Showing 11 changed files with 352 additions and 33 deletions.
18 changes: 17 additions & 1 deletion api/v1beta1/cryostat_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,26 @@ type ReportsSecurityOptions struct {

// TargetDiscoveryOptions provides configuration options to the Cryostat application's target discovery mechanisms.
type TargetDiscoveryOptions struct {
// When true, the Cryostat application will disable the built-in discovery mechanisms. Defaults to false
// When true, the Cryostat application will disable the built-in discovery mechanisms. Defaults to false.
// +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.
Expand Down
12 changes: 11 additions & 1 deletion api/v1beta1/zz_generated.deepcopy.go

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

52 changes: 50 additions & 2 deletions bundle/manifests/cryostat-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,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
Expand Down Expand Up @@ -848,11 +872,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
Expand Down
23 changes: 22 additions & 1 deletion bundle/manifests/operator.cryostat.io_clustercryostats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4774,8 +4774,29 @@ spec:
properties:
builtInDiscoveryDisabled:
description: When true, the Cryostat application will disable
the built-in discovery mechanisms. Defaults to false
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
Expand Down
23 changes: 22 additions & 1 deletion bundle/manifests/operator.cryostat.io_cryostats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4965,8 +4965,29 @@ spec:
properties:
builtInDiscoveryDisabled:
description: When true, the Cryostat application will disable
the built-in discovery mechanisms. Defaults to false
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
trustedCertSecrets:
description: List of TLS certificates to trust when connecting to
Expand Down
23 changes: 22 additions & 1 deletion config/crd/bases/operator.cryostat.io_clustercryostats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4969,8 +4969,29 @@ spec:
properties:
builtInDiscoveryDisabled:
description: When true, the Cryostat application will disable
the built-in discovery mechanisms. Defaults to false
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
Expand Down
23 changes: 22 additions & 1 deletion config/crd/bases/operator.cryostat.io_cryostats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4965,8 +4965,29 @@ spec:
properties:
builtInDiscoveryDisabled:
description: When true, the Cryostat application will disable
the built-in discovery mechanisms. Defaults to false
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
trustedCertSecrets:
description: List of TLS certificates to trust when connecting to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,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
Expand Down Expand Up @@ -786,11 +810,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -824,12 +824,43 @@ func NewCoreContainer(cr *model.CryostatInstance, specs *ServiceSpecs, imageTag
}
}

disableBuiltInDiscovery := cr.Spec.TargetDiscoveryOptions != nil && cr.Spec.TargetDiscoveryOptions.BuiltInDiscoveryDisabled
if disableBuiltInDiscovery {
envs = append(envs, corev1.EnvVar{
Name: "CRYOSTAT_DISABLE_BUILTIN_DISCOVERY",
Value: "true",
})
if cr.Spec.TargetDiscoveryOptions != nil {
if cr.Spec.TargetDiscoveryOptions.BuiltInDiscoveryDisabled {
envs = append(envs, corev1.EnvVar{
Name: "CRYOSTAT_DISABLE_BUILTIN_DISCOVERY",
Value: "true",
})
}

var portNames string
if len(cr.Spec.TargetDiscoveryOptions.DiscoveryPortNames) > 0 {
portNames = strings.Join(cr.Spec.TargetDiscoveryOptions.DiscoveryPortNames[:], ",")
} else if cr.Spec.TargetDiscoveryOptions.DisableBuiltInPortNames {
portNames = "-"
}
if len(portNames) > 0 {
envs = append(envs,
corev1.EnvVar{
Name: "CRYOSTAT_DISCOVERY_K8S_PORT_NAMES",
Value: portNames,
},
)
}

portNumbers := ""
if len(cr.Spec.TargetDiscoveryOptions.DiscoveryPortNumbers) > 0 {
portNumbers = strings.Trim(strings.ReplaceAll(fmt.Sprint(cr.Spec.TargetDiscoveryOptions.DiscoveryPortNumbers), " ", ","), "[]")
} else if cr.Spec.TargetDiscoveryOptions.DisableBuiltInPortNumbers {
portNumbers = "0"
}
if len(portNumbers) > 0 {
envs = append(envs,
corev1.EnvVar{
Name: "CRYOSTAT_DISCOVERY_K8S_PORT_NUMBERS",
Value: portNumbers,
},
)
}
}

if !useEmptyDir(cr) {
Expand Down
Loading

0 comments on commit 02818ef

Please sign in to comment.