ceph: expand Mon Pvc's
Expand Mon Pvc's if storage request has increased for the Mons in the cephcluster crd. Signed-off-by: Nitin Goyal <nigoyal@redhat.com>
This commit is contained in:
1 parent
2e8f513197
commit
3575c3bf78
2 files changed
+19
-1
No files matched your search
@@ -1179,6 +1179,20 @@ func (c *Cluster) commitMaxMonID(monName string) error {
|
||||
var updateDeploymentAndWait = UpdateCephDeploymentAndWait
|
||||
|
||||
func (c *Cluster) updateMon(m *monConfig, d *apps.Deployment) error {
|
||||
// Expand mon PVC if storage request for mon has increased in cephcluster crd
|
||||
if c.monVolumeClaimTemplate(m) != nil {
|
||||
desiredPvc, err := c.makeDeploymentPVC(m, false)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to make mon %q pvc", d.Name)
|
||||
}
|
||||
|
||||
existingPvc, err := c.context.Clientset.CoreV1().PersistentVolumeClaims(c.Namespace).Get(context.TODO(), m.ResourceName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to fetch pvc for mon %q", m.ResourceName)
|
||||
}
|
||||
k8sutil.ExpandPVCIfRequired(c.context.Client, desiredPvc, existingPvc)
|
||||
}
|
||||
|
||||
logger.Infof("deployment for mon %s already exists. updating if needed",
|
||||
d.Name)
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import (
|
||||
"github.com/rook/rook/pkg/operator/k8sutil"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
@@ -49,8 +50,11 @@ func (c *Cluster) getLabels(monConfig *monConfig, canary, includeNewLabels bool)
|
||||
labels["mon_canary"] = "true"
|
||||
}
|
||||
if includeNewLabels {
|
||||
if c.monVolumeClaimTemplate(monConfig) != nil {
|
||||
monVolumeClaimTemplate := c.monVolumeClaimTemplate(monConfig)
|
||||
if monVolumeClaimTemplate != nil {
|
||||
size := monVolumeClaimTemplate.Spec.Resources.Requests[v1.ResourceStorage]
|
||||
labels["pvc_name"] = monConfig.ResourceName
|
||||
labels["pvc_size"] = size.String()
|
||||
}
|
||||
if monConfig.Zone != "" {
|
||||
labels["stretch-zone"] = monConfig.Zone
|
||||
|
||||
Reference in new issue
Block a user