k8s

package
v0.0.0-...-d0d6462 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigMapInformer

func GetConfigMapInformer(ctx context.Context, nsName string, cmName string) cache.SharedIndexInformer

GetConfigMapInformer returns shared informer for given config map

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewK8sManagedClusterClientDoOrDie

func NewK8sManagedClusterClientDoOrDie(config *rest.Config) *Client

NewK8sManagedClusterClientDoOrDie creates a client for managed cluster or config passed

func NewK8sSelfClientDoOrDie

func NewK8sSelfClientDoOrDie() *Client

NewK8sSelfClientDoOrDie gets the new k8s go client

func (*Client) ClientInterface

func (c *Client) ClientInterface() kubernetes.Interface

func (*Client) CreateOrUpdateClusterRole

func (c *Client) CreateOrUpdateClusterRole(ctx context.Context, name string) error

CreateOrUpdateClusterRole create or updates cluster role

func (*Client) CreateOrUpdateClusterRoleBinding

func (c *Client) CreateOrUpdateClusterRoleBinding(ctx context.Context, name string, clusterRoleName string, subject rbacv1.Subject) error

CreateOrUpdateClusterRole create or updates cluster role

func (*Client) CreateOrUpdateCustomResource

func (c *Client) CreateOrUpdateCustomResource(ctx context.Context, cr *namespace.CustomResource, ns string) error

CreateCustomResource creates a custom resource

func (*Client) CreateOrUpdateK8sSecret

func (c *Client) CreateOrUpdateK8sSecret(ctx context.Context, secret *corev1.Secret, ns string) error

CreateK8sSecret function creates secret in specific namespace

func (*Client) CreateOrUpdateManagedCluster

func (c *Client) CreateOrUpdateManagedCluster(ctx context.Context, cr *v1alpha1.Cluster, ns string) error

CreateOrUpdateClusterCR creates cluster custom resource

func (*Client) CreateOrUpdateManagedNamespace

func (c *Client) CreateOrUpdateManagedNamespace(ctx context.Context, cr *v1alpha1.ManagedNamespace, ns string) error

CreateOrUpdateManagedNamespace creates/updates managed namespace

func (*Client) CreateOrUpdateNamespace

func (c *Client) CreateOrUpdateNamespace(ctx context.Context, ns *v1.Namespace) error

CreateNamespace function creates a namespace in the control plan cluster

func (*Client) CreateOrUpdateResourceQuota

func (c *Client) CreateOrUpdateResourceQuota(ctx context.Context, quota *v1.ResourceQuota, ns string) error

CreateResourceQuota function creates resource quota for a specified namespace

func (*Client) CreateOrUpdateRole

func (c *Client) CreateOrUpdateRole(ctx context.Context, role *rbacv1.Role, ns string) error

CreateOrUpdateRole create or updates role

func (*Client) CreateOrUpdateRoleBinding

func (c *Client) CreateOrUpdateRoleBinding(ctx context.Context, binding *rbacv1.RoleBinding, ns string) error

CreateOrUpdateClusterRole create or updates cluster role

func (*Client) CreateServiceAccount

func (c *Client) CreateServiceAccount(ctx context.Context, sa *corev1.ServiceAccount, ns string) error

CreateServiceAccount adds the service account

func (*Client) CreateServiceAccountForCluster

func (c *Client) CreateServiceAccountForCluster(ctx context.Context, saName string, ns string) error

CreateServiceAccountForCluster adds the service account in the target cluster

func (*Client) DeleteClusterRole

func (c *Client) DeleteClusterRole(ctx context.Context, name string) error

DeleteClusterRole deletes cluster role

func (*Client) DeleteClusterRoleBinding

func (c *Client) DeleteClusterRoleBinding(ctx context.Context, name string) error

CreateOrUpdateClusterRole create or updates cluster role

func (*Client) DeleteManagedCluster

func (c *Client) DeleteManagedCluster(ctx context.Context, cr *v1alpha1.Cluster, ns string) error

DeleteManagedCluster deletes managed cluster with propagation policy foreground

func (*Client) DeleteNamespace

func (c *Client) DeleteNamespace(ctx context.Context, name string) error

DeleteNamespace function creates a namespace in the control plan cluster

func (*Client) DeleteServiceAccount

func (c *Client) DeleteServiceAccount(ctx context.Context, saName string, ns string) error

DeleteServiceAccount deletes the service account in the target cluster

func (*Client) GetConfigMap

func (c *Client) GetConfigMap(ctx context.Context, ns string, name string) *v1.ConfigMap

func (*Client) GetK8sSecret

func (c *Client) GetK8sSecret(ctx context.Context, name string, ns string) (*corev1.Secret, error)

GetK8sSecret function retrieves the secrets

func (*Client) GetNamespace

func (c *Client) GetNamespace(ctx context.Context, name string) error

CreateNamespace function creates a namespace in the control plan cluster

func (*Client) GetServiceAccountTokenSecret

func (c *Client) GetServiceAccountTokenSecret(ctx context.Context, saName string, ns string) (string, error)

GetServiceAccountTokenSecret retrieves the token secret for a given service account

func (*Client) SetUpEventHandler

func (c *Client) SetUpEventHandler(ctx context.Context) record.EventRecorder

SetUpEventHandler sets up event handler with client-go recorder instead of creating events directly

type Interface

type Interface interface {
	SetUpEventHandler(ctx context.Context) record.EventRecorder
	GetConfigMap(ctx context.Context, ns string, name string) *v1.ConfigMap
	CreateServiceAccountForCluster(ctx context.Context, saName string, ns string) error
	CreateServiceAccount(ctx context.Context, sa *v1.ServiceAccount) error
	DeleteServiceAccount(ctx context.Context, saName string, ns string) error
	CreateOrUpdateClusterRole(ctx context.Context, name string) error
	DeleteClusterRole(ctx context.Context, name string) error
	CreateOrUpdateClusterRoleBinding(ctx context.Context, name string) error
	DeleteClusterRoleBinding(ctx context.Context, name string) error

	CreateOrUpdateRole(ctx context.Context, role *rbacv1.Role, ns string) error
	CreateOrUpdateRoleBinding(ctx context.Context, roleBinding *rbacv1.RoleBinding) error

	GetServiceAccountTokenSecret(ctx context.Context, saName string) (string, error)
	CreateOrUpdateK8sSecret(ctx context.Context, secret *v1.Secret) error
	GetK8sSecret(ctx context.Context, name string, ns string) (*v1.Secret, error)

	CreateOrUpdateNamespace(ctx context.Context, namespace *v1.Namespace) error
	DeleteNamespace(ctx context.Context, name string) error
	GetNamespace(ctx context.Context, name string) error

	CreateOrUpdateResourceQuota(ctx context.Context, quota *v1.ResourceQuota) error

	CreateOrUpdateManagedCluster(ctx context.Context, cr *v1alpha1.Cluster, ns string) error
	CreateOrUpdateCustomResource(ctx context.Context, cr *namespace.CustomResource, ns string) error
	CreateOrUpdateManagedNamespace(ctx context.Context, cr *v1alpha1.ManagedNamespace, ns string) error

	DeleteManagedCluster(ctx context.Context, name string, ns string) error
}

Interface defines required functions to be implemented by receivers

Jump to

Keyboard shortcuts

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