diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9a207d2..7b25c56 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,6 +28,10 @@ jobs: uses: docker/metadata-action@v4 with: images: tarantool/tarantool-operator + tags: | + # set `latest` tag for master branch + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }} + type=semver,pattern={{version}} - name: Build and push Docker image uses: docker/build-push-action@v3 diff --git a/pkg/reconciliation/steps/role/join_instances.go b/pkg/reconciliation/steps/role/join_instances.go index b743afa..13f7867 100644 --- a/pkg/reconciliation/steps/role/join_instances.go +++ b/pkg/reconciliation/steps/role/join_instances.go @@ -62,7 +62,7 @@ func (r *JoinInstancesStep[PhaseType, RoleType, CtxType, CtrlType]) Reconcile(ct continue } - if !utils.IsPodRunning(pod) || !utils.IsPodDefaultContainerReady(pod) { + if !utils.IsPodRunning(pod) || utils.IsPodDeleting(pod) { allJoined = false continue @@ -79,7 +79,7 @@ func (r *JoinInstancesStep[PhaseType, RoleType, CtxType, CtrlType]) Reconcile(ct vshard := role.GetVShardConfig() alias, err := role.GetReplicasetName(stsOrdinal) - if uuidErr != nil { + if err != nil { return Error(err) } diff --git a/pkg/utils/pods.go b/pkg/utils/pods.go index 98276f1..d48cf62 100644 --- a/pkg/utils/pods.go +++ b/pkg/utils/pods.go @@ -10,18 +10,6 @@ func IsPodRunning(pod *v1.Pod) bool { return pod.Status.Phase == v1.PodRunning } -func IsPodDefaultContainerReady(pod *v1.Pod) bool { - if !IsPodRunning(pod) { - return false - } - - if pod.Status.ContainerStatuses == nil || len(pod.Status.ContainerStatuses) == 0 { - return false - } - - return pod.Status.ContainerStatuses[0].Ready -} - // IsPodReady returns true if a pod is ready; false otherwise. func IsPodReady(pod *v1.Pod) bool { return IsPodReadyConditionTrue(pod.Status) diff --git a/test/resources/pod.go b/test/resources/pod.go index 232d4bb..98a59be 100644 --- a/test/resources/pod.go +++ b/test/resources/pod.go @@ -54,16 +54,6 @@ func (r *FakeCartridge) WithStoragePodsCreated() *FakeCartridge { func (r *FakeCartridge) WithAllPodsRunning() *FakeCartridge { for _, pod := range r.Pods { r.setPodRunning(pod) - r.setPodContainerReady(pod, PodContainerName) - } - - return r -} - -func (r *FakeCartridge) WithAllPodsReady() *FakeCartridge { - for _, pod := range r.Pods { - r.setPodReady(pod) - r.setPodContainerReady(pod, PodContainerName) } return r @@ -79,25 +69,6 @@ func (r *FakeCartridge) WithPodsRunning(names ...string) *FakeCartridge { _, ok := namesMap[pod.GetName()] if ok { r.setPodRunning(pod) - r.setPodContainerReady(pod, PodContainerName) - } - } - - return r -} - -func (r *FakeCartridge) WithPodsReady(names ...string) *FakeCartridge { - namesMap := make(map[string]bool, len(names)) - for _, name := range names { - namesMap[name] = true - } - - for _, pod := range r.Pods { - _, ok := namesMap[pod.GetName()] - if ok { - r.setPodRunning(pod) - r.setPodReady(pod) - r.setPodContainerReady(pod, PodContainerName) } } @@ -107,7 +78,6 @@ func (r *FakeCartridge) WithPodsReady(names ...string) *FakeCartridge { func (r *FakeCartridge) WithAllPodsDeleting() *FakeCartridge { for _, pod := range r.Pods { r.setPodDeleting(pod) - r.setPodContainerReady(pod, PodContainerName) } return r @@ -117,38 +87,7 @@ func (r *FakeCartridge) setPodRunning(pod *v1.Pod) { pod.Status.Phase = v1.PodRunning } -func (r *FakeCartridge) setPodReady(pod *v1.Pod) { - if pod.Status.Conditions == nil { - pod.Status.Conditions = []v1.PodCondition{} - } - - pod.Status.Conditions = append(pod.Status.Conditions, v1.PodCondition{ - Type: v1.PodReady, - Status: v1.ConditionTrue, - Reason: "Ready", - Message: "Ready", - }) -} - func (r *FakeCartridge) setPodDeleting(pod *v1.Pod) { now := metav1.Now() pod.DeletionTimestamp = &now } - -//nolint:unparam -func (r *FakeCartridge) setPodContainerReady(pod *v1.Pod, containerName string) { - if pod.Status.ContainerStatuses == nil { - pod.Status.ContainerStatuses = []v1.ContainerStatus{} - } - - started := true - - pod.Status.ContainerStatuses = append( - pod.Status.ContainerStatuses, - v1.ContainerStatus{ - Name: containerName, - Ready: true, - Started: &started, - }, - ) -}