k8s

package
v0.4.7-RC2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Namespace is the default namespace
	Namespace = "default"
	// WaitDuration is the default wait duration
	WaitDuration time.Duration = 5 * time.Second
	// Running is the active/running status of pod
	Running = "Running"
)

Variables

This section is empty.

Functions

func GetClusterRole

func GetClusterRole() (rbacv1beta1.ClusterRole, error)

GetClusterRole generates the ClusterRole object from the yaml file

func GetClusterRoleBinding

func GetClusterRoleBinding() (rbacv1beta1.ClusterRoleBinding, error)

GetClusterRoleBinding generates the ClusterRoleBinding object from the yaml file

func GetConfigMap

func GetConfigMap() (v1.ConfigMap, error)

GetConfigMap generates the ConfigMap object for NDM from the yaml file

func GetCustomResourceDefinition

func GetCustomResourceDefinition(crdyaml NDMYaml) (apiextensionsv1beta1.CustomResourceDefinition, error)

GetCustomResourceDefinition generates the CustomResourceDefinition object from the specified YAML file

func GetDaemonSet

func GetDaemonSet() (appsv1.DaemonSet, error)

GetDaemonSet generates the NDM DaemonSet object from the yaml file

func GetDeployment

func GetDeployment() (appsv1.Deployment, error)

GetDeployment generates the NDO Deployment object from the yaml file

func GetServiceAccount

func GetServiceAccount() (v1.ServiceAccount, error)

GetServiceAccount generates the ServiceAccount object from the yaml file

func NewBDC

func NewBDC(bdcName string) *apis.BlockDeviceClaim

NewBDC creates a sample device claim which can be used for claiming a block device.

func WaitForReconciliation added in v0.4.7

func WaitForReconciliation()

WaitForReconciliation sleeps the process for a fixed duration so that the reconcile loop can run and fetch the required changes

func WaitForStateChange

func WaitForStateChange()

WaitForStateChange sleeps the process for a fixed Duration so that the state changes get written in etcd and we get the updated result

Types

type K8sClient added in v0.4.3

type K8sClient struct {
	ClientSet     *kubernetes.Clientset
	APIextClient  *apiextensionsclient.Clientset
	RunTimeClient client.Client
}

K8sClient is the client used for etcd operations

func GetClientSet

func GetClientSet() (K8sClient, error)

GetClientSet generates the client-set from the config file on the host Three clients are generated by the function:

  1. Client-set from client-go which is used for operations on pods/nodes and other first-class k8s objects. While using runtime client for this operations, the podList etc retrieved were not up-to-date
  2. Client from apiextensions which is used for CRUD operations on CRDs
  3. Runtime client from the controller-runtime which will be used for CRUD operations related to custom resources

func (K8sClient) CreateBlockDeviceClaim added in v0.4.3

func (c K8sClient) CreateBlockDeviceClaim(claim *apis.BlockDeviceClaim) error

CreateBlockDeviceClaim creates a BDC

func (K8sClient) CreateClusterRole added in v0.4.3

func (c K8sClient) CreateClusterRole(clusterRole rbacv1beta1.ClusterRole) error

CreateClusterRole creates a cluster role

func (K8sClient) CreateClusterRoleBinding added in v0.4.3

func (c K8sClient) CreateClusterRoleBinding(clusterRoleBinding rbacv1beta1.ClusterRoleBinding) error

CreateClusterRoleBinding creates a rolebinding

func (K8sClient) CreateConfigMap added in v0.4.3

func (c K8sClient) CreateConfigMap(configMap v1.ConfigMap) error

CreateConfigMap creates a config map

func (K8sClient) CreateCustomResourceDefinition added in v0.4.3

func (c K8sClient) CreateCustomResourceDefinition(customResourceDefinition apiextensionsv1beta1.CustomResourceDefinition) error

CreateCustomResourceDefinition creates a CRD

func (K8sClient) CreateDaemonSet added in v0.4.3

func (c K8sClient) CreateDaemonSet(daemonset appsv1.DaemonSet) error

CreateDaemonSet creates a Daemonset

func (K8sClient) CreateDeployment added in v0.4.3

func (c K8sClient) CreateDeployment(deployment appsv1.Deployment) error

CreateDeployment creates a deployment

func (K8sClient) CreateNDMBlockDeviceCRD added in v0.4.3

func (c K8sClient) CreateNDMBlockDeviceCRD() error

CreateNDMBlockDeviceCRD creates the CustomResourceDefinition for a Device type

func (K8sClient) CreateNDMBlockDeviceClaimCRD added in v0.4.3

func (c K8sClient) CreateNDMBlockDeviceClaimCRD() error

CreateNDMBlockDeviceClaimCRD creates the CustomResourceDefinition for a BlockDeviceClaim type

func (K8sClient) CreateNDMCRDs added in v0.4.3

func (c K8sClient) CreateNDMCRDs() error

CreateNDMCRDs creates the Disk, BlockDevice and BlockDeviceClaim CRDs

func (K8sClient) CreateNDMClusterRole added in v0.4.3

func (c K8sClient) CreateNDMClusterRole() error

CreateNDMClusterRole creates the ClusterRole required for NDM

func (K8sClient) CreateNDMClusterRoleBinding added in v0.4.3

func (c K8sClient) CreateNDMClusterRoleBinding() error

CreateNDMClusterRoleBinding creates the role binding required by NDM

func (K8sClient) CreateNDMConfigMap added in v0.4.3

func (c K8sClient) CreateNDMConfigMap() error

CreateNDMConfigMap creates the ConfigMap required for NDM

func (K8sClient) CreateNDMDaemonSet added in v0.4.3

func (c K8sClient) CreateNDMDaemonSet() error

CreateNDMDaemonSet creates the NDM Daemonset

func (K8sClient) CreateNDMDiskCRD added in v0.4.3

func (c K8sClient) CreateNDMDiskCRD() error

CreateNDMDiskCRD creates the CustomResourceDefinition for a Disk type

func (K8sClient) CreateNDMOperatorDeployment added in v0.4.3

func (c K8sClient) CreateNDMOperatorDeployment() error

CreateNDMOperatorDeployment creates the NDM Operator

func (K8sClient) CreateNDMServiceAccount added in v0.4.3

func (c K8sClient) CreateNDMServiceAccount() error

CreateNDMServiceAccount creates the ServiceAccount required for NDM

func (K8sClient) CreateServiceAccount added in v0.4.3

func (c K8sClient) CreateServiceAccount(serviceAccount v1.ServiceAccount) error

CreateServiceAccount creates a service account

func (K8sClient) DeleteBlockDeviceClaim added in v0.4.3

func (c K8sClient) DeleteBlockDeviceClaim(claim *apis.BlockDeviceClaim) error

DeleteBlockDeviceClaim deletes a BDC

func (K8sClient) DeleteClusterRole added in v0.4.3

func (c K8sClient) DeleteClusterRole(clusterRole rbacv1beta1.ClusterRole) error

DeleteClusterRole deletes the cluster role

func (K8sClient) DeleteClusterRoleBinding added in v0.4.3

func (c K8sClient) DeleteClusterRoleBinding(clusterrolebinding rbacv1beta1.ClusterRoleBinding) error

DeleteClusterRoleBinding deletes the role binding

func (K8sClient) DeleteConfigMap added in v0.4.3

func (c K8sClient) DeleteConfigMap(configMap v1.ConfigMap) error

DeleteConfigMap deletes the config map

func (K8sClient) DeleteCustomResourceDefinition added in v0.4.3

func (c K8sClient) DeleteCustomResourceDefinition(customResourceDefinition apiextensionsv1beta1.CustomResourceDefinition) error

DeleteCustomResourceDefinition deletes the CRD

func (K8sClient) DeleteDaemonSet added in v0.4.3

func (c K8sClient) DeleteDaemonSet(daemonset appsv1.DaemonSet) error

DeleteDaemonSet deletes the Daemonset

func (K8sClient) DeleteDeployment added in v0.4.3

func (c K8sClient) DeleteDeployment(deployment appsv1.Deployment) error

DeleteDeployment deletes a deployment

func (K8sClient) DeleteNDMBlockDeviceCRD added in v0.4.3

func (c K8sClient) DeleteNDMBlockDeviceCRD() error

DeleteNDMBlockDeviceCRD deletes the CustomResourceDefinition for a Device type

func (K8sClient) DeleteNDMBlockDeviceClaimCRD added in v0.4.3

func (c K8sClient) DeleteNDMBlockDeviceClaimCRD() error

DeleteNDMBlockDeviceClaimCRD deletes the CustomResourceDefinition for a BlockDeviceClaim type

func (K8sClient) DeleteNDMCRDs added in v0.4.3

func (c K8sClient) DeleteNDMCRDs() error

DeleteNDMCRDs deletes the disk, blockdevice and blockdevice claim CRDs

func (K8sClient) DeleteNDMClusterRole added in v0.4.3

func (c K8sClient) DeleteNDMClusterRole() error

DeleteNDMClusterRole deletes the ClusterRole required for NDM

func (K8sClient) DeleteNDMClusterRoleBinding added in v0.4.3

func (c K8sClient) DeleteNDMClusterRoleBinding() error

DeleteNDMClusterRoleBinding deletes the role binding required by NDM

func (K8sClient) DeleteNDMConfigMap added in v0.4.3

func (c K8sClient) DeleteNDMConfigMap() error

DeleteNDMConfigMap deletes the ConfigMap required for NDM

func (K8sClient) DeleteNDMDaemonSet added in v0.4.3

func (c K8sClient) DeleteNDMDaemonSet() error

DeleteNDMDaemonSet deletes the NDM Daemonset

func (K8sClient) DeleteNDMDiskCRD added in v0.4.3

func (c K8sClient) DeleteNDMDiskCRD() error

DeleteNDMDiskCRD deletes the CustomResourceDefinition for a Disk type

func (K8sClient) DeleteNDMOperatorDeployment added in v0.4.3

func (c K8sClient) DeleteNDMOperatorDeployment() error

DeleteNDMOperatorDeployment deletes the NDM operator

func (K8sClient) DeleteNDMServiceAccount added in v0.4.3

func (c K8sClient) DeleteNDMServiceAccount() error

DeleteNDMServiceAccount deletes the ServiceAccount required for NDM

func (K8sClient) DeleteServiceAccount added in v0.4.3

func (c K8sClient) DeleteServiceAccount(serviceAccount v1.ServiceAccount) error

DeleteServiceAc[2050]:4589616count deletes the service account

func (K8sClient) GetBlockDeviceClaim added in v0.4.3

func (c K8sClient) GetBlockDeviceClaim(NameSpace, Name string) (*apis.BlockDeviceClaim, error)

GetBlockDeviceClaim from Namespace and name

func (K8sClient) ListBlockDeviceClaims added in v0.4.3

func (c K8sClient) ListBlockDeviceClaims() (*apis.BlockDeviceClaimList, error)

ListBlockDeviceClaims returns list of BlockDeviceClaims in the cluster

func (K8sClient) ListBlockDevices added in v0.4.3

func (c K8sClient) ListBlockDevices() (*apis.BlockDeviceList, error)

ListBlockDevices returns list of BlockDeviceCR in the cluster

func (K8sClient) ListNodeStatus added in v0.4.3

func (c K8sClient) ListNodeStatus() (map[string]string, error)

ListNodeStatus returns list of all nodes(node name) in the cluster along with their status

func (K8sClient) ListPodStatus added in v0.4.3

func (c K8sClient) ListPodStatus() (map[string]string, error)

ListPodStatus returns the list of all pods in the given Namespace along with their status

func (K8sClient) RestartPod added in v0.4.3

func (c K8sClient) RestartPod(name string) error

RestartPod the given pod

func (K8sClient) UpdateBlockDeviceClaim added in v0.4.3

func (c K8sClient) UpdateBlockDeviceClaim(claim *apis.BlockDeviceClaim) error

UpdateBlockDeviceClaim updates the BDC

type NDMYaml

type NDMYaml string

NDMYaml is a string type that stores the path to the YAML files which are required to deploy NDM

const (
	ConfigMapYAML           NDMYaml = "../yamls/configmap.yaml"
	ServiceAccountYAML      NDMYaml = "../yamls/serviceaccount.yaml"
	ClusterRoleYAML         NDMYaml = "../yamls/clusterrole.yaml"
	ClusterRoleBindingYAML  NDMYaml = "../yamls/clusterrolebinding.yaml"
	DiskCRDYAML             NDMYaml = "../yamls/diskCR.yaml"
	BlockDeviceCRDYAML      NDMYaml = "../yamls/blockDeviceCR.yaml"
	BlockDeviceClaimCRDYAML NDMYaml = "../yamls/blockDeviceClaimCR.yaml"
	DaemonSetYAML           NDMYaml = "../yamls/daemonset.yaml"
	DeploymentYAML          NDMYaml = "../yamls/deployment.yaml"
)

Path to various YAMLs used for integration testing

Jump to

Keyboard shortcuts

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