Skip to content

Commit

Permalink
Revert "remove unused code blocks"
Browse files Browse the repository at this point in the history
This reverts commit 700e8bd.
  • Loading branch information
raghu-nandan-bs committed Nov 14, 2023
1 parent 1780c56 commit bbf6f34
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions service/k8s/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package k8s

import (
"context"
"encoding/json"
"fmt"
"strconv"
"strings"
Expand Down Expand Up @@ -38,6 +39,8 @@ type StatefulSetService struct {
metricsRecorder metrics.Recorder
}

var previousSS appsv1.StatefulSet

// NewStatefulSetService returns a new StatefulSet KubeService.
func NewStatefulSetService(kubeClient kubernetes.Interface, logger log.Logger, metricsRecorder metrics.Recorder) *StatefulSetService {
logger = logger.With("service", "k8s.statefulSet")
Expand Down Expand Up @@ -176,6 +179,8 @@ func (s *StatefulSetService) CreateOrUpdateStatefulSet(namespace string, statefu
}
s.logger.Debugf("%v/%v statefulset has a different resource hash, updating the object...", statefulSet.Namespace, statefulSet.Name)
addHashAnnotation(statefulSet)
previousSS = *statefulSet

}

return s.UpdateStatefulSet(namespace, statefulSet)
Expand All @@ -195,3 +200,12 @@ func (s *StatefulSetService) ListStatefulSets(namespace string) (*appsv1.Statefu
recordMetrics(namespace, "StatefulSet", metrics.NOT_APPLICABLE, "LIST", err, s.metricsRecorder)
return stsList, err
}

func StatefulsetToJson(sts appsv1.StatefulSet) {
// convert statefulset object to json string
stsJson, err := json.Marshal(sts)
if err != nil {
fmt.Println(err)
}
fmt.Println(string(stsJson))
}

0 comments on commit bbf6f34

Please sign in to comment.