forked from rook/rook
Merge pull request #9397 from y1r/add-context-k8sutil-rs-and-secret
core: add context to k8sutil replicaset and secret
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user