skr

package
v0.0.0-...-12536fa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApplicationSecretName      = "eventing-webhook-auth"
	ApplicationSecretNamespace = "kyma-system"
	KcpNamespace               = "kcp-system"
)

Variables

View Source
var NewClient = func(k8sClient kpkgclient.Client, skrClusterID string) (Client, error) {
	kubeconfigSecretName := fmt.Sprintf("kubeconfig-%s", skrClusterID)

	secret := &kcorev1.Secret{}
	if err := k8sClient.Get(context.Background(), types.NamespacedName{Name: kubeconfigSecretName, Namespace: KcpNamespace}, secret); err != nil {
		return nil, err
	}

	kubeconfig := secret.Data["config"]
	if len(kubeconfig) == 0 {
		return nil, errors.Errorf("failed to find SKR cluster kubeconfig in secret %s", kubeconfigSecretName)
	}

	config, err := clientcmd.RESTConfigFromKubeConfig(kubeconfig)
	if err != nil {
		return nil, err
	}

	c, err := kpkgclient.New(config, kpkgclient.Options{})
	if err != nil {
		return nil, err
	}

	return &client{k8sClient: c}, nil
}

Functions

This section is empty.

Types

type Client

type Client interface {
	DeleteSecret(ctx context.Context) error
	HasApplicationSecret(ctx context.Context) (bool, error)
	CreateSecret(ctx context.Context, app eamias.Application) (kcorev1.Secret, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL