From 464dc5febe65c5d41fd99c67d21b901554bf08c4 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Wed, 14 Feb 2024 17:02:29 -0500 Subject: [PATCH] test adjustments --- api/v1beta1/cryostat_types.go | 20 ++++++++++++++ api/v1beta1/zz_generated.deepcopy.go | 36 +++++++++++++++++++++++++ internal/controllers/reconciler_test.go | 8 ++++-- 3 files changed, 62 insertions(+), 2 deletions(-) diff --git a/api/v1beta1/cryostat_types.go b/api/v1beta1/cryostat_types.go index f4f1f3687..ce9bf4107 100644 --- a/api/v1beta1/cryostat_types.go +++ b/api/v1beta1/cryostat_types.go @@ -141,6 +141,8 @@ type CryostatStatus struct { // +optional // +operator-sdk:csv:customresourcedefinitions:type=status,order=2,xDescriptors={"urn:alm:descriptor:io.kubernetes:Secret"} GrafanaSecret string `json:"grafanaSecret,omitempty"` + // Name of the Secret containing the cryostat storage connection key + StorageSecret string `json:"storageSecret,omitempty"` // Address of the deployed Cryostat web application. // +operator-sdk:csv:customresourcedefinitions:type=status,order=1,xDescriptors={"urn:alm:descriptor:org.w3:link"} ApplicationURL string `json:"applicationUrl"` @@ -287,6 +289,13 @@ type GrafanaServiceConfig struct { ServiceConfig `json:",inline"` } +type StorageServiceConfig struct { + // HTTP port number for the cryostat storage service. + // Defaults to 8333 + HTTPPort *int32 `json:"httpPort,omitempty"` + ServiceConfig `json:",inline"` +} + // ReportsServiceConfig provides customization for the service handling // traffic for the cryostat-reports sidecars. type ReportsServiceConfig struct { @@ -309,6 +318,9 @@ type ServiceConfigList struct { // Specification for the service responsible for the cryostat-reports sidecars. // +optional ReportsConfig *ReportsServiceConfig `json:"reportsConfig,omitempty"` + // Specification for the service responsible for the cryostat storage container. + // +optional + StorageConfig *StorageServiceConfig `json:"storageConfig,omitEmpty"` } // NetworkConfiguration provides customization for how to expose a Cryostat @@ -503,6 +515,14 @@ type SecurityOptions struct { // +optional // +operator-sdk:csv:customresourcedefinitions:type=spec GrafanaSecurityContext *corev1.SecurityContext `json:"grafanaSecurityContext,omitempty"` + // Security Context to apply to the storage container. + // +optional + // +operator-sdk:csv:customresourcedefinitions:type=spec + StorageSecurityContext *corev1.SecurityContext `json:"storageSecurityContext,omitempty"` + // Security Context to apply to the storage container. + // +optional + // +operator-sdk:csv:customresourcedefinitions:type=spec + DatabaseSecurityContext *corev1.SecurityContext `json:"databaseSecurityContext,omitempty"` } // ReportsSecurityOptions contains Security Context customizations for the diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 910b11dde..a9ae25503 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -761,6 +761,16 @@ func (in *SecurityOptions) DeepCopyInto(out *SecurityOptions) { *out = new(corev1.SecurityContext) (*in).DeepCopyInto(*out) } + if in.StorageSecurityContext != nil { + in, out := &in.StorageSecurityContext, &out.StorageSecurityContext + *out = new(corev1.SecurityContext) + (*in).DeepCopyInto(*out) + } + if in.DatabaseSecurityContext != nil { + in, out := &in.DatabaseSecurityContext, &out.DatabaseSecurityContext + *out = new(corev1.SecurityContext) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityOptions. @@ -825,6 +835,11 @@ func (in *ServiceConfigList) DeepCopyInto(out *ServiceConfigList) { *out = new(ReportsServiceConfig) (*in).DeepCopyInto(*out) } + if in.StorageConfig != nil { + in, out := &in.StorageConfig, &out.StorageConfig + *out = new(StorageServiceConfig) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceConfigList. @@ -862,6 +877,27 @@ func (in *StorageConfiguration) DeepCopy() *StorageConfiguration { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageServiceConfig) DeepCopyInto(out *StorageServiceConfig) { + *out = *in + if in.HTTPPort != nil { + in, out := &in.HTTPPort, &out.HTTPPort + *out = new(int32) + **out = **in + } + in.ServiceConfig.DeepCopyInto(&out.ServiceConfig) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageServiceConfig. +func (in *StorageServiceConfig) DeepCopy() *StorageServiceConfig { + if in == nil { + return nil + } + out := new(StorageServiceConfig) + in.DeepCopyInto(out) + return out +} + // 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 diff --git a/internal/controllers/reconciler_test.go b/internal/controllers/reconciler_test.go index becdf2968..eb5d22321 100644 --- a/internal/controllers/reconciler_test.go +++ b/internal/controllers/reconciler_test.go @@ -1118,8 +1118,8 @@ func (c *controllerTest) commonTests() { datasourceImg := "my/datasource-image:1.0.0-BETA25" grafanaImg := "my/grafana-image:1.0.0-dev" reportsImg := "my/reports-image:1.0.0-SNAPSHOT" - storageImg := "my/storage-image:1.0.0" - databaseImg := "my/database-image:1.0.0" + storageImg := "my/storage-image:1.0.0-dev" + databaseImg := "my/database-image:1.0.0-dev" t.EnvCoreImageTag = &coreImg t.EnvDatasourceImageTag = &datasourceImg t.EnvGrafanaImageTag = &grafanaImg @@ -1181,10 +1181,14 @@ func (c *controllerTest) commonTests() { datasourceImg := "my/datasource-image@sha256:59ded87392077c2371b26e021aade0409855b597383fa78e549eefafab8fc90c" grafanaImg := "my/grafana-image@sha256:e5bc16c2c5b69cd6fd8fdf1381d0a8b6cc9e01d92b9e1bb0a61ed89196563c72" reportsImg := "my/reports-image@sha256:8a23ca5e8c8a343789b8c14558a44a49d35ecd130c18e62edf0d1ad9ce88d37d" + storageImg := "my/reports-image@sha256:8b23ca5e8c8a343789b8c14558a44a49d35ecd130c18e62edf0d1ad9ce88d37d" + databaseImg := "my/reports-image@sha256:8c23ca5e8c8a343789b8c14558a44a49d35ecd130c18e62edf0d1ad9ce88d37d" t.EnvCoreImageTag = &coreImg t.EnvDatasourceImageTag = &datasourceImg t.EnvGrafanaImageTag = &grafanaImg t.EnvReportsImageTag = &reportsImg + t.EnvDatabaseImageTag = &databaseImg + t.EnvStorageImageTag = &storageImg }) It("should create deployment with the expected tags", func() { t.expectMainDeployment()