Documentation
¶
Overview ¶
Package client provides an implementation of a restricted subset of kubernetes API client
Index ¶
- Variables
- func CertPoolFromFile(filename string) (*x509.CertPool, error)
- func CertsFromPEM(pemCerts []byte) ([]*x509.Certificate, error)
- func Format(v string) string
- func NewClientInCluster() *client
- type Container
- type ContainerPort
- type Deployment
- type DeploymentCondition
- type DeploymentList
- type DeploymentSpec
- type DeploymentStatus
- type EnvVar
- type Kubernetes
- type LabelSelector
- type LoadBalancerIngress
- type LoadBalancerStatus
- type Metadata
- type PodSpec
- type Resource
- type Service
- type ServiceList
- type ServicePort
- type ServiceSpec
- type ServiceStatus
- type Template
Constants ¶
This section is empty.
Variables ¶
var (
// DefaultImage is default micro image
DefaultImage = "micro/go-micro"
)
var ( // ErrReadNamespace is returned when the names could not be read from service account ErrReadNamespace = errors.New("Could not read namespace from service account secret") )
Functions ¶
func CertPoolFromFile ¶
CertPoolFromFile returns an x509.CertPool containing the certificates in the given PEM-encoded file. Returns an error if the file could not be read, a certificate could not be parsed, or if the file does not contain any certificates
func CertsFromPEM ¶
func CertsFromPEM(pemCerts []byte) ([]*x509.Certificate, error)
CertsFromPEM returns the x509.Certificates contained in the given PEM-encoded byte array Returns an error if a certificate could not be parsed, or if the data does not contain any certificates
func NewClientInCluster ¶
func NewClientInCluster() *client
NewClientInCluster creates a Kubernetes client for use from within a k8s pod.
Types ¶
type Container ¶ added in v1.17.0
type Container struct {
Name string `json:"name"`
Image string `json:"image"`
Env []EnvVar `json:"env,omitempty"`
Command []string `json:"command,omitempty"`
Ports []ContainerPort `json:"ports,omitempty"`
}
Container defined container runtime values
type ContainerPort ¶ added in v1.17.0
type ContainerPort struct {
Name string `json:"name,omitempty"`
HostPort int `json:"hostPort,omitempty"`
ContainerPort int `json:"containerPort"`
Protocol string `json:"protocol,omitempty"`
}
ContainerPort
type Deployment ¶ added in v1.16.0
type Deployment struct {
Metadata *Metadata `json:"metadata"`
Spec *DeploymentSpec `json:"spec,omitempty"`
Status *DeploymentStatus `json:"status,omitempty"`
}
Deployment is Kubernetes deployment
func NewDeployment ¶ added in v1.17.0
func NewDeployment(name, version, typ string) *Deployment
NewService returns default micro kubernetes deployment definition
type DeploymentCondition ¶ added in v1.17.0
type DeploymentCondition struct {
Type string `json:"type"`
Reason string `json:"reason,omitempty"`
Message string `json:"message,omitempty"`
}
DeploymentCondition describes the state of deployment
type DeploymentList ¶ added in v1.16.0
type DeploymentList struct {
Items []Deployment `json:"items"`
}
DeploymentList
type DeploymentSpec ¶ added in v1.17.0
type DeploymentSpec struct {
Replicas int `json:"replicas,omitempty"`
Selector *LabelSelector `json:"selector"`
Template *Template `json:"template,omitempty"`
}
DeploymentSpec defines micro deployment spec
type DeploymentStatus ¶ added in v1.17.0
type DeploymentStatus struct {
Replicas int `json:"replicas,omitempty"`
UpdatedReplicas int `json:"updatedReplicas,omitempty"`
ReadyReplicas int `json:"readyReplicas,omitempty"`
AvailableReplicas int `json:"availableReplicas,omitempty"`
Conditions []DeploymentCondition `json:"conditions,omitempty"`
}
DeploymentStatus is returned when querying deployment
type Kubernetes ¶
type Kubernetes interface {
// Create creates new API resource
Create(*Resource) error
// Get queries API resrouces
Get(*Resource, map[string]string) error
// Update patches existing API object
Update(*Resource) error
// Delete deletes API resource
Delete(*Resource) error
// List lists API resources
List(*Resource) error
}
Kubernetes client
type LabelSelector ¶ added in v1.17.0
LabelSelector is a label query over a set of resources NOTE: we do not support MatchExpressions at the moment
type LoadBalancerIngress ¶ added in v1.17.0
type LoadBalancerStatus ¶ added in v1.17.0
type LoadBalancerStatus struct {
Ingress []LoadBalancerIngress `json:"ingress,omitempty"`
}
type Metadata ¶
type Metadata struct {
Name string `json:"name,omitempty"`
Namespace string `json:"namespace,omitempty"`
Version string `json:"version,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
}
Metadata defines api object metadata
type PodSpec ¶ added in v1.17.0
type PodSpec struct {
Containers []Container `json:"containers"`
}
PodSpec
type Service ¶ added in v1.17.0
type Service struct {
Metadata *Metadata `json:"metadata"`
Spec *ServiceSpec `json:"spec,omitempty"`
Status *ServiceStatus `json:"status,omitempty"`
}
Service is kubernetes service
func NewService ¶ added in v1.17.0
NewService returns default micro kubernetes service definition
type ServiceList ¶ added in v1.17.0
type ServiceList struct {
Items []Service `json:"items"`
}
ServiceList
type ServicePort ¶ added in v1.17.0
type ServicePort struct {
Name string `json:"name,omitempty"`
Port int `json:"port"`
Protocol string `json:"protocol,omitempty"`
}
ServicePort configures service ports
type ServiceSpec ¶ added in v1.17.0
type ServiceSpec struct {
Type string `json:"type,omitempty"`
Selector map[string]string `json:"selector,omitempty"`
Ports []ServicePort `json:"ports,omitempty"`
}
ServiceSpec provides service configuration
type ServiceStatus ¶ added in v1.17.0
type ServiceStatus struct {
LoadBalancer LoadBalancerStatus `json:"loadBalancer,omitempty"`
}
ServiceStatus