Documentation ¶
Index ¶
- func UseFakeClient(k8sClient kubernetes.Interface, argoClient *argocdclient.Clientset)
- type AllResourceStatus
- type Client
- func (c *Client) ApplyConfigMap(name, namespace string, data, labels map[string]string) (*v1.ConfigMap, error)
- func (c *Client) ApplySecret(name, namespace string, data map[string][]byte, labels map[string]string) (*corev1.Secret, error)
- func (c *Client) CreateDeployment(namespace string, deployment *appsv1.Deployment) error
- func (c *Client) CreateNamespace(namespace string) error
- func (c *Client) CreatePersistentVolume(option *PVOption) error
- func (c *Client) CreatePersistentVolumeClaim(opt *PVCOption) error
- func (c *Client) CreateService(namespace string, service *corev1.Service) error
- func (c *Client) DeleteDeployment(namespace, deployName string) error
- func (c *Client) DeleteNamespace(namespace string) error
- func (c *Client) DeletePersistentVolume(pvName string) error
- func (c *Client) DeletePersistentVolumeClaim(namespace, pvcName string) error
- func (c *Client) DeleteService(namespace, serviceName string) error
- func (c *Client) DescribeArgocdApp(app *argocdv1alpha1.Application) map[string]interface{}
- func (c *Client) GetArgocdApplication(namespace, name string) (*argocdv1alpha1.Application, error)
- func (c *Client) GetConfigMap(name, namespace string) (*v1.ConfigMap, error)
- func (c *Client) GetDaemonset(namespace, name string) (*appsv1.DaemonSet, error)
- func (c *Client) GetDeployment(namespace, name string) (*appsv1.Deployment, error)
- func (c *Client) GetNamespace(namespace string) (*corev1.Namespace, error)
- func (c *Client) GetResourceStatus(nameSpace string, anFilter, labelFilter map[string]string) (*AllResourceStatus, error)
- func (c *Client) GetSecret(namespace, name string) (map[string]string, error)
- func (c *Client) GetService(namespace, name string) (*corev1.Service, error)
- func (c *Client) GetStatefulset(namespace, name string) (*appsv1.StatefulSet, error)
- func (c *Client) IsArgocdApplicationReady(application *argocdv1alpha1.Application) bool
- func (c *Client) IsDevstreamNS(namespace string) (bool, error)
- func (c *Client) IsNamespaceExists(namespace string) (bool, error)
- func (c *Client) ListArgocdApplications(namespace string) ([]argocdv1alpha1.Application, error)
- func (c *Client) ListDaemonsetsWithLabel(namespace string, labeFilter map[string]string) ([]appsv1.DaemonSet, error)
- func (c *Client) ListDeploymentsWithLabel(namespace string, labelFilter map[string]string) ([]appsv1.Deployment, error)
- func (c *Client) ListStatefulsetsWithLabel(namespace string, labelFilter map[string]string) ([]appsv1.StatefulSet, error)
- func (c *Client) UpsertNameSpace(nameSpace string) error
- func (c *Client) WaitForDeploymentReady(retry int, namespace, deployName string) error
- type K8sAPI
- type MockClient
- func (m *MockClient) ApplyConfigMap(name, namespace string, data, labels map[string]string) (*corev1.ConfigMap, error)
- func (m *MockClient) ApplySecret(name, namespace string, data map[string][]byte, labels map[string]string) (*corev1.Secret, error)
- func (m *MockClient) CreateDeployment(namespace string, deployment *appsv1.Deployment) error
- func (m *MockClient) CreateNamespace(namespace string) error
- func (m *MockClient) CreatePersistentVolume(option *PVOption) error
- func (m *MockClient) CreatePersistentVolumeClaim(opt *PVCOption) error
- func (m *MockClient) CreateService(namespace string, service *corev1.Service) error
- func (m *MockClient) DeleteDeployment(namespace, deployName string) error
- func (m *MockClient) DeleteNamespace(namespace string) error
- func (m *MockClient) DeletePersistentVolume(pvName string) error
- func (m *MockClient) DeletePersistentVolumeClaim(namespace, pvcName string) error
- func (m *MockClient) DeleteService(namespace, serviceName string) error
- func (m *MockClient) DescribeArgocdApp(app *argocdv1alpha1.Application) map[string]interface{}
- func (m *MockClient) GetArgocdApplication(namespace, name string) (*argocdv1alpha1.Application, error)
- func (m *MockClient) GetConfigMap(name, namespace string) (*corev1.ConfigMap, error)
- func (m *MockClient) GetDeployment(namespace, name string) (*appsv1.Deployment, error)
- func (m *MockClient) GetNamespace(namespace string) (*corev1.Namespace, error)
- func (m *MockClient) GetResourceStatus(nameSpace string, anFilter, labelFilter map[string]string) (*AllResourceStatus, error)
- func (m *MockClient) GetSecret(namespace, name string) (map[string]string, error)
- func (m *MockClient) GetService(namespace, name string) (*corev1.Service, error)
- func (m *MockClient) GetStatefulset(namespace, name string) (*appsv1.StatefulSet, error)
- func (m *MockClient) IsArgocdApplicationReady(application *argocdv1alpha1.Application) bool
- func (m *MockClient) IsDevstreamNS(namespace string) (bool, error)
- func (m *MockClient) IsNamespaceExists(namespace string) (bool, error)
- func (m *MockClient) ListArgocdApplications(namespace string) ([]argocdv1alpha1.Application, error)
- func (m *MockClient) ListDaemonsetsWithLabel(namespace string, labeFilter map[string]string) ([]appsv1.DaemonSet, error)
- func (m *MockClient) ListDeploymentsWithLabel(namespace string, labelFilter map[string]string) ([]appsv1.Deployment, error)
- func (m *MockClient) UpsertNameSpace(nameSpace string) error
- func (m *MockClient) WaitForDeploymentReady(retry int, namespace, deployName string) error
- type PVCOption
- type PVOption
- type ResourceStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UseFakeClient ¶ added in v0.10.0
func UseFakeClient(k8sClient kubernetes.Interface, argoClient *argocdclient.Clientset)
UseFakeClient is used for testing, if this function is called, NewClient() will return the fake client.
Types ¶
type AllResourceStatus ¶ added in v0.8.0
type AllResourceStatus struct { Deployment []ResourceStatus StatefulSet []ResourceStatus DaemonSet []ResourceStatus }
func (*AllResourceStatus) ToStringInterfaceMap ¶ added in v0.10.0
func (s *AllResourceStatus) ToStringInterfaceMap() (map[string]interface{}, error)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ApplyConfigMap ¶ added in v0.9.0
func (*Client) ApplySecret ¶ added in v0.9.0
func (*Client) CreateDeployment ¶ added in v0.9.0
func (c *Client) CreateDeployment(namespace string, deployment *appsv1.Deployment) error
func (*Client) CreateNamespace ¶
func (*Client) CreatePersistentVolume ¶
func (*Client) CreatePersistentVolumeClaim ¶ added in v0.8.0
func (*Client) CreateService ¶ added in v0.9.0
func (*Client) DeleteDeployment ¶ added in v0.8.0
func (*Client) DeleteNamespace ¶
func (*Client) DeletePersistentVolume ¶ added in v0.8.0
func (*Client) DeletePersistentVolumeClaim ¶ added in v0.8.0
func (*Client) DeleteService ¶ added in v0.8.0
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) GetConfigMap ¶ added in v0.9.0
func (*Client) GetDaemonset ¶
func (*Client) GetDeployment ¶
func (c *Client) GetDeployment(namespace, name string) (*appsv1.Deployment, error)
func (*Client) GetNamespace ¶
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 (*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) IsDevstreamNS ¶ added in v0.8.0
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 (*Client) ListArgocdApplications ¶
func (c *Client) ListArgocdApplications(namespace string) ([]argocdv1alpha1.Application, error)
func (*Client) ListDaemonsetsWithLabel ¶ added in v0.8.0
func (*Client) ListDeploymentsWithLabel ¶ added in v0.8.0
func (*Client) ListStatefulsetsWithLabel ¶ added in v0.8.0
func (*Client) UpsertNameSpace ¶ added in v0.9.0
type K8sAPI ¶ added in v0.10.0
type K8sAPI interface { // secret API GetSecret(namespace, name string) (map[string]string, error) ApplySecret(name, namespace string, data map[string][]byte, labels map[string]string) (*corev1.Secret, error) // service API CreateService(namespace string, service *corev1.Service) error DeleteService(namespace, serviceName string) error GetService(namespace, name string) (*corev1.Service, error) // storage API CreatePersistentVolume(option *PVOption) error DeletePersistentVolume(pvName string) error CreatePersistentVolumeClaim(opt *PVCOption) error DeletePersistentVolumeClaim(namespace, pvcName string) error // resource API GetResourceStatus(nameSpace string, anFilter, labelFilter map[string]string) (*AllResourceStatus, error) ListDeploymentsWithLabel(namespace string, labelFilter map[string]string) ([]appsv1.Deployment, error) GetDeployment(namespace, name string) (*appsv1.Deployment, error) CreateDeployment(namespace string, deployment *appsv1.Deployment) error WaitForDeploymentReady(retry int, namespace, deployName string) error DeleteDeployment(namespace, deployName string) error ListDaemonsetsWithLabel(namespace string, labeFilter map[string]string) ([]appsv1.DaemonSet, error) GetStatefulset(namespace, name string) (*appsv1.StatefulSet, error) // namespace API UpsertNameSpace(nameSpace string) error GetNamespace(namespace string) (*corev1.Namespace, error) IsDevstreamNS(namespace string) (bool, error) CreateNamespace(namespace string) error DeleteNamespace(namespace string) error IsNamespaceExists(namespace string) (bool, error) // configmap API ApplyConfigMap(name, namespace string, data, labels map[string]string) (*corev1.ConfigMap, error) GetConfigMap(name, namespace string) (*corev1.ConfigMap, error) // argocd API ListArgocdApplications(namespace string) ([]argocdv1alpha1.Application, error) GetArgocdApplication(namespace, name string) (*argocdv1alpha1.Application, error) IsArgocdApplicationReady(application *argocdv1alpha1.Application) bool DescribeArgocdApp(app *argocdv1alpha1.Application) map[string]interface{} }
type MockClient ¶ added in v0.10.0
func (*MockClient) ApplyConfigMap ¶ added in v0.10.0
func (*MockClient) ApplySecret ¶ added in v0.10.0
func (*MockClient) CreateDeployment ¶ added in v0.10.0
func (m *MockClient) CreateDeployment(namespace string, deployment *appsv1.Deployment) error
func (*MockClient) CreateNamespace ¶ added in v0.10.0
func (m *MockClient) CreateNamespace(namespace string) error
func (*MockClient) CreatePersistentVolume ¶ added in v0.10.0
func (m *MockClient) CreatePersistentVolume(option *PVOption) error
func (*MockClient) CreatePersistentVolumeClaim ¶ added in v0.10.0
func (m *MockClient) CreatePersistentVolumeClaim(opt *PVCOption) error
func (*MockClient) CreateService ¶ added in v0.10.0
func (m *MockClient) CreateService(namespace string, service *corev1.Service) error
func (*MockClient) DeleteDeployment ¶ added in v0.10.0
func (m *MockClient) DeleteDeployment(namespace, deployName string) error
func (*MockClient) DeleteNamespace ¶ added in v0.10.0
func (m *MockClient) DeleteNamespace(namespace string) error
func (*MockClient) DeletePersistentVolume ¶ added in v0.10.0
func (m *MockClient) DeletePersistentVolume(pvName string) error
func (*MockClient) DeletePersistentVolumeClaim ¶ added in v0.10.0
func (m *MockClient) DeletePersistentVolumeClaim(namespace, pvcName string) error
func (*MockClient) DeleteService ¶ added in v0.10.0
func (m *MockClient) DeleteService(namespace, serviceName string) error
func (*MockClient) DescribeArgocdApp ¶ added in v0.10.0
func (m *MockClient) DescribeArgocdApp(app *argocdv1alpha1.Application) map[string]interface{}
func (*MockClient) GetArgocdApplication ¶ added in v0.10.0
func (m *MockClient) GetArgocdApplication(namespace, name string) (*argocdv1alpha1.Application, error)
func (*MockClient) GetConfigMap ¶ added in v0.10.0
func (m *MockClient) GetConfigMap(name, namespace string) (*corev1.ConfigMap, error)
func (*MockClient) GetDeployment ¶ added in v0.10.0
func (m *MockClient) GetDeployment(namespace, name string) (*appsv1.Deployment, error)
func (*MockClient) GetNamespace ¶ added in v0.10.0
func (m *MockClient) GetNamespace(namespace string) (*corev1.Namespace, error)
func (*MockClient) GetResourceStatus ¶ added in v0.10.0
func (m *MockClient) GetResourceStatus(nameSpace string, anFilter, labelFilter map[string]string) (*AllResourceStatus, error)
func (*MockClient) GetSecret ¶ added in v0.10.0
func (m *MockClient) GetSecret(namespace, name string) (map[string]string, error)
func (*MockClient) GetService ¶ added in v0.10.0
func (m *MockClient) GetService(namespace, name string) (*corev1.Service, error)
func (*MockClient) GetStatefulset ¶ added in v0.10.0
func (m *MockClient) GetStatefulset(namespace, name string) (*appsv1.StatefulSet, error)
func (*MockClient) IsArgocdApplicationReady ¶ added in v0.10.0
func (m *MockClient) IsArgocdApplicationReady(application *argocdv1alpha1.Application) bool
func (*MockClient) IsDevstreamNS ¶ added in v0.10.0
func (m *MockClient) IsDevstreamNS(namespace string) (bool, error)
func (*MockClient) IsNamespaceExists ¶ added in v0.10.0
func (m *MockClient) IsNamespaceExists(namespace string) (bool, error)
func (*MockClient) ListArgocdApplications ¶ added in v0.10.0
func (m *MockClient) ListArgocdApplications(namespace string) ([]argocdv1alpha1.Application, error)
func (*MockClient) ListDaemonsetsWithLabel ¶ added in v0.10.0
func (*MockClient) ListDeploymentsWithLabel ¶ added in v0.10.0
func (m *MockClient) ListDeploymentsWithLabel(namespace string, labelFilter map[string]string) ([]appsv1.Deployment, error)
func (*MockClient) UpsertNameSpace ¶ added in v0.10.0
func (m *MockClient) UpsertNameSpace(nameSpace string) error
func (*MockClient) WaitForDeploymentReady ¶ added in v0.10.0
func (m *MockClient) WaitForDeploymentReady(retry int, namespace, deployName string) error
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: https://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
Click to show internal directories.
Click to hide internal directories.