fix: storage type created by sts is incorrect (#1737)

This commit is contained in:
张启航 2023-08-09 15:45:31 +08:00 committed by GitHub
parent d98f2eea1d
commit 1a73ac996e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,18 +65,18 @@ func (v *OtherVolume) CreateVolume(define *Define) error {
return "linux" return "linux"
}(), }(),
} }
v.as.SetClaim(claim) // store claim to appService v.as.SetClaim(claim) // store claim to appService
statefulset := v.as.GetStatefulSet() //有状态组件
vo := corev1.Volume{Name: volumeMountName} vo := corev1.Volume{Name: volumeMountName}
vo.PersistentVolumeClaim = &corev1.PersistentVolumeClaimVolumeSource{ClaimName: claim.GetName(), ReadOnly: volumeReadOnly} vo.PersistentVolumeClaim = &corev1.PersistentVolumeClaimVolumeSource{ClaimName: claim.GetName(), ReadOnly: volumeReadOnly}
define.volumes = append(define.volumes, vo) if statefulset != nil {
if shareFile { statefulset.Spec.VolumeClaimTemplates = append(statefulset.Spec.VolumeClaimTemplates, *claim)
v.as.SetClaimManually(claim) logrus.Debugf("stateset.Spec.VolumeClaimTemplates: %+v", statefulset.Spec.VolumeClaimTemplates)
} else { } else {
statefulset := v.as.GetStatefulSet() //有状态组件 if shareFile {
if statefulset != nil { v.as.SetClaimManually(claim)
statefulset.Spec.VolumeClaimTemplates = append(statefulset.Spec.VolumeClaimTemplates, *claim)
logrus.Debugf("stateset.Spec.VolumeClaimTemplates: %+v", statefulset.Spec.VolumeClaimTemplates)
} }
define.volumes = append(define.volumes, vo)
} }
vm := corev1.VolumeMount{ vm := corev1.VolumeMount{