Documentation ¶
Index ¶
Constants ¶
View Source
const ( StatefulPodGroup = "iapetos.foundary-cloud.io" StatefulPodVersion = "v1" StatefulPodKind = "StatefulPod" StatefulPodResource = "statefulpods" Image = "uhub.service.ucloud.cn/infra/nginx:1.17.9" BasicName = "stateful-pod-test" BasicNameSpace = "ldy" BasicSize = 3 Basic = 1 WithService = 2 WithPVC = 3 WithStaticPvc = 4 PvName0 = "ldy.pvc-a452ed33-8a36-4fd5-bbb6-09118d1235f3" PvName1 = "ldy.pvc-7c0e7571-08c6-4f05-84ce-8098738f4f5c" PvName2 = "ldy.pvc-c005d9d0-5dbf-4a7c-9b31-beb6bf5a704e" )
Variables ¶
View Source
var BasicTemplate = fmt.Sprintf(` apiVersion: %s/%s kind: %s metadata: name: %s namespace: %s spec: selector: matchLabels: father: %s size: %d podTemplate: containers: - name: %s image: %s `, StatefulPodGroup, StatefulPodVersion, StatefulPodKind, BasicName, BasicNameSpace, BasicName, BasicSize, "test", Image)
View Source
var WithPvcTemplate = fmt.Sprintf(` apiVersion: %s/%s kind: %s metadata: name: %s namespace: %s spec: pvRecyclePolicy: "Delete" selector: matchLabels: father: %s size: %d podTemplate: containers: - name: %s image: %s volumeMounts: - name: test mountPath: /test - name: host-type mountPath: /data volumes: - name: test persistentVolumeClaim: claimName: data - name: host-type hostPath: path: /data type: DirectoryOrCreate pvcTemplate: storageClassName: "kubevirt-hostpath-provisioner" accessModes: - ReadWriteOnce resources: requests: storage: 1Gi serviceTemplate: selector: app: test-stateful-pod test: "true" clusterIP: None ports: - port: 80 targetPort: 80 `, StatefulPodGroup, StatefulPodVersion, StatefulPodKind, BasicName, BasicNameSpace, BasicName, BasicSize, "test", Image)
View Source
var WithServiceTemplate = fmt.Sprintf(` apiVersion: %s/%s kind: %s metadata: name: %s namespace: %s spec: selector: matchLabels: father: %s size: %d podTemplate: containers: - name: %s image: %s serviceTemplate: selector: app: test-stateful-pod test: "true" clusterIP: None ports: - port: 80 targetPort: 80 `, StatefulPodGroup, StatefulPodVersion, StatefulPodKind, BasicName, BasicNameSpace, BasicName, BasicSize, "test", Image)
View Source
var WithStaticPvcTemplate = fmt.Sprintf(` apiVersion: %s/%s kind: %s metadata: name: %s namespace: %s spec: pvRecyclePolicy: "Retain" selector: matchLabels: father: %s size: %d podTemplate: containers: - name: %s image: %s volumeMounts: - name: test mountPath: /test - name: host-type mountPath: /data volumes: - name: test persistentVolumeClaim: claimName: data - name: host-type hostPath: path: /data type: DirectoryOrCreate pvcTemplate: storageClassName: "kubevirt-hostpath-provisioner" accessModes: - ReadWriteOnce resources: requests: storage: 1Gi serviceTemplate: selector: app: test-stateful-pod test: "true" clusterIP: None ports: - port: 80 targetPort: 80 pvNames: - %s - %s - %s `, StatefulPodGroup, StatefulPodVersion, StatefulPodKind, BasicName, BasicNameSpace, BasicName, BasicSize, "test", Image, PvName0, PvName1, PvName2)
Functions ¶
func BasicStatefulPod ¶
func BasicStatefulPod(statefulPodType int) *unstructured.Unstructured
Types ¶
type Client ¶
type Client struct { ClientSet *kubernetes.Clientset DynamicClient dynamic.Interface }
type PodClient ¶
type PodClient struct {
*kubernetes.Clientset
}
func NewPodClient ¶
func NewPodClient(clientset *kubernetes.Clientset) *PodClient
func (*PodClient) GetNumOfSamePod ¶
type PvClient ¶
type PvClient struct {
*kubernetes.Clientset
}
func NewPvClient ¶
func NewPvClient(clientset *kubernetes.Clientset) *PvClient
func (*PvClient) GetPvStatus ¶
func (client *PvClient) GetPvStatus(name string) (*corev1.PersistentVolumePhase, error)
type PvcClient ¶
type PvcClient struct {
*kubernetes.Clientset
}
func NewPvcClient ¶
func NewPvcClient(clientset *kubernetes.Clientset) *PvcClient
func (*PvcClient) GetNumOfSamePvc ¶
func (*PvcClient) IsPvcExits ¶
func (client *PvcClient) IsPvcExits(name string) (*corev1.PersistentVolumeClaim, error)
type ServiceClient ¶
type ServiceClient struct {
*kubernetes.Clientset
}
func NewSvcClient ¶
func NewSvcClient(clientset *kubernetes.Clientset) *ServiceClient
func (*ServiceClient) IsServiceOK ¶
func (client *ServiceClient) IsServiceOK() bool
type StatefulPodClient ¶
func NewStatefulPodClient ¶
func NewStatefulPodClient(p dynamic.Interface) *StatefulPodClient
func (*StatefulPodClient) CreateStatefulPod ¶
func (client *StatefulPodClient) CreateStatefulPod(statefulPod *unstructured.Unstructured) error
func (*StatefulPodClient) DeleteStatefulPod ¶
func (client *StatefulPodClient) DeleteStatefulPod() error
func (*StatefulPodClient) Expansion ¶
func (client *StatefulPodClient) Expansion(size *int32) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.