Skip to content

Commit

Permalink
Merge "Update all statefulset updateR to only update PodTemplateSpec"
Browse files Browse the repository at this point in the history
  • Loading branch information
Microzuul CI authored and Gerrit Code Review committed Nov 29, 2023
2 parents 82eab55 + b3abef6 commit f903fac
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions controllers/git_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,20 @@ func (r *SFController) DeployGitServer() bool {
}

// Create the deployment
dep := r.mkStatefulSet(gsIdent, base.GitServerImage, r.getStorageConfOrDefault(r.cr.Spec.GitServer.Storage), apiv1.ReadWriteOnce)
dep.Spec.Template.ObjectMeta.Annotations = annotations
dep.Spec.Template.Spec.Containers[0].VolumeMounts = []apiv1.VolumeMount{
sts := r.mkStatefulSet(gsIdent, base.GitServerImage, r.getStorageConfOrDefault(r.cr.Spec.GitServer.Storage), apiv1.ReadWriteOnce)
sts.Spec.Template.ObjectMeta.Annotations = annotations
sts.Spec.Template.Spec.Containers[0].VolumeMounts = []apiv1.VolumeMount{
{
Name: gsIdent,
MountPath: gsGitMountPath,
},
}

dep.Spec.Template.Spec.Volumes = []apiv1.Volume{
sts.Spec.Template.Spec.Volumes = []apiv1.Volume{
base.MkVolumeCM(gsIdent+"-pi", gsIdent+"-pi-config-map"),
}

dep.Spec.Template.Spec.Containers[0].Ports = []apiv1.ContainerPort{
sts.Spec.Template.Spec.Containers[0].Ports = []apiv1.ContainerPort{
base.MkContainerPort(gsGitPort, gsGitPortName),
}

Expand Down Expand Up @@ -115,7 +115,7 @@ func (r *SFController) DeployGitServer() bool {
base.MkEnvVar("CONFIG_ZUUL_CONNECTION_NAME", r.cr.Spec.ConfigLocation.ZuulConnectionName))
}

dep.Spec.Template.Spec.InitContainers = []apiv1.Container{initContainer}
sts.Spec.Template.Spec.InitContainers = []apiv1.Container{initContainer}

// Create readiness probes
// Note: The probe is causing error message to be logged by the service
Expand All @@ -125,12 +125,12 @@ func (r *SFController) DeployGitServer() bool {
if r.GetM(gsIdent, &current) {
if !utils.MapEquals(&current.Spec.Template.ObjectMeta.Annotations, &annotations) {
r.log.V(1).Info("System configuration needs to be updated, restarting git-server...")
current.Spec = dep.DeepCopy().Spec
current.Spec.Template = *sts.Spec.Template.DeepCopy()
r.UpdateR(&current)
return false
}
} else {
current := dep
current := sts
r.CreateR(&current)
}

Expand Down
2 changes: 1 addition & 1 deletion controllers/nodepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ func (r *SFController) DeployNodepoolBuilder(statsdExporterVolume apiv1.Volume,
if r.GetM(builderIdent, &current) {
if !utils.MapEquals(&current.Spec.Template.ObjectMeta.Annotations, &annotations) {
r.log.V(1).Info("Nodepool-builder configuration changed, rollout pods ...")
current.Spec = nb.DeepCopy().Spec
current.Spec.Template = *nb.Spec.Template.DeepCopy()
r.UpdateR(&current)
return false
}
Expand Down
2 changes: 1 addition & 1 deletion controllers/zuul.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ func (r *SFController) EnsureZuulScheduler(initContainers []apiv1.Container, cfg
if r.GetM("zuul-scheduler", &current) {
if !utils.MapEquals(&current.Spec.Template.ObjectMeta.Annotations, &annotations) {
r.log.V(1).Info("zuul-scheduler configuration changed, rollout zuul-scheduler pods ...")
current.Spec = zs.DeepCopy().Spec
current.Spec.Template = *zs.Spec.Template.DeepCopy()
r.UpdateR(&current)
return false
}
Expand Down

0 comments on commit f903fac

Please sign in to comment.