From 831adc091fa4d839746437479eb4fd56e2137a01 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 8 Nov 2020 23:58:48 -0800 Subject: [PATCH] fix image comparison --- config/samples/seaweed_v1_seaweed.yaml | 8 +++----- controllers/controller_master.go | 6 ++++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config/samples/seaweed_v1_seaweed.yaml b/config/samples/seaweed_v1_seaweed.yaml index 37c1eac..869db23 100644 --- a/config/samples/seaweed_v1_seaweed.yaml +++ b/config/samples/seaweed_v1_seaweed.yaml @@ -2,9 +2,10 @@ apiVersion: seaweed.seaweedfs.com/v1 kind: Seaweed metadata: name: seaweed1 + namespace: default spec: # Add fields here - image: chrislusf/seaweedfs:2.08 + image: chrislusf/seaweedfs:2.09 volumeServerDiskCount: 1 master: replicas: 3 @@ -17,8 +18,5 @@ spec: replicas: 2 config: | [leveldb2] - # local on disk, mostly for simple single-machine setup, fairly scalable - # faster than previous leveldb, recommended. enabled = true - dir = "." # directory to store level db files - + dir = "/data/filerldb2" diff --git a/controllers/controller_master.go b/controllers/controller_master.go index 2662985..cf6e5ac 100644 --- a/controllers/controller_master.go +++ b/controllers/controller_master.go @@ -2,6 +2,7 @@ package controllers import ( "context" + "strings" "time" appsv1 "k8s.io/api/apps/v1" @@ -35,7 +36,7 @@ func (r *SeaweedReconciler) ensureMaster(seaweedCR *seaweedv1.Seaweed) (done boo return } - if !*seaweedCR.Spec.Master.ConcurrentStart { + if seaweedCR.Spec.Master.ConcurrentStart == nil || !*seaweedCR.Spec.Master.ConcurrentStart { if done, result, err = r.waitForMasterStatefulSet(seaweedCR); done { return } @@ -62,10 +63,11 @@ func (r *SeaweedReconciler) waitForMasterStatefulSet(seaweedCR *seaweedv1.Seawee for _, pod := range podList.Items { if pod.Status.Phase == corev1.PodRunning { for _, containerStatus := range pod.Status.ContainerStatuses { - if containerStatus.Image == seaweedCR.Spec.Image { + if strings.Contains(containerStatus.Image, seaweedCR.Spec.Image) { runningCounter++ break } + log.Info("pod", "name", pod.Name, "containerStatus", containerStatus) } } else { log.Info("pod", "name", pod.Name, "status", pod.Status)