Skip to content

Commit

Permalink
udpate
Browse files Browse the repository at this point in the history
  • Loading branch information
mwangggg committed Mar 8, 2024
1 parent 0d9cb0e commit 3e9b049
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 2 deletions.
7 changes: 5 additions & 2 deletions api/v1beta1/cryostat_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 7 additions & 0 deletions api/v1beta1/cryostat_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

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

13 changes: 13 additions & 0 deletions internal/test/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
37 changes: 37 additions & 0 deletions internal/test/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 3e9b049

Please sign in to comment.