Skip to content

Commit 882c6c8

Browse files
committed
improvement(neutronapi): Enhance readiness probe to verify SSL certificate presence
- Updated the existing readiness probe in the Neutron API deployment to check for the presence of the internal.crt SSL certificate before marking the pod as ready. - Applied the SSL certificate check to the HTTPD container as well, ensuring secure traffic handling. - Improved the deployment reliability by ensuring that pods are only marked as ready when they have the necessary SSL certificates in place.
1 parent 7c5c6cf commit 882c6c8

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

pkg/neutronapi/deployment.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,14 @@ func Deployment(
5656
TimeoutSeconds: 30,
5757
PeriodSeconds: 30,
5858
InitialDelaySeconds: 5,
59+
Exec: &corev1.ExecAction{
60+
Command: []string{
61+
"cat",
62+
"/etc/pki/tls/certs/internal.crt",
63+
},
64+
},
5965
}
60-
args := []string{"-c", ServiceCommand}
66+
args := []string{"-c", ServiceCommand}
6167
httpdArgs := []string{"-DFOREGROUND"}
6268

6369
//
@@ -71,7 +77,7 @@ func Deployment(
7177
Path: "/",
7278
Port: intstr.IntOrString{Type: intstr.Int, IntVal: int32(NeutronPublicPort)},
7379
}
74-
80+
// Use HTTPS if TLS is enabled
7581
if instance.Spec.TLS.API.Enabled(service.EndpointPublic) {
7682
livenessProbe.HTTPGet.Scheme = corev1.URISchemeHTTPS
7783
readinessProbe.HTTPGet.Scheme = corev1.URISchemeHTTPS
@@ -93,6 +99,7 @@ func Deployment(
9399
httpdVolumeMounts = append(httpdVolumeMounts, instance.Spec.TLS.CreateVolumeMounts(nil)...)
94100
}
95101

102+
// handle TLS certificates for HTTPD
96103
for _, endpt := range []service.Endpoint{service.EndpointInternal, service.EndpointPublic} {
97104
if instance.Spec.TLS.API.Enabled(endpt) {
98105
var tlsEndptCfg tls.GenericService
@@ -134,8 +141,7 @@ func Deployment(
134141
Selector: &metav1.LabelSelector{
135142
MatchLabels: labels,
136143
},
137-
PodManagementPolicy: appsv1.ParallelPodManagement,
138-
Replicas: instance.Spec.Replicas,
144+
Replicas: instance.Spec.Replicas,
139145
Template: corev1.PodTemplateSpec{
140146
ObjectMeta: metav1.ObjectMeta{
141147
Annotations: annotations,
@@ -154,6 +160,7 @@ func Deployment(
154160
VolumeMounts: apiVolumeMounts,
155161
Resources: instance.Spec.Resources,
156162
LivenessProbe: livenessProbe,
163+
ReadinessProbe: readinessProbe,
157164
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
158165
},
159166
{
@@ -175,10 +182,9 @@ func Deployment(
175182
},
176183
},
177184
}
178-
179-
// If possible two pods of the same service should not
180-
// run on the same worker node. If this is not possible
181-
// the get still created on the same worker node.
185+
// If possible two pods of the same service should not
186+
// run on the same worker node. If this is not possible
187+
// the get still created on the same worker node.
182188
deployment.Spec.Template.Spec.Affinity = affinity.DistributePods(
183189
common.AppSelector,
184190
[]string{

0 commit comments

Comments
 (0)