Skip to content

Commit

Permalink
Revert "Set OwnerReferences for generated cm (observatorium#59)" (obs…
Browse files Browse the repository at this point in the history
…ervatorium#60)

This reverts commit e6e68f2.
  • Loading branch information
bwplotka committed Jan 20, 2021
1 parent e6e68f2 commit 48e8429
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,13 +492,10 @@ func (c *controller) sync() {
return
}

var owner []metav1.OwnerReference

statefulsets := make(map[string]*appsv1.StatefulSet)

for _, obj := range c.ssetInf.GetStore().List() {
sts := obj.(*appsv1.StatefulSet)
owner = sts.OwnerReferences
hashring, ok := sts.Labels[hashringLabelKey]

if !ok {
Expand All @@ -510,7 +507,7 @@ func (c *controller) sync() {

c.populate(hashrings, statefulsets)

if err := c.saveHashring(hashrings, owner); err != nil {
if err := c.saveHashring(hashrings); err != nil {
c.reconcileErrors.WithLabelValues(save).Inc()
level.Error(c.logger).Log("msg", "failed to save hashrings")
}
Expand Down Expand Up @@ -540,17 +537,16 @@ func (c *controller) populate(hashrings []receive.HashringConfig, statefulsets m
}
}

func (c *controller) saveHashring(hashring []receive.HashringConfig, owner []metav1.OwnerReference) error {
func (c *controller) saveHashring(hashring []receive.HashringConfig) error {
buf, err := json.Marshal(hashring)
if err != nil {
return err
}

cm := &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: c.options.configMapGeneratedName,
Namespace: c.options.namespace,
OwnerReferences: owner,
Name: c.options.configMapGeneratedName,
Namespace: c.options.namespace,
},
Data: map[string]string{
c.options.fileName: string(buf),
Expand Down

0 comments on commit 48e8429

Please sign in to comment.