Skip to content

Commit

Permalink
Merge pull request #5028 from RafalKorepta/rk/rename-confusing-functi…
Browse files Browse the repository at this point in the history
…on-name

k8s: Update
  • Loading branch information
RafalKorepta committed Jun 27, 2022
2 parents f2401e4 + 26eb66c commit 1bf57bf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
15 changes: 14 additions & 1 deletion src/go/k8s/pkg/resources/cluster_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package resources

import (
"context"
"fmt"

"github.com/go-logr/logr"
redpandav1alpha1 "github.com/redpanda-data/redpanda/src/go/k8s/apis/redpanda/v1alpha1"
Expand Down Expand Up @@ -53,7 +54,19 @@ func (r *ClusterRoleResource) Ensure(ctx context.Context) error {
if r.pandaCluster.ExternalListener() == nil {
return nil
}
_, err := CreateIfNotExists(ctx, r, r.obj(), r.logger)

obj := r.obj()
created, err := CreateIfNotExists(ctx, r, obj, r.logger)
if err != nil || created {
return err
}
var cr v1.ClusterRole
err = r.Get(ctx, r.Key(), &cr)
if err != nil {
return fmt.Errorf("error while fetching ClusterRole resource: %w", err)
}

_, err = Update(ctx, &cr, obj, r.Client, r.logger)
return err
}

Expand Down
8 changes: 4 additions & 4 deletions src/go/k8s/pkg/resources/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ func (r *StatefulSetResource) obj(
})
}

setCloudStorage(ss, r.pandaCluster)
setVolumes(ss, r.pandaCluster)

rpkStatusContainer := r.rpkStatusContainer(tlsVolumeMounts)
if rpkStatusContainer != nil {
Expand Down Expand Up @@ -613,9 +613,9 @@ func (r *StatefulSetResource) composeCURLMaintenanceCommand(
return cmd
}

// setCloudStorage manipulates v1.StatefulSet object in order to add cloud storage specific
// properties to Redpanda pod.
func setCloudStorage(
// setVolumes manipulates v1.StatefulSet object in order to add cloud storage and
// Redpanda data volume
func setVolumes(
ss *appsv1.StatefulSet, cluster *redpandav1alpha1.Cluster,
) {
pvcDataDir := preparePVCResource(datadirName, cluster.Namespace, cluster.Spec.Storage, ss.Labels)
Expand Down

0 comments on commit 1bf57bf

Please sign in to comment.