Documentation ¶
Overview ¶
Package resource contains implementation of k8s.Resource interface for various k8s resources.
Index ¶
- Constants
- func CreateOrUpdate(c client.Client, obj runtime.Object) error
- func Delete(c client.Client, obj runtime.Object) error
- type CSIDriver
- type ClusterRole
- type ClusterRoleBinding
- type ConfigMap
- type DaemonSet
- type Deployment
- type Ingress
- type PVC
- type Role
- type RoleBinding
- type Secret
- type Service
- type ServiceAccount
- type StatefulSet
- type StorageClass
Constants ¶
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.
const CSIDriverKind = "CSIDriver"
CSIDriverKind is the name of the k8s CSIDriver resource kind.
const ClusterRoleBindingKind = "ClusterRoleBinding"
ClusterRoleBindingKind is the name of k8s ClusterRoleBinding resource kind.
const ClusterRoleKind = "ClusterRole"
ClusterRoleKind is the name of the k8s ClusterRole resource kind.
const ConfigMapKind = "ConfigMap"
ConfigMapKind is the name of k8s ConfigMap resource kind.
const DaemonSetKind = "DaemonSet"
DaemonSetKind is the name of k8s DaemonSet resource kind.
const DeploymentKind = "Deployment"
DeploymentKind is the name of k8s Deployment resource kind.
const IngressKind = "Ingress"
IngressKind is the name of k8s Ingress resource kind.
const PVCKind = "PersistentVolumeClaim"
PVCKind is the name of the k8s PersistentVolumeClaim resource kind.
const RoleBindingKind = "RoleBinding"
RoleBindingKind is the name of k8s RoleBinding resource kind.
const RoleKind = "Role"
RoleKind is the name of k8s Role resource kind.
const SecretKind = "Secret"
SecretKind is the name of the k8s Secret resource kind.
const ServiceAccountKind = "ServiceAccount"
ServiceAccountKind is the name of k8s ServiceAccount resource kind.
const ServiceKind = "Service"
ServiceKind is the name of k8s Service resource kind.
const StatefulSetKind = "StatefulSet"
StatefulSetKind is the name of the k8s StatefulSet resource kind.
const StorageClassKind = "StorageClass"
StorageClassKind is the name of k8s StorageClass resource kind.
Variables ¶
This section is empty.
Functions ¶
func CreateOrUpdate ¶
CreateOrUpdate creates or updates an existing 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.
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) 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 ¶
func (c ClusterRoleBinding) Get() (*rbacv1.ClusterRoleBinding, error)
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.
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.
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.
type PVC ¶
type PVC struct { types.NamespacedName // contains filtered or unexported fields }
PVC implements k8s.Resource interface for k8s PersistentVolumeClaim resource.
type Role ¶
type Role struct { types.NamespacedName // contains filtered or unexported fields }
Role implements k8s.Resource interface for k8s Role resource.
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.
type Service ¶
type Service struct { types.NamespacedName // contains filtered or unexported fields }
Service implements k8s.Resource interface for k8s Service resource.
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 ¶
func (s *ServiceAccount) Get() (*corev1.ServiceAccount, error)
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) 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 ¶
func (s StorageClass) Get() (*storagev1.StorageClass, error)
Get returns an existing StorageClass and an error if any.