gardenclient

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DataKeyKubeConfig is the key in a secret holding the kubeconfig
	DataKeyKubeConfig = "kubeconfig"
	// DataKeyToken is the key in a secret holding the token
	DataKeyToken = "token"
	// DataKeyServiceaccountJSON is the key in a secret data holding the google service account key.
	DataKeyServiceaccountJSON = "serviceaccount.json"
)

Variables

This section is empty.

Functions

func AddServiceAccountAsProjectMember

func AddServiceAccountAsProjectMember(ctx context.Context, c client.Client, project *gardencorev1beta1.Project, serviceAccount *corev1.ServiceAccount, roles []string) error

AddServiceAccountAsProjectMember adds the service account as member to the project with the given roles

func CreateOrUpdateDiscardResult

func CreateOrUpdateDiscardResult(ctx context.Context, cs *ClientSet, obj client.Object, f controllerutil.MutateFn) error

func GetProjectByNamespace

func GetProjectByNamespace(ctx context.Context, c client.Client, namespace string) (*gardencorev1beta1.Project, error)

GetProjectByNamespace returns the project for the given namespace

func IsMember

func IsMember(members []gardencorev1beta1.ProjectMember, serviceAccount types.NamespacedName) (bool, int)

IsMember returns true together with the index in case the passed service account NamespacedName is contained in the ProjectMember list

func RemoveServiceAccountFromProjectMember

func RemoveServiceAccountFromProjectMember(ctx context.Context, c client.Client, project *gardencorev1beta1.Project, serviceAccount types.NamespacedName) error

RemoveServiceAccountFromProjectMember removes the service account from the members of the project

Types

type ClientSet

type ClientSet struct {
	// contains the configuration for the respective Kubernetes cluster
	*rest.Config

	// default controller-runtime client for the built-in Kubernetes API groups and the Garden API group
	client.Client

	// Kubernetes client containing all REST clients for the built-in Kubernetes API groups
	Kubernetes kubernetes.Interface
}

ClientSet is a struct containing the configuration for the respective Kubernetes cluster, the collection of Kubernetes clients <ClientSet> containing all REST clients for the built-in Kubernetes API groups, and the Garden which is a REST clientSet for the Garden API group.

func NewClientSet

func NewClientSet(config *rest.Config, client client.Client, kubernetes kubernetes.Interface) *ClientSet

func NewClientSetForConfig

func NewClientSetForConfig(config *rest.Config, opts client.Options) (*ClientSet, error)

NewClientSetForConfig returns a new controller ClientSet struct from a config.

func NewClientSetFromBytes

func NewClientSetFromBytes(kubeconfig []byte, opts client.Options) (*ClientSet, error)

NewClientSetFromBytes creates a new controller ClientSet struct for a given kubeconfig byte slice.

func NewClientSetFromClusterCredentials

func NewClientSetFromClusterCredentials(ctx context.Context, cs *ClientSet, credentials extensionsv1alpha1.ClusterCredentials, honourServiceAccountRef *bool, expirationSeconds *int64, scheme *runtime.Scheme) (*ClientSet, error)

func NewClientSetFromGoogleSAKey

func NewClientSetFromGoogleSAKey(ctx context.Context, cfg clientcmdapi.Config, context clientcmdapi.Context, gsaKey []byte, opts client.Options) (*ClientSet, error)

NewClientSetFromGoogleSAKey creates a new controller ClientSet struct for a given google service account key and client config.

func NewClientSetFromSecret

func NewClientSetFromSecret(ctx context.Context, config *rest.Config, secret *corev1.Secret, opts client.Options) (*ClientSet, error)

NewClientSetFromSecret creates a new controller ClientSet struct for a given secret. Client is created either from "kubeconfig" (and in case of gcp from "serviceaccount.json") or "token" and "ca.crt" data keys

func NewClientSetFromSecretRef

func NewClientSetFromSecretRef(ctx context.Context, cs *ClientSet, ref *corev1.SecretReference, scheme *runtime.Scheme) (*ClientSet, error)

NewClientSetFromSecretRef creates a new controller ClientSet struct for a given SecretReference.

func NewClientSetFromServiceAccountRef

func NewClientSetFromServiceAccountRef(ctx context.Context, cs *ClientSet, ref *corev1.ObjectReference, expirationSeconds *int64, scheme *runtime.Scheme) (*ClientSet, error)

func NewClientSetFromShootRef

func NewClientSetFromShootRef(ctx context.Context, cs *ClientSet, ref *extensionsv1alpha1.ShootRef, scheme *runtime.Scheme) (*ClientSet, error)

func (*ClientSet) CreateOrUpdateClusterRoleBinding

func (s *ClientSet) CreateOrUpdateClusterRoleBinding(ctx context.Context, name string, subject rbacv1.Subject, roleRef rbacv1.RoleRef, labelSet *labels.Set, annotationSet *utils.Set) (*rbacv1.ClusterRoleBinding, error)

func (*ClientSet) CreateOrUpdateNamespace

func (s *ClientSet) CreateOrUpdateNamespace(ctx context.Context, namespaceName string, labelSet *labels.Set, annotationSet *utils.Set) (*corev1.Namespace, error)

func (*ClientSet) CreateOrUpdateRole

func (s *ClientSet) CreateOrUpdateRole(ctx context.Context, namespace string, name string, rules []rbacv1.PolicyRule, labelSet *labels.Set, annotationSet *utils.Set) (*rbacv1.Role, error)

func (*ClientSet) CreateOrUpdateRoleBinding

func (s *ClientSet) CreateOrUpdateRoleBinding(ctx context.Context, namespace string, name string, subject rbacv1.Subject, roleRef rbacv1.RoleRef, labelSet *labels.Set, annotationSet *utils.Set) (*rbacv1.RoleBinding, error)

func (*ClientSet) CreateOrUpdateSecretData

func (s *ClientSet) CreateOrUpdateSecretData(ctx context.Context, namespace string, name string, data map[string][]byte, labelSet *labels.Set, annotationSet *utils.Set) (*corev1.Secret, error)

func (*ClientSet) CreateOrUpdateServiceAccount

func (s *ClientSet) CreateOrUpdateServiceAccount(ctx context.Context, namespace string, name string, labelSet *labels.Set, annotationSet *utils.Set) (*corev1.ServiceAccount, error)

func (*ClientSet) DeleteClusterRoleBinding

func (s *ClientSet) DeleteClusterRoleBinding(ctx context.Context, name string) error

func (*ClientSet) DeleteNamespace

func (s *ClientSet) DeleteNamespace(ctx context.Context, namespaceName string) error

func (*ClientSet) DeletePod

func (s *ClientSet) DeletePod(ctx context.Context, namespace string, name string) error

func (*ClientSet) DeleteRole

func (s *ClientSet) DeleteRole(ctx context.Context, namespace string, name string) error

func (*ClientSet) DeleteRoleBinding

func (s *ClientSet) DeleteRoleBinding(ctx context.Context, namespace string, name string) error

func (*ClientSet) DeleteSecret

func (s *ClientSet) DeleteSecret(ctx context.Context, namespace string, name string) error

func (*ClientSet) DeleteServiceAccount

func (s *ClientSet) DeleteServiceAccount(ctx context.Context, namespace string, name string) error

func (*ClientSet) RequestToken

func (s *ClientSet) RequestToken(ctx context.Context, serviceAccount *corev1.ServiceAccount, expirationSeconds *int64) (string, error)

RequestToken requests a token using the TokenRequest API for the given service account

Jump to

Keyboard shortcuts

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