Skip to content

Commit

Permalink
Merge pull request juju#17037 from wallyworld/migration-fix
Browse files Browse the repository at this point in the history
juju#17037

There's a couple of small fixes.

Firstly, bring in a new juju/description update to handle empty provider id values in the cloud service record on import.

Secondly, add 3 separate constants for probe failure counts and set the charm container liveness failure count to 3, not 1. The startup and readiness failure counts are kept the same.

## QA steps

bootstrap 2 k8s controllers
deploy kubeflow
migrate kubeflow model to the other controller

## Links

https://bugs.launchpad.net/juju/+bug/2057695

**Jira card:** JUJU-5671
  • Loading branch information
jujubot committed Mar 13, 2024
2 parents f92399e + 2fcdd7b commit 65b78cd
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
30 changes: 23 additions & 7 deletions caas/kubernetes/provider/application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ const (
containerProbePeriod = 5
// containerProbeSuccess is the number of successful probes to mark the check as healthy.
containerProbeSuccess = 1
// containerProbeFailure is the number of failed probes to mark the check as unhealthy.
containerProbeFailure = 1
// containerLivenessProbeFailure is the number of failed liveness probes to mark the check as unhealthy.
containerLivenessProbeFailure = 3
// containerReadinessProbeFailure = 1 is the number of failed readiness probes to mark the check as unhealthy.
containerReadinessProbeFailure = 1
// containerStartupProbeFailure is the number of failed startup probes to mark the check as unhealthy.
containerStartupProbeFailure = 1
)

var (
Expand Down Expand Up @@ -1322,7 +1326,7 @@ func (a *app) ApplicationPodSpec(config caas.ApplicationConfig) (*corev1.PodSpec
TimeoutSeconds: containerProbeTimeout,
PeriodSeconds: containerProbePeriod,
SuccessThreshold: containerProbeSuccess,
FailureThreshold: containerProbeFailure,
FailureThreshold: containerLivenessProbeFailure,
}
charmContainerReadinessProbe := &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
Expand All @@ -1335,9 +1339,21 @@ func (a *app) ApplicationPodSpec(config caas.ApplicationConfig) (*corev1.PodSpec
TimeoutSeconds: containerProbeTimeout,
PeriodSeconds: containerProbePeriod,
SuccessThreshold: containerProbeSuccess,
FailureThreshold: containerProbeFailure,
FailureThreshold: containerReadinessProbeFailure,
}
charmContainerStartupProbe := &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Path: "/v1/health?level=alive",
Port: intstr.Parse(containerAgentPebblePort),
},
},
InitialDelaySeconds: containerProbeInitialDelay,
TimeoutSeconds: containerProbeTimeout,
PeriodSeconds: containerProbePeriod,
SuccessThreshold: containerProbeSuccess,
FailureThreshold: containerStartupProbeFailure,
}
charmContainerStartupProbe := charmContainerLivenessProbe
charmContainerExtraVolumeMounts := []corev1.VolumeMount{
{
Name: constants.CharmVolumeName,
Expand Down Expand Up @@ -1495,15 +1511,15 @@ func (a *app) ApplicationPodSpec(config caas.ApplicationConfig) (*corev1.PodSpec
TimeoutSeconds: containerProbeTimeout,
PeriodSeconds: containerProbePeriod,
SuccessThreshold: containerProbeSuccess,
FailureThreshold: containerProbeFailure,
FailureThreshold: containerLivenessProbeFailure,
},
ReadinessProbe: &corev1.Probe{
ProbeHandler: pebble.ReadinessHandler(pebble.WorkloadHealthCheckPort(i)),
InitialDelaySeconds: containerProbeInitialDelay,
TimeoutSeconds: containerProbeTimeout,
PeriodSeconds: containerProbePeriod,
SuccessThreshold: containerProbeSuccess,
FailureThreshold: containerProbeFailure,
FailureThreshold: containerReadinessProbeFailure,
},
// Run Pebble as root (because it's a service manager).
SecurityContext: &corev1.SecurityContext{
Expand Down
6 changes: 3 additions & 3 deletions caas/kubernetes/provider/application/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ func getPodSpec() corev1.PodSpec {
TimeoutSeconds: 1,
PeriodSeconds: 5,
SuccessThreshold: 1,
FailureThreshold: 1,
FailureThreshold: 3,
},
ReadinessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
Expand Down Expand Up @@ -619,7 +619,7 @@ func getPodSpec() corev1.PodSpec {
TimeoutSeconds: 1,
PeriodSeconds: 5,
SuccessThreshold: 1,
FailureThreshold: 1,
FailureThreshold: 3,
},
ReadinessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
Expand Down Expand Up @@ -682,7 +682,7 @@ func getPodSpec() corev1.PodSpec {
TimeoutSeconds: 1,
PeriodSeconds: 5,
SuccessThreshold: 1,
FailureThreshold: 1,
FailureThreshold: 3,
},
ReadinessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ require (
github.com/juju/clock v1.0.3
github.com/juju/cmd/v3 v3.0.14
github.com/juju/collections v1.0.4
github.com/juju/description/v5 v5.0.0
github.com/juju/description/v5 v5.0.2
github.com/juju/errors v1.0.0
github.com/juju/featureflag v1.0.0
github.com/juju/gnuflag v1.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,8 @@ github.com/juju/collections v0.0.0-20220203020748-febd7cad8a7a/go.mod h1:JWeZdyt
github.com/juju/collections v1.0.0/go.mod h1:JWeZdyttIEbkR51z2S13+J+aCuHVe0F6meRy+P0YGDo=
github.com/juju/collections v1.0.4 h1:GjL+aN512m2rVDqhPII7P6qB0e+iYFubz8sqBhZaZtk=
github.com/juju/collections v1.0.4/go.mod h1:hVrdB0Zwq9wIU1Fl6ItD2+UETeNeOEs+nGvJufVe+0c=
github.com/juju/description/v5 v5.0.0 h1:koySpaGHVTvoHlr+siRLxVKS/Jzilud5iGzjE7tldks=
github.com/juju/description/v5 v5.0.0/go.mod h1:TQsp2Z56EVab7onQY2/O6tLHznovAcckyLz/DgDfVPY=
github.com/juju/description/v5 v5.0.2 h1:gpObMHm3QAI/0mg8YG86L8z5rFXYgHFe3ukwPoNLSaE=
github.com/juju/description/v5 v5.0.2/go.mod h1:TQsp2Z56EVab7onQY2/O6tLHznovAcckyLz/DgDfVPY=
github.com/juju/errors v0.0.0-20150916125642-1b5e39b83d18/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q=
github.com/juju/errors v0.0.0-20200330140219-3fe23663418f/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q=
github.com/juju/errors v0.0.0-20210818161939-5560c4c073ff/go.mod h1:i1eL7XREII6aHpQ2gApI/v6FkVUDEBremNkcBCKYAcY=
Expand Down

0 comments on commit 65b78cd

Please sign in to comment.