kubernetes

package
v0.0.0-...-6573d5f Latest Latest
Warning

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

Go to latest
Published: May 14, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Small Kubernetes api wrapper

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthProvider

type AuthProvider struct {
	Config AuthProviderConfig `yaml:"config"`
	Name   string             `yaml:"name"`
}

type AuthProviderConfig

type AuthProviderConfig struct {
	CmdArgs   string `yaml:"cmd-args"`
	CmdPath   string `yaml:"cmd-path"`
	ExpiryKey string `yaml:"expiry-key"`
	TokenKey  string `yaml:"token-key"`
}

type Cluster

type Cluster struct {
	Data ClusterData `yaml:"cluster"`
	Name string      `yaml:"name"`
}

type ClusterData

type ClusterData struct {
	CertificateAuthorityDataStr string `yaml:"certificate-authority-data"`
	CertificateAuthorityData    []byte
	Server                      string `yaml:"server"`
}

type Context

type Context struct {
	Data ContextData `yaml:"context"`
	Name string      `yaml:"name"`
}

type ContextData

type ContextData struct {
	Cluster string `yaml:"cluster"`
	User    string `yaml:"user"`
}

type KubeConf

type KubeConf struct {
	ApiVersion     string    `yaml:"apiVersion"`
	Clusters       []Cluster `yaml:"clusters"`
	Contexts       []Context `yaml:"contexts"`
	CurrentContext string    `yaml:"current-context"`
	Kind           string    `yaml:"kind"`
	Users          []User    `yaml:"users"`
}

type KubeDeploymentItem

type KubeDeploymentItem struct {
	Metadata struct {
		Name              string            `json:"name"`
		Namespace         string            `json:"namespace"`
		SelfLink          string            `json:"selfLink"`
		UID               string            `json:"uid"`
		ResourceVersion   string            `json:"resourceVersion"`
		Generation        int               `json:"generation"`
		CreationTimestamp time.Time         `json:"creationTimestamp"`
		Labels            map[string]string `json:"labels"`
		Annotations       map[string]string `json:"annotations"`
	} `json:"metadata"`
	Spec struct {
		Replicas int `json:"replicas"`
		Selector struct {
			MatchLabels map[string]string `json:"matchLabels"`
		} `json:"selector"`
		Template struct {
			Metadata struct {
				CreationTimestamp interface{}       `json:"creationTimestamp"`
				Labels            map[string]string `json:"labels"`
			} `json:"metadata"`
			Spec struct {
				Containers []struct {
					Name      string `json:"name"`
					Image     string `json:"image"`
					Resources struct {
						Limits struct {
							CPU    string `json:"cpu,omitempty"`
							Memory string `json:"memory,omitempty"`
						} `json:"limits,omitempty"`
						Requests struct {
							Memory string `json:"memory"`
						} `json:"requests"`
					} `json:"resources"`
					TerminationMessagePath   string `json:"terminationMessagePath"`
					TerminationMessagePolicy string `json:"terminationMessagePolicy"`
					ImagePullPolicy          string `json:"imagePullPolicy"`
				} `json:"containers"`
				RestartPolicy                 string `json:"restartPolicy"`
				TerminationGracePeriodSeconds int    `json:"terminationGracePeriodSeconds"`
				DNSPolicy                     string `json:"dnsPolicy"`
				SecurityContext               struct {
				} `json:"securityContext"`
				SchedulerName string `json:"schedulerName,omitempty"`
			} `json:"spec"`
		} `json:"template"`
		Strategy struct {
			Type          string `json:"type"`
			RollingUpdate struct {
				MaxUnavailable interface{} `json:"maxUnavailable"`
				MaxSurge       interface{} `json:"maxSurge"`
			} `json:"rollingUpdate"`
		} `json:"strategy"`
		RevisionHistoryLimit    int `json:"revisionHistoryLimit"`
		ProgressDeadlineSeconds int `json:"progressDeadlineSeconds"`
	} `json:"spec"`
	Status struct {
		ObservedGeneration  int `json:"observedGeneration"`
		Replicas            int `json:"replicas"`
		UpdatedReplicas     int `json:"updatedReplicas"`
		UnavailableReplicas int `json:"unavailableReplicas"`
		Conditions          []struct {
			Type               string    `json:"type"`
			Status             string    `json:"status"`
			LastUpdateTime     time.Time `json:"lastUpdateTime"`
			LastTransitionTime time.Time `json:"lastTransitionTime"`
			Reason             string    `json:"reason"`
			Message            string    `json:"message"`
		} `json:"conditions"`
	} `json:"status"`
}

type KubeDeployments

type KubeDeployments struct {
	Kind       string `json:"kind"`
	APIVersion string `json:"apiVersion"`
	Metadata   struct {
	} `json:"metadata"`
	Items []KubeDeploymentItem `json:"items"`
}

type KubeNode

type KubeNode struct {
	Metadata KubeNodeMetadata `json:"metadata"`
	Spec     KubeNodeSpec     `json:"spec"`
	Status   KubeNodeStatus   `json:"status"`
}

type KubeNodeMetadata

type KubeNodeMetadata struct {
	Name              string `json:"name"`
	SelfLink          string `json:"selfLink"`
	Uid               string `json:"uid"`
	ResourceVersion   string `json:"resourceVersion"`
	CreationTimestamp string `json:"creationTimestamp"`
}

type KubeNodeSpec

type KubeNodeSpec struct {
	PodCIDR    string `json:"podCIDR"`
	ExternalID string `json:"externalID"`
}

type KubeNodeStatus

type KubeNodeStatus struct {
	Conditions []KubeNodeStatusConditions `json:"conditions"`
}

type KubeNodeStatusConditions

type KubeNodeStatusConditions struct {
	Type               string `json:"type"`
	Status             string `json:"status"`
	LastHeartbeatTime  string `json:"lastHeartbeatTime"`
	LastTransitionTime string `json:"lastTransitionTime"`
	Reason             string `json:"reason"`
	Message            string `json:"message"`
}

type KubePod

type KubePod struct {
	Kind       string `json:"kind"`
	APIVersion string `json:"apiVersion"`
	Metadata   struct {
		Name              string            `json:"name"`
		GenerateName      string            `json:"generateName"`
		Namespace         string            `json:"namespace"`
		SelfLink          string            `json:"selfLink"`
		UID               string            `json:"uid"`
		ResourceVersion   string            `json:"resourceVersion"`
		CreationTimestamp time.Time         `json:"creationTimestamp"`
		Labels            map[string]string `json:"labels"`
		OwnerReferences   []struct {
			APIVersion         string `json:"apiVersion"`
			Kind               string `json:"kind"`
			Name               string `json:"name"`
			UID                string `json:"uid"`
			Controller         bool   `json:"controller"`
			BlockOwnerDeletion bool   `json:"blockOwnerDeletion"`
		} `json:"ownerReferences"`
	} `json:"metadata"`
	Spec struct {
		Volumes []struct {
			Name   string `json:"name"`
			Secret struct {
				SecretName  string `json:"secretName"`
				DefaultMode int    `json:"defaultMode"`
			} `json:"secret"`
		} `json:"volumes"`
		Containers []struct {
			Name  string `json:"name"`
			Image string `json:"image"`
			Ports []struct {
				Name          string `json:"name"`
				ContainerPort int    `json:"containerPort"`
				Protocol      string `json:"protocol"`
			} `json:"ports"`
			Resources struct {
			} `json:"resources"`
			VolumeMounts []struct {
				Name      string `json:"name"`
				ReadOnly  bool   `json:"readOnly"`
				MountPath string `json:"mountPath"`
			} `json:"volumeMounts"`
			TerminationMessagePath   string `json:"terminationMessagePath"`
			TerminationMessagePolicy string `json:"terminationMessagePolicy"`
			ImagePullPolicy          string `json:"imagePullPolicy"`
		} `json:"containers"`
		RestartPolicy                 string `json:"restartPolicy"`
		TerminationGracePeriodSeconds int    `json:"terminationGracePeriodSeconds"`
		DNSPolicy                     string `json:"dnsPolicy"`
		ServiceAccountName            string `json:"serviceAccountName"`
		ServiceAccount                string `json:"serviceAccount"`
		NodeName                      string `json:"nodeName"`
		SecurityContext               struct {
		} `json:"securityContext"`
		SchedulerName string `json:"schedulerName"`
		Tolerations   []struct {
			Key               string `json:"key"`
			Operator          string `json:"operator"`
			Effect            string `json:"effect"`
			TolerationSeconds int    `json:"tolerationSeconds"`
		} `json:"tolerations"`
	} `json:"spec"`
	Status struct {
		Phase      string `json:"phase"`
		Conditions []struct {
			Type               string      `json:"type"`
			Status             string      `json:"status"`
			LastProbeTime      interface{} `json:"lastProbeTime"`
			LastTransitionTime time.Time   `json:"lastTransitionTime"`
		} `json:"conditions"`
		HostIP            string    `json:"hostIP"`
		PodIP             string    `json:"podIP"`
		StartTime         time.Time `json:"startTime"`
		ContainerStatuses []struct {
			Name  string `json:"name"`
			State struct {
				Running struct {
					StartedAt time.Time `json:"startedAt"`
				} `json:"running"`
			} `json:"state"`
			LastState struct {
			} `json:"lastState"`
			Ready        bool   `json:"ready"`
			RestartCount int    `json:"restartCount"`
			Image        string `json:"image"`
			ImageID      string `json:"imageID"`
			ContainerID  string `json:"containerID"`
		} `json:"containerStatuses"`
		QosClass string `json:"qosClass"`
	} `json:"status"`
}

type KubePodEvent

type KubePodEvent struct {
	Type string `json:"type"`
	// Object of the event
	Object KubePod `json:"object"`
}

type KubeReplicaSet

type KubeReplicaSet struct {
	Kind       string `json:"kind"`
	APIVersion string `json:"apiVersion"`
	Metadata   struct {
		Name              string            `json:"name"`
		Namespace         string            `json:"namespace"`
		SelfLink          string            `json:"selfLink"`
		UID               string            `json:"uid"`
		ResourceVersion   string            `json:"resourceVersion"`
		Generation        int               `json:"generation"`
		CreationTimestamp time.Time         `json:"creationTimestamp"`
		Labels            map[string]string `json:"labels"`
		Annotations       map[string]string `json:"annotations"`
		OwnerReferences   []struct {
			APIVersion         string `json:"apiVersion"`
			Kind               string `json:"kind"`
			Name               string `json:"name"`
			UID                string `json:"uid"`
			Controller         bool   `json:"controller"`
			BlockOwnerDeletion bool   `json:"blockOwnerDeletion"`
		} `json:"ownerReferences"`
	} `json:"metadata"`
	Spec struct {
		Replicas int `json:"replicas"`
		Selector struct {
			MatchLabels map[string]string `json:"matchLabels"`
		} `json:"selector"`
		Template struct {
			Metadata struct {
				Name              string            `json:"name"`
				CreationTimestamp interface{}       `json:"creationTimestamp"`
				Labels            map[string]string `json:"labels"`
			} `json:"metadata"`
			Spec struct {
				Containers []struct {
					Name  string `json:"name"`
					Image string `json:"image"`
					Ports []struct {
						Name          string `json:"name"`
						ContainerPort int    `json:"containerPort"`
						Protocol      string `json:"protocol"`
					} `json:"ports"`
					Resources struct {
					} `json:"resources"`
					TerminationMessagePath   string `json:"terminationMessagePath"`
					TerminationMessagePolicy string `json:"terminationMessagePolicy"`
					ImagePullPolicy          string `json:"imagePullPolicy"`
				} `json:"containers"`
				RestartPolicy                 string `json:"restartPolicy"`
				TerminationGracePeriodSeconds int    `json:"terminationGracePeriodSeconds"`
				DNSPolicy                     string `json:"dnsPolicy"`
				SecurityContext               struct {
				} `json:"securityContext"`
				SchedulerName string `json:"schedulerName"`
			} `json:"spec"`
		} `json:"template"`
	} `json:"spec"`
	Status struct {
		Replicas             int `json:"replicas"`
		FullyLabeledReplicas int `json:"fullyLabeledReplicas"`
		ObservedGeneration   int `json:"observedGeneration"`
	} `json:"status"`
}

type KubeResponse

type KubeResponse struct {
	Kind       string `json:"kind"`
	APIVersion string `json:"apiVersion"`
	Metadata   struct {
	} `json:"metadata"`
	Status  string `json:"status"`
	Message string `json:"message"`
	Reason  string `json:"reason"`
	Details struct {
		Name string `json:"name"`
		Kind string `json:"kind"`
	} `json:"details"`
	Code int `json:"code"`
}

type KubernetesCoreV1Api

type KubernetesCoreV1Api struct {
	// contains filtered or unexported fields
}

func (KubernetesCoreV1Api) CreateNamespacedBinding

func (api KubernetesCoreV1Api) CreateNamespacedBinding(namespace string, body io.Reader) (response *http.Response, err error)

func (KubernetesCoreV1Api) ListNamespacedDeployments

func (api KubernetesCoreV1Api) ListNamespacedDeployments(namespace, fieldSelector string) (deployments KubeDeployments, err error)

func (KubernetesCoreV1Api) ListNamespacedReplicaset

func (api KubernetesCoreV1Api) ListNamespacedReplicaset(namespace string, replicaName string) (replicaSet KubeReplicaSet, err error)

func (KubernetesCoreV1Api) ListNodes

func (api KubernetesCoreV1Api) ListNodes() (nodes []KubeNode, err error)

func (*KubernetesCoreV1Api) LoadKubeConfig

func (api *KubernetesCoreV1Api) LoadKubeConfig() (err error)

Reads the configuration file and loads the config struct

func (KubernetesCoreV1Api) ReplaceDeploymentScheduler

func (api KubernetesCoreV1Api) ReplaceDeploymentScheduler(item KubeDeploymentItem, scheduler string) (modified KubeDeploymentItem, err error)

func (KubernetesCoreV1Api) Request

func (api KubernetesCoreV1Api) Request(httpMethod, apiMethod, contentType string, values url.Values, body io.Reader) (response *http.Response, err error)

func (KubernetesCoreV1Api) Watch

func (api KubernetesCoreV1Api) Watch(httpMethod, apiMethod string, values url.Values, body io.Reader) (responseChannel chan []byte, err error)

type User

type User struct {
	Name         string       `yaml:"name"`
	Data         UserData     `yaml:"user"`
	AuthProvider AuthProvider `yaml:"auth-provider"`
}

type UserData

type UserData struct {
	ClientCertificateDataStr string `yaml:"client-certificate-data"`
	ClientCertificateData    []byte
	ClientKeyDataStr         string `yaml:"client-key-data"`
	ClientKeyData            []byte
}

Jump to

Keyboard shortcuts

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