Skip to content

Commit

Permalink
fix: create deploy volume is RWX (#2015)
Browse files Browse the repository at this point in the history
Signed-off-by: 张启航 <[email protected]>
  • Loading branch information
ZhangSetSail authored Nov 15, 2024
1 parent ee20769 commit 82af1cc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions worker/appm/volume/other.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type OtherVolume struct {

// CreateVolume ceph rbd volume create volume
func (v *OtherVolume) CreateVolume(define *Define) error {
statefulset := v.as.GetStatefulSet() //有状态组件
if v.svm.VolumeType == dbmodel.ShareFileVolumeType.String() {
v.svm.VolumeType = v.as.SharedStorageClass
}
Expand All @@ -52,10 +53,12 @@ func (v *OtherVolume) CreateVolume(define *Define) error {
volumeReadOnly := v.svm.IsReadOnly
labels := v.as.GetCommonLabels(map[string]string{"volume_name": v.svm.VolumeName, "version": v.as.DeployVersion, "reclaim_policy": v.svm.ReclaimPolicy})
annotations := map[string]string{"volume_name": v.svm.VolumeName}
if statefulset == nil {
v.svm.AccessMode = "RWX"
}
claim := newVolumeClaim(volumeMountName, volumeMountPath, v.svm.AccessMode, v.svm.VolumeType, v.svm.VolumeCapacity, labels, annotations)
logrus.Debugf("storage class is : %s, claim value is : %s", v.svm.VolumeType, claim.GetName())
v.as.SetClaim(claim) // store claim to appService
statefulset := v.as.GetStatefulSet() //有状态组件
v.as.SetClaim(claim) // store claim to appService
vo := corev1.Volume{Name: volumeMountName}
vo.PersistentVolumeClaim = &corev1.PersistentVolumeClaimVolumeSource{ClaimName: claim.GetName(), ReadOnly: volumeReadOnly}
if statefulset != nil {
Expand Down

0 comments on commit 82af1cc

Please sign in to comment.