From a68151e2f2f1d83eebd176409f4e5d800f6bba0b Mon Sep 17 00:00:00 2001 From: micalgenus Date: Sat, 15 Jan 2022 22:47:19 +0900 Subject: [PATCH] rgw: gateway deployment strategy rolling on Pacific When the strategy type of deployment is Recreate, from the moment the end is started until the new pod is normally running, there is no pod in the kubernetes service endpoints, so it goes to the service unavailable state. Therefore, it is necessary to change it to `type: RollingUpdate` instead of `type: Recreate` so that rolling updates can be made without downtime. Before Pacific, creating a deployment as much as the instance was okay, but after Pacific, the replicas was increased in one deployment, so rolling updates were set up one by one as in the previous version. Signed-off-by: micalgenus --- pkg/operator/ceph/object/spec.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pkg/operator/ceph/object/spec.go b/pkg/operator/ceph/object/spec.go index a654abc7b..ea7a7babd 100644 --- a/pkg/operator/ceph/object/spec.go +++ b/pkg/operator/ceph/object/spec.go @@ -61,9 +61,19 @@ func (c *clusterConfig) createDeployment(rgwConfig *rgwConfig) (*apps.Deployment return nil, err } replicas := int32(1) - // On Pacific, we can use the same keyring and have dedicated rgw instances reflected in the service map + strategy := apps.DeploymentStrategy{ + Type: apps.RecreateDeploymentStrategyType, + } if c.clusterInfo.CephVersion.IsAtLeastPacific() { + // On Pacific, we can use the same keyring and have dedicated rgw instances reflected in the service map replicas = c.store.Spec.Gateway.Instances + + // On Pacific, rgw gateway deployments rolling update + strategy.Type = apps.RollingUpdateDeploymentStrategyType + strategy.RollingUpdate = &apps.RollingUpdateDeployment{ + MaxUnavailable: &intstr.IntOrString{IntVal: int32(1)}, + MaxSurge: &intstr.IntOrString{IntVal: int32(0)}, + } } d := &apps.Deployment{ ObjectMeta: metav1.ObjectMeta{ @@ -77,9 +87,7 @@ func (c *clusterConfig) createDeployment(rgwConfig *rgwConfig) (*apps.Deployment }, Template: pod, Replicas: &replicas, - Strategy: apps.DeploymentStrategy{ - Type: apps.RecreateDeploymentStrategyType, - }, + Strategy: strategy, }, } k8sutil.AddRookVersionLabelToDeployment(d)