Skip to content

Commit

Permalink
correct envtests
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Nov 1, 2024
1 parent 67cd857 commit f19babf
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 22 deletions.
4 changes: 2 additions & 2 deletions internal/controllers/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3067,7 +3067,7 @@ func (t *cryostatTestInput) checkMainPodTemplate(deployment *appsv1.Deployment,
Expect(template.Spec.SecurityContext).To(Equal(t.NewPodSecurityContext(cr)))

// Check that the networking environment variables are set correctly
Expect(len(template.Spec.Containers)).To(Equal(7))
Expect(len(template.Spec.Containers)).To(Equal(5))
coreContainer := template.Spec.Containers[0]
reportPort := int32(10000)
if cr.Spec.ServiceOptions != nil {
Expand Down Expand Up @@ -3116,7 +3116,7 @@ func (t *cryostatTestInput) checkMainPodTemplate(deployment *appsv1.Deployment,
t.checkAuthProxyContainer(&authProxyContainer, t.NewAuthProxyContainerResource(cr), t.NewAuthProxySecurityContext(cr), cr.Spec.AuthorizationOptions)

// Check that Agent Proxy is configured properly
agentProxyContainer := template.Spec.Containers[6]
agentProxyContainer := template.Spec.Containers[4]
t.checkAgentProxyContainer(&agentProxyContainer, t.NewAgentProxyContainerResource(cr), t.NewAgentProxySecurityContext(cr))

// Check that the proper Service Account is set
Expand Down
47 changes: 27 additions & 20 deletions internal/test/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -1582,6 +1582,11 @@ func (r *TestResources) NewAgentProxyPorts() []corev1.ContainerPort {

func (r *TestResources) NewCoreEnvironmentVariables(reportsUrl string, ingress bool,
emptyDir bool, hasPortConfig bool, builtInDiscoveryDisabled bool, builtInPortConfigDisabled bool, dbSecretProvided bool) []corev1.EnvVar {
storageProtocol := "http"
// TODO
// if r.TLS {
// storageProtocol = "https"
// }
envs := []corev1.EnvVar{
{
Name: "QUARKUS_HTTP_HOST",
Expand Down Expand Up @@ -1629,7 +1634,7 @@ func (r *TestResources) NewCoreEnvironmentVariables(reportsUrl string, ingress b
},
{
Name: "QUARKUS_S3_ENDPOINT_OVERRIDE",
Value: fmt.Sprintf("https://%s-storage.%s.svc.cluster.local:8333", r.Name, r.Namespace),
Value: fmt.Sprintf("%s://%s-storage.%s.svc.cluster.local:8333", storageProtocol, r.Name, r.Namespace),
},
{
Name: "QUARKUS_S3_PATH_STYLE_ACCESS",
Expand Down Expand Up @@ -2211,14 +2216,15 @@ func (r *TestResources) NewStorageVolumeMounts() []corev1.VolumeMount {
SubPath: "seaweed",
})

if r.TLS {
mounts = append(mounts,
corev1.VolumeMount{
Name: "storage-tls-secret",
MountPath: fmt.Sprintf("/var/run/secrets/operator.cryostat.io/%s-storage-tls", r.Name),
ReadOnly: true,
})
}
// TODO
// if r.TLS {
// mounts = append(mounts,
// corev1.VolumeMount{
// Name: "storage-tls-secret",
// MountPath: fmt.Sprintf("/var/run/secrets/operator.cryostat.io/%s-storage-tls", r.Name),
// ReadOnly: true,
// })
// }
return mounts
}

Expand All @@ -2231,14 +2237,15 @@ func (r *TestResources) NewDatabaseVolumeMounts() []corev1.VolumeMount {
SubPath: "postgres",
})

if r.TLS {
mounts = append(mounts,
corev1.VolumeMount{
Name: "database-tls-secret",
MountPath: fmt.Sprintf("/var/run/secrets/operator.cryostat.io/%s-database-tls", r.Name),
ReadOnly: true,
})
}
// TODO
// if r.TLS {
// mounts = append(mounts,
// corev1.VolumeMount{
// Name: "database-tls-secret",
// MountPath: fmt.Sprintf("/var/run/secrets/operator.cryostat.io/%s-database-tls", r.Name),
// ReadOnly: true,
// })
// }
return mounts
}

Expand Down Expand Up @@ -2385,9 +2392,9 @@ func (r *TestResources) NewDatasourceLivenessProbe() *corev1.Probe {
func (r *TestResources) NewStorageLivenessProbe() *corev1.Probe {
protocol := corev1.URISchemeHTTP

if r.TLS {
protocol = corev1.URISchemeHTTPS
}
// if r.TLS {
// protocol = corev1.URISchemeHTTPS
// }
return &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Expand Down

0 comments on commit f19babf

Please sign in to comment.