k8s

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllResourceStatus added in v0.8.0

type AllResourceStatus struct {
	Deployment  []ResourceStatus
	StatefulSet []ResourceStatus
	DaemonSet   []ResourceStatus
}

type CRBOption

type CRBOption struct {
	Name    string
	SANames []string
	RName   string
}

type CROption

type CROption struct {
	Name        string
	PolicyRules []rbacv1.PolicyRule
}

type Client

type Client struct {
	*kubernetes.Clientset
	Argocd *argocdclient.Clientset
}

func NewClient

func NewClient() (*Client, error)

func (*Client) CreateClusterRole

func (c *Client) CreateClusterRole(option *CROption) error

func (*Client) CreateClusterRoleBinding

func (c *Client) CreateClusterRoleBinding(option *CRBOption) error

func (*Client) CreateNamespace

func (c *Client) CreateNamespace(namespace string) error

func (*Client) CreatePersistentVolume

func (c *Client) CreatePersistentVolume(option *PVOption) error

func (*Client) CreatePersistentVolumeClaim added in v0.8.0

func (c *Client) CreatePersistentVolumeClaim(opt *PVCOption) error

func (*Client) CreateServiceAccount

func (c *Client) CreateServiceAccount(name, namespace string) error

func (*Client) DeleteClusterRole

func (c *Client) DeleteClusterRole(name string) error

func (*Client) DeleteClusterRoleBinding

func (c *Client) DeleteClusterRoleBinding(name string) error

func (*Client) DeleteDeployment added in v0.8.0

func (c *Client) DeleteDeployment(namespace, deployName string) error

func (*Client) DeleteNamespace

func (c *Client) DeleteNamespace(namespace string) error

func (*Client) DeletePersistentVolume added in v0.8.0

func (c *Client) DeletePersistentVolume(pvName string) error

func (*Client) DeletePersistentVolumeClaim added in v0.8.0

func (c *Client) DeletePersistentVolumeClaim(namespace, pvcName string) error

func (*Client) DeleteService added in v0.8.0

func (c *Client) DeleteService(namespace, serviceName string) error

func (*Client) DeleteServiceAccount

func (c *Client) DeleteServiceAccount(name, namespace string) error

func (*Client) DescribeArgocdApp

func (c *Client) DescribeArgocdApp(app *argocdv1alpha1.Application) map[string]interface{}

func (*Client) GetArgocdApplication

func (c *Client) GetArgocdApplication(namespace, name string) (*argocdv1alpha1.Application, error)

func (*Client) GetDaemonset

func (c *Client) GetDaemonset(namespace, name string) (*appsv1.DaemonSet, error)

func (*Client) GetDeployment

func (c *Client) GetDeployment(namespace, name string) (*appsv1.Deployment, error)

func (*Client) GetNamespace

func (c *Client) GetNamespace(namespace string) (*corev1.Namespace, error)

func (*Client) GetResourceStatus added in v0.8.0

func (c *Client) GetResourceStatus(nameSpace string, anFilter, labelFilter map[string]string) (AllResourceStatus, error)

GetResourceStatus get all resource state by input nameSpace and filtermap

func (*Client) GetService

func (c *Client) GetService(namespace, name string) (*corev1.Service, error)

func (*Client) GetStatefulset

func (c *Client) GetStatefulset(namespace, name string) (*appsv1.StatefulSet, error)

func (*Client) IsArgocdApplicationReady

func (c *Client) IsArgocdApplicationReady(application *argocdv1alpha1.Application) bool

func (*Client) IsDaemonsetReady

func (c *Client) IsDaemonsetReady(daemonset *appsv1.DaemonSet) bool

func (*Client) IsDeploymentReady

func (c *Client) IsDeploymentReady(deployment *appsv1.Deployment) bool

func (*Client) IsDevstreamNS added in v0.8.0

func (c *Client) IsDevstreamNS(namespace string) (bool, error)

Check whether the given namespace is created by dtm If the given namespace has label "created_by=DevStream", we'll control it.

  1. The specified namespace is created by dtm, then it should be deleted when errors are encountered during creation or `dtm delete`.
  2. The specified namespace is controlled by user, maybe they want to deploy plugins in an existing namespace or other situations, then we should not delete this namespace.

func (*Client) IsNamespaceExists

func (c *Client) IsNamespaceExists(namespace string) (bool, error)

func (*Client) IsStatefulsetReady

func (c *Client) IsStatefulsetReady(statefulset *appsv1.StatefulSet) bool

func (*Client) ListArgocdApplications

func (c *Client) ListArgocdApplications(namespace string) ([]argocdv1alpha1.Application, error)

func (*Client) ListDaemonsetsWithLabel added in v0.8.0

func (c *Client) ListDaemonsetsWithLabel(namespace string, labeFilter map[string]string) ([]appsv1.DaemonSet, error)

func (*Client) ListDeploymentsWithLabel added in v0.8.0

func (c *Client) ListDeploymentsWithLabel(namespace string, labelFilter map[string]string) ([]appsv1.Deployment, error)

func (*Client) ListDevstreamNamespace added in v0.8.0

func (c *Client) ListDevstreamNamespace() (*corev1.NamespaceList, error)

func (*Client) ListServices

func (c *Client) ListServices(namespace string) ([]corev1.Service, error)

func (*Client) ListStatefulsetsWithLabel added in v0.8.0

func (c *Client) ListStatefulsetsWithLabel(namespace string, labelFilter map[string]string) ([]appsv1.StatefulSet, error)

func (*Client) WaitForDeploymentReady added in v0.8.0

func (c *Client) WaitForDeploymentReady(retry int, namespace, deployName string) error

Wait for deployment to be ready after creating

type PVCOption added in v0.8.0

type PVCOption struct {
	Name             string
	NameSpace        string
	StorageClassName string

	AccessMode []corev1.PersistentVolumeAccessMode

	Requirement corev1.ResourceRequirements
}

type PVOption

type PVOption struct {
	Name             string
	StorageClassName string

	// ReadWriteOnce PersistentVolumeAccessMode = "ReadWriteOnce"
	// ReadOnlyMany PersistentVolumeAccessMode = "ReadOnlyMany"
	// ReadWriteMany PersistentVolumeAccessMode = "ReadWriteMany"
	// ReadWriteOncePod PersistentVolumeAccessMode = "ReadWriteOncePod"
	AccessMode []corev1.PersistentVolumeAccessMode

	// <binarySI>        ::= Ki | Mi | Gi | Ti | Pi | Ei
	//   (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)
	// <decimalSI>       ::= m | "" | k | M | G | T | P | E
	//   (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
	// eg: 10Gi 200Mi
	Capacity string

	//PersistentVolumeReclaimRecycle PersistentVolumeReclaimPolicy = "Recycle"
	//PersistentVolumeReclaimDelete PersistentVolumeReclaimPolicy = "Delete"
	//PersistentVolumeReclaimRetain PersistentVolumeReclaimPolicy = "Retain"
	PersistentVolumeReclaimPolicy corev1.PersistentVolumeReclaimPolicy
	HostPath                      string
}

type ResourceStatus added in v0.8.0

type ResourceStatus struct {
	Name  string
	Ready bool
}

Jump to

Keyboard shortcuts

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