Skip to content

Commit

Permalink
refactor: fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
deepthidevaki committed Nov 15, 2022
1 parent c8494ec commit 19398d8
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions go-chaos/internal/dataloss_sim_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@ package internal

import (
"context"
"errors"
"fmt"
v1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
k8sErrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/types"
"strconv"
)
Expand Down Expand Up @@ -175,27 +172,3 @@ func SetInitContainerBlockFlag(k8Client K8Client, nodeId int, flag string) error
}
return nil
}

// Works both for helm and SaaS
func (c K8Client) GetZeebeStatefulSet() (*v1.StatefulSet, error) {
namespace := c.GetCurrentNamespace()
ctx := context.TODO()

helmLabel := metav1.LabelSelector{
MatchLabels: map[string]string{"app.kubernetes.io/name": "zeebe"},
}

statefulSets := c.Clientset.AppsV1().StatefulSets(namespace)
sfs, err := statefulSets.List(ctx, metav1.ListOptions{LabelSelector: labels.Set(helmLabel.MatchLabels).String()})
if err != nil {
return nil, err
}
if len(sfs.Items) == 1 {
return &sfs.Items[0], nil
}
if len(sfs.Items) == 0 {
// On SaaS the StatefulSet is just named "zeebe" without any identifying labels
return statefulSets.Get(ctx, "zeebe", metav1.GetOptions{})
}
return nil, errors.New("could not uniquely identify the stateful set for Zeebe")
}

0 comments on commit 19398d8

Please sign in to comment.