Skip to content

Commit

Permalink
Merge pull request #9397 from y1r/add-context-k8sutil-rs-and-secret
Browse files Browse the repository at this point in the history
core: add context to k8sutil replicaset and secret
  • Loading branch information
leseb committed Dec 13, 2021
2 parents 3309e9a + b6ce262 commit b10e341
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/operator/ceph/controller/mirror_peer.go
Expand Up @@ -107,7 +107,7 @@ func CreateBootstrapPeerSecret(ctx *clusterd.Context, clusterInfo *cephclient.Cl

// Create Secret
logger.Debugf("store %s-mirror bootstrap token in a Kubernetes Secret %q in namespace %q", daemonType, s.Name, ns)
_, err = k8sutil.CreateOrUpdateSecret(ctx.Clientset, s)
_, err = k8sutil.CreateOrUpdateSecret(clusterInfo.Context, ctx.Clientset, s)
if err != nil && !kerrors.IsAlreadyExists(err) {
return ImmediateRetryResult, errors.Wrapf(err, "failed to create %s-mirror bootstrap peer %q secret", daemonType, s.Name)
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/operator/k8sutil/replicaset.go
Expand Up @@ -24,8 +24,7 @@ import (
)

// DeleteReplicaSet makes a best effort at deleting a deployment and its pods, then waits for them to be deleted
func DeleteReplicaSet(clientset kubernetes.Interface, namespace, name string) error {
ctx := context.TODO()
func DeleteReplicaSet(ctx context.Context, clientset kubernetes.Interface, namespace, name string) error {
deleteAction := func(options *metav1.DeleteOptions) error {
return clientset.AppsV1().ReplicaSets(namespace).Delete(ctx, name, *options)
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/operator/k8sutil/secret.go
Expand Up @@ -27,8 +27,7 @@ import (
)

// CreateOrUpdateSecret creates a secret or updates the secret declaratively if it already exists.
func CreateOrUpdateSecret(clientset kubernetes.Interface, secretDefinition *v1.Secret) (*v1.Secret, error) {
ctx := context.TODO()
func CreateOrUpdateSecret(ctx context.Context, clientset kubernetes.Interface, secretDefinition *v1.Secret) (*v1.Secret, error) {
name := secretDefinition.Name
logger.Debugf("creating secret %s", name)

Expand Down

0 comments on commit b10e341

Please sign in to comment.