Skip to content

Commit

Permalink
Merge pull request #393 from umago/probe-intervals
Browse files Browse the repository at this point in the history
Tune and enhance neutron-operator probes
  • Loading branch information
openshift-merge-bot[bot] authored Aug 26, 2024
2 parents 115b95d + 63de46c commit 8d6ce42
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 29 deletions.
21 changes: 12 additions & 9 deletions pkg/neutronapi/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,21 @@ func Deployment(
labels map[string]string,
annotations map[string]string,
) (*appsv1.Deployment, error) {
// TODO(lucasagomes): Look into how to implement separated probes
// for the httpd and neutron-api containers. Right now the code uses
// the same liveness and readiness probes for both containers which
// only checks the port 9696 (NeutronPublicPort) which is the port
// that httpd is listening to. Ideally, we should also include a
// probe on port 9697 which is the port that neutron-api binds to
livenessProbe := &corev1.Probe{
// TODO might need tuning
TimeoutSeconds: 5,
PeriodSeconds: 5,
InitialDelaySeconds: 20,
TimeoutSeconds: 30,
PeriodSeconds: 30,
InitialDelaySeconds: 5,
}
readinessProbe := &corev1.Probe{
// TODO might need tuning
TimeoutSeconds: 5,
PeriodSeconds: 5,
InitialDelaySeconds: 20,
TimeoutSeconds: 30,
PeriodSeconds: 30,
InitialDelaySeconds: 5,
}
args := []string{"-c", ServiceCommand}
httpdArgs := []string{"-DFOREGROUND"}
Expand Down Expand Up @@ -148,7 +152,6 @@ func Deployment(
Env: env.MergeEnvs([]corev1.EnvVar{}, envVars),
VolumeMounts: apiVolumeMounts,
Resources: instance.Spec.Resources,
ReadinessProbe: readinessProbe,
LivenessProbe: livenessProbe,
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
},
Expand Down
1 change: 0 additions & 1 deletion test/functional/neutronapi_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,6 @@ var _ = Describe("NeutronAPI controller", func() {

nSvcContainer := deployment.Spec.Template.Spec.Containers[0]
Expect(nSvcContainer.LivenessProbe.HTTPGet.Port.IntVal).To(Equal(int32(9696)))
Expect(nSvcContainer.ReadinessProbe.HTTPGet.Port.IntVal).To(Equal(int32(9696)))
Expect(nSvcContainer.VolumeMounts).To(HaveLen(2))
Expect(nSvcContainer.Image).To(Equal(util.GetEnvVar("RELATED_IMAGE_NEUTRON_API_IMAGE_URL_DEFAULT", neutronv1.NeutronAPIContainerImage)))

Expand Down
28 changes: 9 additions & 19 deletions test/kuttl/common/assert_sample_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,11 @@ spec:
path: /
port: 9696
scheme: HTTP
initialDelaySeconds: 20
periodSeconds: 5
initialDelaySeconds: 5
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 5
timeoutSeconds: 30
name: neutron-api
readinessProbe:
failureThreshold: 3
httpGet:
path: /
port: 9696
scheme: HTTP
initialDelaySeconds: 20
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 5
resources: {}
securityContext:
runAsUser: 42435
Expand All @@ -105,21 +95,21 @@ spec:
path: /
port: 9696
scheme: HTTP
initialDelaySeconds: 20
periodSeconds: 5
initialDelaySeconds: 5
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 5
timeoutSeconds: 30
name: neutron-httpd
readinessProbe:
failureThreshold: 3
httpGet:
path: /
port: 9696
scheme: HTTP
initialDelaySeconds: 20
periodSeconds: 5
initialDelaySeconds: 5
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 5
timeoutSeconds: 30
resources: {}
securityContext:
runAsUser: 0
Expand Down

0 comments on commit 8d6ce42

Please sign in to comment.