func (s *SecretApplicator) Apply(ctx context.Context, ns string, secret *corev1.Secret) error {
	_, err := s.kube.CoreV1().Secrets(ns).Create(ctx, secret, metav1.CreateOptions{})
	if err != nil && kerrors.IsAlreadyExists(err) {
		_, err = s.kube.CoreV1().Secrets(ns).Update(ctx, secret, metav1.UpdateOptions{})
	}
	return err
}
Apply creates or updates a Secret.
package kube
import (
	"context"
	corev1 "k8s.io/api/core/v1"
	kerrors "k8s.io/apimachinery/pkg/api/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/kubernetes"
)
type SecretApplicator struct {
	kube kubernetes.Interface
}
func NewSecretApplicator(client kubernetes.Interface) *SecretApplicator {
	return &SecretApplicator{
		kube: client,
	}
}