diff --git a/api/v1beta1/cryostat_conversion_test.go b/api/v1beta1/cryostat_conversion_test.go index 80a7dc41b..ffe544866 100644 --- a/api/v1beta1/cryostat_conversion_test.go +++ b/api/v1beta1/cryostat_conversion_test.go @@ -77,8 +77,11 @@ var _ = Describe("Cryostat", func() { }) func tableEntriesTo() []TableEntry { - return append(tableEntries(), Entry("WS connections", (*test.TestResources).NewCryostatWithWsConnectionsSpecV1Beta1, - (*test.TestResources).NewCryostat)) + return append(tableEntries(), + Entry("WS connections", (*test.TestResources).NewCryostatWithWsConnectionsSpecV1Beta1, + (*test.TestResources).NewCryostat), + Entry("command config", (*test.TestResources).NewCryostatWithCommandConfigV1Beta1, + (*test.TestResources).NewCryostat)) } func tableEntriesFrom() []TableEntry { diff --git a/api/v1beta1/cryostat_types.go b/api/v1beta1/cryostat_types.go index 7b379de5b..a480a28c6 100644 --- a/api/v1beta1/cryostat_types.go +++ b/api/v1beta1/cryostat_types.go @@ -342,6 +342,13 @@ type NetworkConfigurationList struct { // +optional // +operator-sdk:csv:customresourcedefinitions:type=spec CoreConfig *NetworkConfiguration `json:"coreConfig,omitempty"` + // Specifications for how to expose the Cryostat command service, + // which serves the WebSocket command channel. + // +optional + // +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:hidden"} + // + // Deprecated: CommandConfig is no longer used. + CommandConfig *NetworkConfiguration `json:"commandConfig,omitempty"` // Specifications for how to expose Cryostat's Grafana service, // which serves the Grafana dashboard. // +optional diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index ac8c7a83b..a4098fcbd 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -403,6 +403,11 @@ func (in *NetworkConfigurationList) DeepCopyInto(out *NetworkConfigurationList) *out = new(NetworkConfiguration) (*in).DeepCopyInto(*out) } + if in.CommandConfig != nil { + in, out := &in.CommandConfig, &out.CommandConfig + *out = new(NetworkConfiguration) + (*in).DeepCopyInto(*out) + } if in.GrafanaConfig != nil { in, out := &in.GrafanaConfig, &out.GrafanaConfig *out = new(NetworkConfiguration) diff --git a/internal/test/conversion.go b/internal/test/conversion.go index ab123ddd3..c9d371d76 100644 --- a/internal/test/conversion.go +++ b/internal/test/conversion.go @@ -478,6 +478,19 @@ func (r *TestResources) NewCryostatWithWsConnectionsSpecV1Beta1() *operatorv1bet return cr } +func (r *TestResources) NewCryostatWithCommandConfigV1Beta1() *operatorv1beta1.Cryostat { + commandSVC := r.NewCommandService() + commandIng := r.newNetworkConfigurationV1Beta1(commandSVC.Name, commandSVC.Spec.Ports[0].Port) + commandIng.Annotations["command"] = "annotation" + commandIng.Labels["command"] = "label" + + cr := r.NewCryostatV1Beta1() + cr.Spec.NetworkOptions = &operatorv1beta1.NetworkConfigurationList{ + CommandConfig: &commandIng, + } + return cr +} + func (r *TestResources) NewCryostatWithReportSubprocessHeapSpecV1Beta1() *operatorv1beta1.Cryostat { cr := r.NewCryostatV1Beta1() if cr.Spec.ReportOptions == nil { diff --git a/internal/test/resources.go b/internal/test/resources.go index d94ac5403..da76eaed0 100644 --- a/internal/test/resources.go +++ b/internal/test/resources.go @@ -761,6 +761,43 @@ func (r *TestResources) NewGrafanaService() *corev1.Service { } } +func (r *TestResources) NewCommandService() *corev1.Service { + c := true + return &corev1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: r.Name + "-command", + Namespace: r.Namespace, + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: operatorv1beta2.GroupVersion.String(), + Kind: "Cryostat", + Name: r.Name, + UID: "", + Controller: &c, + }, + }, + Labels: map[string]string{ + "app": r.Name, + "component": "cryostat", + }, + }, + Spec: corev1.ServiceSpec{ + Type: corev1.ServiceTypeClusterIP, + Selector: map[string]string{ + "app": r.Name, + "component": "cryostat", + }, + Ports: []corev1.ServicePort{ + { + Name: "http", + Port: 10001, + TargetPort: intstr.FromInt(10001), + }, + }, + }, + } +} + func (r *TestResources) NewReportsService() *corev1.Service { c := true return &corev1.Service{