MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / sslClient

Function sslClient

tests/utils/objectstore/objectstore.go:505–553  ·  view source on GitHub ↗

sslClient returns the Deployment definition for an S3 client using SSL

(namespace string)

Source from the content-addressed store, hash-verified

503
504// sslClient returns the Deployment definition for an S3 client using SSL
505func sslClient(namespace string) appsv1.Deployment {
506 const (
507 caSecretName = "object-store-ca-secret"
508 tlsVolumeName = "secret-volume"
509 tlsVolumeMountPath = "/etc/secrets/ca"
510 )
511 var secretMode int32 = 0o600
512
513 clientDeployment := defaultClient(namespace)
514 podSpec := &clientDeployment.Spec.Template.Spec
515 podSpec.Volumes = append(podSpec.Volumes,
516 corev1.Volume{
517 Name: tlsVolumeName,
518 VolumeSource: corev1.VolumeSource{
519 Secret: &corev1.SecretVolumeSource{
520 SecretName: caSecretName,
521 DefaultMode: &secretMode,
522 },
523 },
524 },
525 )
526 podSpec.Containers[0].VolumeMounts = append(
527 podSpec.Containers[0].VolumeMounts,
528 corev1.VolumeMount{
529 Name: tlsVolumeName,
530 MountPath: tlsVolumeMountPath,
531 },
532 )
533 endpointUpdated := false
534 for i := range podSpec.Containers[0].Env {
535 if podSpec.Containers[0].Env[i].Name == "AWS_ENDPOINT_URL" {
536 podSpec.Containers[0].Env[i].Value = "https://object-store.object-store:9000"
537 endpointUpdated = true
538 break
539 }
540 }
541 if !endpointUpdated {
542 panic("sslClient: AWS_ENDPOINT_URL not found in defaultClient env")
543 }
544 podSpec.Containers[0].Env = append(
545 podSpec.Containers[0].Env,
546 corev1.EnvVar{
547 Name: "AWS_CA_BUNDLE",
548 Value: tlsVolumeMountPath + "/ca.crt",
549 },
550 )
551
552 return clientDeployment
553}
554
555// Deploy will create a full object storage deployment defined in the storeEnv variable
556func Deploy(storeEnv *Env, env *environment.TestingEnvironment) (*appsv1.Deployment, error) {

Callers 1

DeployFunction · 0.85

Calls 1

defaultClientFunction · 0.85

Tested by

no test coverage detected