resource

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package resource contains implementation of k8s.Resource interface for various k8s resources.

Index

Constants

View Source
const (
	APIv1             = "v1"
	APIappsv1         = "apps/v1"
	APIextv1beta1     = "extensions/v1beta1"
	APIrbacv1         = "rbac.authorization.k8s.io/v1"
	APIstoragev1      = "storage.k8s.io/v1"
	APIstoragev1beta1 = "storage.k8s.io/v1beta1"
)

k8s APIVersion constants.

View Source
const CSIDriverKind = "CSIDriver"

CSIDriverKind is the name of the k8s CSIDriver resource kind.

View Source
const ClusterRoleBindingKind = "ClusterRoleBinding"

ClusterRoleBindingKind is the name of k8s ClusterRoleBinding resource kind.

View Source
const ClusterRoleKind = "ClusterRole"

ClusterRoleKind is the name of the k8s ClusterRole resource kind.

View Source
const ConfigMapKind = "ConfigMap"

ConfigMapKind is the name of k8s ConfigMap resource kind.

View Source
const DaemonSetKind = "DaemonSet"

DaemonSetKind is the name of k8s DaemonSet resource kind.

View Source
const DeploymentKind = "Deployment"

DeploymentKind is the name of k8s Deployment resource kind.

View Source
const IngressKind = "Ingress"

IngressKind is the name of k8s Ingress resource kind.

View Source
const PVCKind = "PersistentVolumeClaim"

PVCKind is the name of the k8s PersistentVolumeClaim resource kind.

View Source
const RoleBindingKind = "RoleBinding"

RoleBindingKind is the name of k8s RoleBinding resource kind.

View Source
const RoleKind = "Role"

RoleKind is the name of k8s Role resource kind.

View Source
const SecretKind = "Secret"

SecretKind is the name of the k8s Secret resource kind.

View Source
const ServiceAccountKind = "ServiceAccount"

ServiceAccountKind is the name of k8s ServiceAccount resource kind.

View Source
const ServiceKind = "Service"

ServiceKind is the name of k8s Service resource kind.

View Source
const StatefulSetKind = "StatefulSet"

StatefulSetKind is the name of the k8s StatefulSet resource kind.

View Source
const StorageClassKind = "StorageClass"

StorageClassKind is the name of k8s StorageClass resource kind.

Variables

This section is empty.

Functions

func CreateOrUpdate

func CreateOrUpdate(c client.Client, obj runtime.Object) error

CreateOrUpdate creates or updates an existing k8s resource.

func Delete

func Delete(c client.Client, obj runtime.Object) error

Delete deletes a k8s resource.

Types

type CSIDriver

type CSIDriver struct {
	types.NamespacedName
	// contains filtered or unexported fields
}

CSIDriver implements k8s.Resource interface for k8s CSIDriver resource.

func NewCSIDriver

func NewCSIDriver(
	c client.Client,
	name string,
	labels map[string]string,
	spec *storagev1beta1.CSIDriverSpec) *CSIDriver

NewCSIDriver returns an initialized CSIDriver.

func (CSIDriver) Create

func (c CSIDriver) Create() error

Create creates a CSIDriver.

func (CSIDriver) Delete

func (c CSIDriver) Delete() error

Delete deletes a CSIDriver.

func (CSIDriver) Get

Get returns an existing CSIDriver and an error if any.

type ClusterRole

type ClusterRole struct {
	types.NamespacedName
	// contains filtered or unexported fields
}

ClusterRole implements k8s.Resource interface for k8s ClusterRole resource.

func NewClusterRole

func NewClusterRole(
	c client.Client,
	name string,
	labels map[string]string,
	rules []rbacv1.PolicyRule) *ClusterRole

NewClusterRole returns an initialized ClusterRole.

func (ClusterRole) Create

func (c ClusterRole) Create() error

Create creates a ClusterRole.

func (ClusterRole) Delete

func (c ClusterRole) Delete() error

Delete deletes a ClusterRole resource.

func (ClusterRole) Get

func (c ClusterRole) Get() (*rbacv1.ClusterRole, error)

Get returns an existing ClusterRole and an error if any.

type ClusterRoleBinding

type ClusterRoleBinding struct {
	types.NamespacedName
	// contains filtered or unexported fields
}

ClusterRoleBinding implements k8s.Resource interface for k8s ClusterRoleBinding.

func NewClusterRoleBinding

func NewClusterRoleBinding(
	c client.Client,
	name string,
	labels map[string]string,
	subjects []rbacv1.Subject,
	roleRef *rbacv1.RoleRef) *ClusterRoleBinding

NewClusterRoleBinding returns an initialized ClusterRoleBinding.

func (ClusterRoleBinding) Create

func (c ClusterRoleBinding) Create() error

Create creates a ClusterRoleBinding.

func (ClusterRoleBinding) Delete

func (c ClusterRoleBinding) Delete() error

Delete deletes a ClusterRoleBinding resources.

func (ClusterRoleBinding) Get

Get returns an existing ClusterRoleBinding and an error if any.

type ConfigMap

type ConfigMap struct {
	types.NamespacedName
	// contains filtered or unexported fields
}

ConfigMap implements k8s.Resource interface for k8s ConfigMap resource.

func NewConfigMap

func NewConfigMap(c client.Client, name, namespace string, labels map[string]string, data map[string]string) *ConfigMap

NewConfigMap returns an initialized ConfigMap.

func (ConfigMap) Create

func (cm ConfigMap) Create() error

Create creates a new k8s ConfigMap resource.

func (ConfigMap) Delete

func (cm ConfigMap) Delete() error

Delete deletes an existing k8s resource.

func (ConfigMap) Get

func (cm ConfigMap) Get() (*corev1.ConfigMap, error)

Get returns an existing ConfigMap and an error if any.

type DaemonSet

type DaemonSet struct {
	types.NamespacedName
	// contains filtered or unexported fields
}

DaemonSet implements k8s.Resource interface for k8s DaemonSet resource.

func NewDaemonSet

func NewDaemonSet(
	c client.Client,
	name, namespace string,
	labels map[string]string,
	spec *appsv1.DaemonSetSpec) *DaemonSet

NewDaemonSet returns an initialized DaemonSet.

func (DaemonSet) Create

func (d DaemonSet) Create() error

Create creates a new k8s DaemonSet resource.

func (DaemonSet) Delete

func (d DaemonSet) Delete() error

Delete deletes an existing DaemonSet resource.

func (DaemonSet) Get

func (d DaemonSet) Get() (*appsv1.DaemonSet, error)

Get returns an existing DaemonSet and an error if any.

type Deployment

type Deployment struct {
	types.NamespacedName
	// contains filtered or unexported fields
}

Deployment implements k8s.Resource interface for k8s Deployment resource.

func NewDeployment

func NewDeployment(
	c client.Client,
	name, namespace string,
	labels map[string]string,
	spec *appsv1.DeploymentSpec) *Deployment

NewDeployment returns an initialized Deployment.

func (Deployment) Create

func (d Deployment) Create() error

Create creates a new Deployment resource.

func (Deployment) Delete

func (d Deployment) Delete() error

Delete deletes an existing Deployment resource.

func (Deployment) Get

func (d Deployment) Get() (*appsv1.Deployment, error)

Get returns an existing Deployment and an error if any.

type Ingress

type Ingress struct {
	types.NamespacedName
	// contains filtered or unexported fields
}

Ingress implements k8s.Resource interface for k8s Ingress resource.

func NewIngress

func NewIngress(
	c client.Client,
	name, namespace string,
	labels map[string]string,
	annotations map[string]string,
	spec *extensionsv1beta1.IngressSpec) *Ingress

NewIngress returns an initialized Ingress.

func (Ingress) Create

func (i Ingress) Create() error

Create creates a new Ingress resource.

func (Ingress) Delete

func (i Ingress) Delete() error

Delete deletes an existing Ingress resource.

func (Ingress) Get

func (i Ingress) Get() (*extensionsv1beta1.Ingress, error)

Get returns an existing Ingress and an error if any.

type PVC

type PVC struct {
	types.NamespacedName
	// contains filtered or unexported fields
}

PVC implements k8s.Resource interface for k8s PersistentVolumeClaim resource.

func NewPVC

func NewPVC(
	c client.Client,
	name, namespace string,
	labels map[string]string,
	spec *corev1.PersistentVolumeClaimSpec) *PVC

NewPVC returns an initialized PVC.

func (PVC) Create

func (p PVC) Create() error

Create creates a PVC.

func (PVC) Delete

func (p PVC) Delete() error

Delete deletes a PVC.

func (PVC) Get

func (p PVC) Get() (*corev1.PersistentVolumeClaim, error)

Get returns an existing PVC and an error if any.

type Role

type Role struct {
	types.NamespacedName
	// contains filtered or unexported fields
}

Role implements k8s.Resource interface for k8s Role resource.

func NewRole

func NewRole(
	c client.Client,
	name, namespace string,
	labels map[string]string,
	rules []rbacv1.PolicyRule) *Role

NewRole returns an initialized Role.

func (*Role) Create

func (r *Role) Create() error

Create creates a k8s Role resource.

func (*Role) Delete

func (r *Role) Delete() error

Delete deletes a k8s Role resource.

func (Role) Get

func (r Role) Get() (*rbacv1.Role, error)

Get returns an existing Role and an error if any.

type RoleBinding

type RoleBinding struct {
	types.NamespacedName
	// contains filtered or unexported fields
}

RoleBinding implements k8s.Resource interface for k8s RoleBinding resource.

func NewRoleBinding

func NewRoleBinding(
	c client.Client,
	name, namespace string,
	labels map[string]string,
	subjects []rbacv1.Subject,
	roleRef *rbacv1.RoleRef) *RoleBinding

NewRoleBinding returns an initialized RoleBinding.

func (*RoleBinding) Create

func (r *RoleBinding) Create() error

Create creates a RoleBinding resource.

func (*RoleBinding) Delete

func (r *RoleBinding) Delete() error

Delete deletes a Rolebinding resource.

func (*RoleBinding) Get

func (r *RoleBinding) Get() (*rbacv1.RoleBinding, error)

Get returns an existing RoleBinding and an error is any.

type Secret

type Secret struct {
	types.NamespacedName
	// contains filtered or unexported fields
}

Secret implements k8s.Resource interface for k8s Secret resource.

func NewSecret

func NewSecret(
	c client.Client,
	name, namespace string,
	labels map[string]string,
	secType corev1.SecretType,
	data map[string][]byte) *Secret

NewSecret returns an initialized Secret.

func (Secret) Create

func (s Secret) Create() error

Create creates a new Secret resource.

func (Secret) Delete

func (s Secret) Delete() error

Delete deletes a Secret resource.

func (Secret) Get

func (s Secret) Get() (*corev1.Secret, error)

Get returns an existing Secret and an error if any.

type Service

type Service struct {
	types.NamespacedName
	// contains filtered or unexported fields
}

Service implements k8s.Resource interface for k8s Service resource.

func NewService

func NewService(
	c client.Client,
	name, namespace string,
	labels map[string]string,
	annotations map[string]string,
	spec *corev1.ServiceSpec) *Service

NewService returns an initialized Service.

func (Service) Create

func (s Service) Create() error

Create creates a Service resource.

func (Service) Delete

func (s Service) Delete() error

Delete deletes a Service resource.

func (Service) Get

func (s Service) Get() (*corev1.Service, error)

Get returns an existing Service and an error if any.

type ServiceAccount

type ServiceAccount struct {
	types.NamespacedName
	// contains filtered or unexported fields
}

ServiceAccount implements k8s.Resource interface for k8s ServiceAccount.

func NewServiceAccount

func NewServiceAccount(
	c client.Client,
	name, namespace string,
	labels map[string]string) *ServiceAccount

NewServiceAccount returns an initialized ServiceAccount.

func (*ServiceAccount) Create

func (s *ServiceAccount) Create() error

Create creates a new k8s ServiceAccount resource.

func (*ServiceAccount) Delete

func (s *ServiceAccount) Delete() error

Delete deletes a ServiceAccount resource.

func (*ServiceAccount) Get

Get returns an existing ServiceAccount and an error if any.

type StatefulSet

type StatefulSet struct {
	types.NamespacedName
	// contains filtered or unexported fields
}

StatefulSet implements k8s.Resource interface for k8s StatefulSet resource.

func NewStatefulSet

func NewStatefulSet(
	c client.Client,
	name, namespace string,
	labels map[string]string,
	spec *appsv1.StatefulSetSpec) *StatefulSet

NewStatefulSet returns an initialized StatefulSet.

func (StatefulSet) Create

func (s StatefulSet) Create() error

Create creates a StatefulSet.

func (StatefulSet) Delete

func (s StatefulSet) Delete() error

Delete deletes a StatefulSet.

func (StatefulSet) Get

func (s StatefulSet) Get() (*appsv1.StatefulSet, error)

Get returns an existing StatefulSet and an error if any.

type StorageClass

type StorageClass struct {
	types.NamespacedName
	// contains filtered or unexported fields
}

StorageClass implements k8s.Resource interface for k8s StorageClass resource.

func NewStorageClass

func NewStorageClass(
	c client.Client,
	name string,
	labels map[string]string,
	provisioner string,
	params map[string]string) *StorageClass

NewStorageClass returns an initialized StorageClass.

func (StorageClass) Create

func (s StorageClass) Create() error

Create creates a StorageClass resource.

func (StorageClass) Delete

func (s StorageClass) Delete() error

Delete deletes a StorageClass resource.

func (StorageClass) Get

Get returns an existing StorageClass and an error if any.

Jump to

Keyboard shortcuts

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