Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
mwangggg committed Jul 30, 2024
1 parent fd015ed commit 841cae2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ metadata:
capabilities: Seamless Upgrades
categories: Monitoring, Developer Tools
containerImage: quay.io/cryostat/cryostat-operator:4.0.0-dev
createdAt: "2024-07-30T14:31:04Z"
createdAt: "2024-07-30T18:48:36Z"
description: JVM monitoring and profiling tool
operatorframework.io/initialization-resource: |-
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ func NewOpenShiftAuthProxyContainer(cr *model.CryostatInstance, specs *ServiceSp
"--pass-basic-auth=false",
fmt.Sprintf("--upstream=http://localhost:%d/", constants.CryostatHTTPContainerPort),
fmt.Sprintf("--upstream=http://localhost:%d/grafana/", constants.GrafanaContainerPort),
fmt.Sprintf("--upstream=http://localhost:%d/storage/", constants.StorageContainerPort),
// fmt.Sprintf("--upstream=http://localhost:%d/storage/", constants.StorageContainerPort),
fmt.Sprintf("--openshift-service-account=%s", cr.Name),
"--proxy-websockets=true",
"--proxy-prefix=/oauth2",
Expand Down Expand Up @@ -1215,15 +1215,15 @@ func NewCoreContainer(cr *model.CryostatInstance, specs *ServiceSpecs, imageTag
},
{
Name: "QUARKUS_DATASOURCE_JDBC_URL",
Value: fmt.Sprintf("jdbc:postgresql://%s-database:5432/cryostat", cr.Name),
Value: fmt.Sprintf("jdbc:postgresql://%s-database.%s.svc.cluster.local:5432/cryostat", cr.Name, cr.InstallNamespace),
},
{
Name: "STORAGE_BUCKETS_ARCHIVE_NAME",
Value: "archivedrecordings",
},
{
Name: "QUARKUS_S3_ENDPOINT_OVERRIDE",
Value: fmt.Sprintf("http://%s-storage:8333", cr.Name),
Value: fmt.Sprintf("http://%s-storage.%s.svc.cluster.local:8333", cr.Name, cr.InstallNamespace),
},
{
Name: "QUARKUS_S3_PATH_STYLE_ACCESS",
Expand Down Expand Up @@ -1328,15 +1328,6 @@ func NewCoreContainer(cr *model.CryostatInstance, specs *ServiceSpecs, imageTag
envs = append(envs, reportsEnvs...)
}

envs = append(envs, corev1.EnvVar{
Name: "CRYOSTAT_SERVICES_DATABASE_URL",
Value: specs.DatabaseURL.String(),
})
envs = append(envs, corev1.EnvVar{
Name: "CRYOSTAT_SERVICES_STORAGE_URL",
Value: specs.StorageURL.String(),
})

// Define INSIGHTS_PROXY URL if Insights integration is enabled
if specs.InsightsURL != nil {
insightsEnvs := []corev1.EnvVar{
Expand Down
23 changes: 2 additions & 21 deletions internal/controllers/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2680,36 +2680,19 @@ func (t *cryostatTestInput) checkMainPodTemplate(deployment *appsv1.Deployment,
// Check that the networking environment variables are set correctly
coreContainer := template.Spec.Containers[0]
reportPort := int32(10000)
databasePort := int32(5432)
storagePort := int32(8333)
if cr.Spec.ServiceOptions != nil {
if cr.Spec.ServiceOptions.ReportsConfig != nil && cr.Spec.ServiceOptions.ReportsConfig.HTTPPort != nil {
reportPort = *cr.Spec.ServiceOptions.ReportsConfig.HTTPPort
}
if cr.Spec.ServiceOptions.DatabaseConfig != nil && cr.Spec.ServiceOptions.DatabaseConfig.HTTPPort != nil {
databasePort = *cr.Spec.ServiceOptions.DatabaseConfig.HTTPPort
}
if cr.Spec.ServiceOptions.StorageConfig != nil && cr.Spec.ServiceOptions.StorageConfig.HTTPPort != nil {
storagePort = *cr.Spec.ServiceOptions.StorageConfig.HTTPPort
}
}
var reportsUrl string
var databaseUrl string
var storageUrl string
if t.ReportReplicas == 0 {
reportsUrl = ""
} else if t.TLS {
reportsUrl = fmt.Sprintf("https://%s-reports:%d", t.Name, reportPort)
} else {
reportsUrl = fmt.Sprintf("http://%s-reports:%d", t.Name, reportPort)
}
if t.TLS {
databaseUrl = fmt.Sprintf("https://%s-database:%d", t.Name, databasePort)
storageUrl = fmt.Sprintf("https://%s-storage:%d", t.Name, storagePort)
} else {
databaseUrl = fmt.Sprintf("http://%s-database:%d", t.Name, databasePort)
storageUrl = fmt.Sprintf("http://%s-storage:%d", t.Name, storagePort)
}
ingress := !t.OpenShift &&
cr.Spec.NetworkOptions != nil && cr.Spec.NetworkOptions.CoreConfig != nil && cr.Spec.NetworkOptions.CoreConfig.IngressSpec != nil
emptyDir := cr.Spec.StorageOptions != nil && cr.Spec.StorageOptions.EmptyDir != nil && cr.Spec.StorageOptions.EmptyDir.Enabled
Expand All @@ -2722,7 +2705,7 @@ func (t *cryostatTestInput) checkMainPodTemplate(deployment *appsv1.Deployment,
cr.Spec.TargetDiscoveryOptions.DisableBuiltInPortNumbers
dbSecretProvided := cr.Spec.DatabaseOptions != nil && cr.Spec.DatabaseOptions.SecretName != nil

t.checkCoreContainer(&coreContainer, ingress, reportsUrl, databaseUrl, storageUrl,
t.checkCoreContainer(&coreContainer, ingress, reportsUrl,
emptyDir,
hasPortConfig,
builtInDiscoveryDisabled,
Expand Down Expand Up @@ -2978,8 +2961,6 @@ func (t *cryostatTestInput) checkDeploymentHasTemplates() {

func (t *cryostatTestInput) checkCoreContainer(container *corev1.Container, ingress bool,
reportsUrl string,
databaseUrl string,
storageUrl string,
emptyDir bool,
hasPortConfig bool, builtInDiscoveryDisabled bool, builtInPortConfigDisabled bool,
dbSecretProvided bool,
Expand All @@ -2992,7 +2973,7 @@ func (t *cryostatTestInput) checkCoreContainer(container *corev1.Container, ingr
Expect(container.Image).To(Equal(*t.EnvCoreImageTag))
}
Expect(container.Ports).To(ConsistOf(t.NewCorePorts()))
Expect(container.Env).To(ConsistOf(t.NewCoreEnvironmentVariables(reportsUrl, databaseUrl, storageUrl, ingress, emptyDir, hasPortConfig, builtInDiscoveryDisabled, builtInPortConfigDisabled, dbSecretProvided)))
Expect(container.Env).To(ConsistOf(t.NewCoreEnvironmentVariables(reportsUrl, ingress, emptyDir, hasPortConfig, builtInDiscoveryDisabled, builtInPortConfigDisabled, dbSecretProvided)))
Expect(container.EnvFrom).To(ConsistOf(t.NewCoreEnvFromSource()))
Expect(container.VolumeMounts).To(ConsistOf(t.NewCoreVolumeMounts()))
Expect(container.LivenessProbe).To(Equal(t.NewCoreLivenessProbe()))
Expand Down
24 changes: 4 additions & 20 deletions internal/test/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,7 @@ func (r *TestResources) NewAuthProxyPorts() []corev1.ContainerPort {
}
}

func (r *TestResources) NewCoreEnvironmentVariables(reportsUrl string, databaseUrl string, storageUrl string, ingress bool,
func (r *TestResources) NewCoreEnvironmentVariables(reportsUrl string, ingress bool,
emptyDir bool, hasPortConfig bool, builtInDiscoveryDisabled bool, builtInPortConfigDisabled bool, dbSecretProvided bool) []corev1.EnvVar {
envs := []corev1.EnvVar{
{
Expand Down Expand Up @@ -1389,15 +1389,15 @@ func (r *TestResources) NewCoreEnvironmentVariables(reportsUrl string, databaseU
},
{
Name: "QUARKUS_DATASOURCE_JDBC_URL",
Value: fmt.Sprintf("jdbc:postgresql://%s-database:5432/cryostat", r.Name),
Value: fmt.Sprintf("jdbc:postgresql://%s-database.%s.svc.cluster.local:5432/cryostat", r.Name, r.Namespace),
},
{
Name: "STORAGE_BUCKETS_ARCHIVE_NAME",
Value: "archivedrecordings",
},
{
Name: "QUARKUS_S3_ENDPOINT_OVERRIDE",
Value: fmt.Sprintf("http://%s-storage:8333", r.Name),
Value: fmt.Sprintf("http://%s-storage.%s.svc.cluster.local:8333", r.Name, r.Namespace),
},
{
Name: "QUARKUS_S3_PATH_STYLE_ACCESS",
Expand Down Expand Up @@ -1501,22 +1501,6 @@ func (r *TestResources) NewCoreEnvironmentVariables(reportsUrl string, databaseU
})
}

if databaseUrl != "" {
envs = append(envs,
corev1.EnvVar{
Name: "CRYOSTAT_SERVICES_DATABASE_URL",
Value: databaseUrl,
})
}

if storageUrl != "" {
envs = append(envs,
corev1.EnvVar{
Name: "CRYOSTAT_SERVICES_STORAGE_URL",
Value: storageUrl,
})
}

if len(r.InsightsURL) > 0 {
envs = append(envs,
corev1.EnvVar{
Expand Down Expand Up @@ -1904,7 +1888,7 @@ func (r *TestResources) NewAuthProxyArguments(authOptions *operatorv1beta2.Autho
"--pass-basic-auth=false",
"--upstream=http://localhost:8181/",
"--upstream=http://localhost:3000/grafana/",
"--upstream=http://localhost:8333/storage/",
// "--upstream=http://localhost:8333/storage/",
fmt.Sprintf("--openshift-service-account=%s", r.Name),
"--proxy-websockets=true",
"--proxy-prefix=/oauth2",
Expand Down

0 comments on commit 841cae2

Please sign in to comment.