Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement(neutronapi): Enhance readiness probe to verify SSL certificate presenceAdd #403

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions pkg/neutronapi/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,14 @@ func Deployment(
TimeoutSeconds: 30,
PeriodSeconds: 30,
InitialDelaySeconds: 5,
Exec: &corev1.ExecAction{
Command: []string{
"cat",
"/etc/pki/tls/certs/internal.crt",
},
},
}
args := []string{"-c", ServiceCommand}
args := []string{"-c", ServiceCommand}
httpdArgs := []string{"-DFOREGROUND"}

//
Expand All @@ -71,7 +77,7 @@ func Deployment(
Path: "/",
Port: intstr.IntOrString{Type: intstr.Int, IntVal: int32(NeutronPublicPort)},
}

// Use HTTPS if TLS is enabled
if instance.Spec.TLS.API.Enabled(service.EndpointPublic) {
livenessProbe.HTTPGet.Scheme = corev1.URISchemeHTTPS
readinessProbe.HTTPGet.Scheme = corev1.URISchemeHTTPS
Expand All @@ -93,6 +99,7 @@ func Deployment(
httpdVolumeMounts = append(httpdVolumeMounts, instance.Spec.TLS.CreateVolumeMounts(nil)...)
}

// handle TLS certificates for HTTPD
for _, endpt := range []service.Endpoint{service.EndpointInternal, service.EndpointPublic} {
if instance.Spec.TLS.API.Enabled(endpt) {
var tlsEndptCfg tls.GenericService
Expand Down Expand Up @@ -153,6 +160,7 @@ func Deployment(
VolumeMounts: apiVolumeMounts,
Resources: instance.Spec.Resources,
LivenessProbe: livenessProbe,
ReadinessProbe: readinessProbe,
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
{
Expand All @@ -175,9 +183,9 @@ func Deployment(
},
}

// If possible two pods of the same service should not
// run on the same worker node. If this is not possible
// the get still created on the same worker node.
// If possible two pods of the same service should not
// run on the same worker node. If this is not possible
// the get still created on the same worker node.
deployment.Spec.Template.Spec.Affinity = affinity.DistributePods(
common.AppSelector,
[]string{
Expand Down
Loading