From e8b197a7fb5e395e278e4856aea6f90457c9476f Mon Sep 17 00:00:00 2001 From: Buddhi Date: Tue, 10 Sep 2019 12:34:45 +0530 Subject: [PATCH] Resolve the failure of the stateful app when PVC not specified --- pkg/apis/siddhi/v1alpha2/siddhiprocess_functions.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/apis/siddhi/v1alpha2/siddhiprocess_functions.go b/pkg/apis/siddhi/v1alpha2/siddhiprocess_functions.go index f01f665..2a794bb 100644 --- a/pkg/apis/siddhi/v1alpha2/siddhiprocess_functions.go +++ b/pkg/apis/siddhi/v1alpha2/siddhiprocess_functions.go @@ -27,10 +27,17 @@ import ( // EqualsPVCSpec function of PVC check the equality of two PV structs func EqualsPVCSpec(p *corev1.PersistentVolumeClaimSpec, q *corev1.PersistentVolumeClaimSpec) bool { - vmEq := p.VolumeMode == q.VolumeMode + vmEq := false + if p.VolumeMode != nil && q.VolumeMode != nil { + vmEq = *p.VolumeMode == *q.VolumeMode + } else if p.VolumeMode == nil && q.VolumeMode == nil { + vmEq = true + } classEq := false if p.StorageClassName != nil && q.StorageClassName != nil { classEq = *p.StorageClassName == *q.StorageClassName + } else if p.StorageClassName == nil && q.StorageClassName == nil { + classEq = true } resourceEq := reflect.DeepEqual(p.Resources, q.Resources) if len(p.AccessModes) != len(q.AccessModes) { @@ -75,7 +82,7 @@ func (p *SiddhiProcessSpec) Equals(q *SiddhiProcessSpec) bool { if !p.MessagingSystem.Equals(&q.MessagingSystem) { return false } - if EqualsPVCSpec(&p.PVC, &q.PVC) { + if !EqualsPVCSpec(&p.PVC, &q.PVC) { return false } if p.ImagePullSecret != q.ImagePullSecret {