Documentation
¶
Index ¶
- func MatchLabels(resourceLabels, selector map[string]string) bool
- func Now() string
- type ConfigMap
- type ConfigMapList
- type Container
- type ContainerPort
- type Deployment
- type DeploymentList
- type DeploymentSpec
- type DeploymentStatus
- type EnvVar
- type LabelSelector
- type ListMeta
- type LoadBalancerIngress
- type LoadBalancerStatus
- type Namespace
- type NamespaceList
- type NamespaceSpec
- type NamespaceStatus
- type Node
- type NodeAddress
- type NodeCondition
- type NodeList
- type NodeSpec
- type NodeStatus
- type ObjectMeta
- type Pod
- type PodCondition
- type PodList
- type PodSpec
- type PodStatus
- type PodTemplateSpec
- type Router
- type Secret
- type SecretList
- type Service
- type ServiceList
- type ServicePort
- type ServiceSpec
- type ServiceStatus
- type Status
- type Store
- func (s *Store) CreateConfigMap(cm *ConfigMap) error
- func (s *Store) CreateDeployment(dep *Deployment) error
- func (s *Store) CreateNamespace(ns *Namespace) error
- func (s *Store) CreatePod(pod *Pod) error
- func (s *Store) CreateSecret(sec *Secret) error
- func (s *Store) CreateService(svc *Service) error
- func (s *Store) DeleteConfigMap(namespace, name string) error
- func (s *Store) DeleteDeployment(namespace, name string) error
- func (s *Store) DeleteNamespace(name string) error
- func (s *Store) DeletePod(namespace, name string) error
- func (s *Store) DeleteSecret(namespace, name string) error
- func (s *Store) DeleteService(namespace, name string) error
- func (s *Store) FilterPodsByLabels(namespace string, selector string) []Pod
- func (s *Store) GetConfigMap(namespace, name string) (*ConfigMap, bool)
- func (s *Store) GetDeployment(namespace, name string) (*Deployment, bool)
- func (s *Store) GetNamespace(name string) (*Namespace, bool)
- func (s *Store) GetNode(name string) (*Node, bool)
- func (s *Store) GetPod(namespace, name string) (*Pod, bool)
- func (s *Store) GetSecret(namespace, name string) (*Secret, bool)
- func (s *Store) GetService(namespace, name string) (*Service, bool)
- func (s *Store) ListAllPods() []Pod
- func (s *Store) ListConfigMaps(namespace string) []ConfigMap
- func (s *Store) ListDeployments(namespace string) []Deployment
- func (s *Store) ListNamespaces() []Namespace
- func (s *Store) ListNodes() []Node
- func (s *Store) ListPods(namespace string) []Pod
- func (s *Store) ListSecrets(namespace string) []Secret
- func (s *Store) ListServices(namespace string) []Service
- func (s *Store) Subscribe() chan WatchEvent
- func (s *Store) Unsubscribe(ch chan WatchEvent)
- type TypeMeta
- type WatchEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatchLabels ¶
MatchLabels returns true if the resource labels contain all selector labels.
Types ¶
type ConfigMap ¶
type ConfigMap struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata"`
Data map[string]string `json:"data,omitempty"`
BinaryData map[string][]byte `json:"binaryData,omitempty"`
}
ConfigMap holds configuration data.
type ConfigMapList ¶
type ConfigMapList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata"`
Items []ConfigMap `json:"items"`
}
ConfigMapList is a list of ConfigMaps.
type ContainerPort ¶
type Deployment ¶
type Deployment struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata"`
Spec DeploymentSpec `json:"spec,omitempty"`
Status DeploymentStatus `json:"status,omitempty"`
}
Deployment represents a k8s deployment.
type DeploymentList ¶
type DeploymentList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata"`
Items []Deployment `json:"items"`
}
DeploymentList is a list of Deployments.
type DeploymentSpec ¶
type DeploymentSpec struct {
Replicas int `json:"replicas,omitempty"`
Selector *LabelSelector `json:"selector,omitempty"`
Template PodTemplateSpec `json:"template,omitempty"`
}
type DeploymentStatus ¶
type LabelSelector ¶
type ListMeta ¶
type ListMeta struct {
ResourceVersion string `json:"resourceVersion,omitempty"`
}
ListMeta describes metadata that synthetic resources must have.
type LoadBalancerIngress ¶
type LoadBalancerStatus ¶
type LoadBalancerStatus struct {
Ingress []LoadBalancerIngress `json:"ingress,omitempty"`
}
type Namespace ¶
type Namespace struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata"`
Spec NamespaceSpec `json:"spec,omitempty"`
Status NamespaceStatus `json:"status,omitempty"`
}
Namespace represents a k8s namespace.
type NamespaceList ¶
type NamespaceList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata"`
Items []Namespace `json:"items"`
}
NamespaceList is a list of Namespaces.
type NamespaceSpec ¶
type NamespaceSpec struct {
Finalizers []string `json:"finalizers,omitempty"`
}
type NamespaceStatus ¶
type NamespaceStatus struct {
Phase string `json:"phase,omitempty"`
}
type Node ¶
type Node struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata"`
Spec NodeSpec `json:"spec,omitempty"`
Status NodeStatus `json:"status,omitempty"`
}
Node represents a k8s node.
type NodeAddress ¶
type NodeCondition ¶
type NodeList ¶
type NodeList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata"`
Items []Node `json:"items"`
}
NodeList is a list of Nodes.
type NodeStatus ¶
type NodeStatus struct {
Conditions []NodeCondition `json:"conditions,omitempty"`
Addresses []NodeAddress `json:"addresses,omitempty"`
}
type ObjectMeta ¶
type ObjectMeta struct {
Name string `json:"name"`
Namespace string `json:"namespace,omitempty"`
UID string `json:"uid,omitempty"`
ResourceVersion string `json:"resourceVersion,omitempty"`
CreationTimestamp string `json:"creationTimestamp,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
}
ObjectMeta is metadata that all persisted resources must have.
type Pod ¶
type Pod struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata"`
Spec PodSpec `json:"spec,omitempty"`
Status PodStatus `json:"status,omitempty"`
}
Pod represents a k8s pod.
type PodCondition ¶
type PodList ¶
type PodList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata"`
Items []Pod `json:"items"`
}
PodList is a list of Pods.
type PodStatus ¶
type PodStatus struct {
Phase string `json:"phase,omitempty"`
PodIP string `json:"podIP,omitempty"`
HostIP string `json:"hostIP,omitempty"`
StartTime *string `json:"startTime,omitempty"`
Conditions []PodCondition `json:"conditions,omitempty"`
}
type PodTemplateSpec ¶
type PodTemplateSpec struct {
ObjectMeta `json:"metadata,omitempty"`
Spec PodSpec `json:"spec,omitempty"`
}
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router maps Kubernetes API paths to the appropriate handlers.
type Secret ¶
type Secret struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata"`
Data map[string][]byte `json:"data,omitempty"`
StringData map[string]string `json:"stringData,omitempty"`
Type string `json:"type,omitempty"`
}
Secret holds secret data.
type SecretList ¶
type SecretList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata"`
Items []Secret `json:"items"`
}
SecretList is a list of Secrets.
type Service ¶
type Service struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata"`
Spec ServiceSpec `json:"spec,omitempty"`
Status ServiceStatus `json:"status,omitempty"`
}
Service represents a k8s service.
type ServiceList ¶
type ServiceList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata"`
Items []Service `json:"items"`
}
ServiceList is a list of Services.
type ServicePort ¶
type ServiceSpec ¶
type ServiceSpec struct {
Type string `json:"type,omitempty"`
ClusterIP string `json:"clusterIP,omitempty"`
Selector map[string]string `json:"selector,omitempty"`
Ports []ServicePort `json:"ports,omitempty"`
}
type ServiceStatus ¶
type ServiceStatus struct {
LoadBalancer LoadBalancerStatus `json:"loadBalancer,omitempty"`
}
type Status ¶
type Status struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty"`
Status string `json:"status,omitempty"`
Message string `json:"message,omitempty"`
Reason string `json:"reason,omitempty"`
Code int `json:"code,omitempty"`
}
Status is a return value for calls that don't return other objects.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds all k8s resources in memory, organized by resource type, namespace, and name.
func NewStore ¶
func NewStore() *Store
NewStore creates an empty k8s resource store with default namespace.
func (*Store) CreateConfigMap ¶
func (*Store) CreateDeployment ¶
func (s *Store) CreateDeployment(dep *Deployment) error
func (*Store) CreateNamespace ¶
func (*Store) CreateSecret ¶
func (*Store) CreateService ¶
func (*Store) DeleteConfigMap ¶
func (*Store) DeleteDeployment ¶
func (*Store) DeleteNamespace ¶
func (*Store) DeleteSecret ¶
func (*Store) DeleteService ¶
func (*Store) FilterPodsByLabels ¶
FilterPodsByLabels parses a k8s label selector string and filters pods.
func (*Store) GetConfigMap ¶
func (*Store) GetDeployment ¶
func (s *Store) GetDeployment(namespace, name string) (*Deployment, bool)
func (*Store) ListAllPods ¶
func (*Store) ListConfigMaps ¶
func (*Store) ListDeployments ¶
func (s *Store) ListDeployments(namespace string) []Deployment
func (*Store) ListNamespaces ¶
func (*Store) ListSecrets ¶
func (*Store) ListServices ¶
func (*Store) Subscribe ¶
func (s *Store) Subscribe() chan WatchEvent
Subscribe returns a channel that receives watch events.
func (*Store) Unsubscribe ¶
func (s *Store) Unsubscribe(ch chan WatchEvent)
Unsubscribe removes a watcher channel.
type WatchEvent ¶
type WatchEvent struct {
Type string `json:"type"` // ADDED, MODIFIED, DELETED
Object interface{} `json:"object"`
}
WatchEvent is a single event in a watch stream.