kube

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	Name           string        `json:"name"`
	Image          string        `json:"image"`
	PullPolicy     PullPolicy    `json:"pull_policy"`
	Ports          []Port        `json:"ports,omitempty"`
	Environments   []Environment `json:"environments,omitempty"`
	LivenessProbe  *Probe        `json:"liveness,omitempty"`
	ReadinessProbe *Probe        `json:"readiness,omitempty"`
	CPU            *Resource     `json:"cpu"`
	Memory         *Resource     `json:"memory"`
}

func (*Container) Marshal

func (c *Container) Marshal() (container apiv1.Container)

func (*Container) Unmarshal

func (c *Container) Unmarshal(container apiv1.Container)

type Credential

type Credential interface {
	Login(string) (*kubernetes.Clientset, error)
}

type Deployment

type Deployment struct {
	Name          string            `json:"name"`
	Namespace     string            `json:"namespace"`
	Labels        map[string]string `json:"labels,omitempty"`
	Annotations   map[string]string `json:"annotations,omitempty"`
	Replicas      int               `json:"replicas"`
	Containers    []Container       `json:"containers"`
	NodeSelectors map[string]string `json:"node_selectors,omitempty"`

	CreatedAt time.Time `json:"created_at"`
}

func (*Deployment) Marshal

func (d *Deployment) Marshal() (appsv1.Deployment, error)

func (*Deployment) ToJSON

func (d *Deployment) ToJSON() string

func (*Deployment) Unmarshal

func (d *Deployment) Unmarshal(deployment *appsv1.Deployment) error

type DeploymentAPI

type DeploymentAPI struct {
	Kubernetes *Kubernetes
}

func NewDeploymentAPI

func NewDeploymentAPI(kubernetes *Kubernetes) *DeploymentAPI

func (*DeploymentAPI) Create

func (d *DeploymentAPI) Create()

func (*DeploymentAPI) Delete

func (d *DeploymentAPI) Delete()

func (*DeploymentAPI) Find

func (d *DeploymentAPI) Find()

func (*DeploymentAPI) GetClient

func (d *DeploymentAPI) GetClient() v1.DeploymentInterface

func (*DeploymentAPI) Update

func (d *DeploymentAPI) Update()

func (*DeploymentAPI) Upsert

func (d *DeploymentAPI) Upsert()

type Environment

type Environment struct {
	Type  string `json:"type"`
	From  string `json:"from"`
	Name  string `json:"name"`
	Value string `json:"value"`
}

func (*Environment) Marshal

func (e *Environment) Marshal() *apiv1.EnvVar

func (*Environment) Unmarshal

func (e *Environment) Unmarshal(env *apiv1.EnvVar)

type HPA

type HPA struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
}

type HPAAPI

type HPAAPI struct {
	Kubernetes *Kubernetes
	Client     interface{}
}

func NewHPAAPI

func NewHPAAPI(kubernetes *Kubernetes) *HPAAPI

func (*HPAAPI) Create

func (h *HPAAPI) Create()

func (*HPAAPI) Delete

func (h *HPAAPI) Delete()

func (*HPAAPI) Find

func (h *HPAAPI) Find()

func (*HPAAPI) Update

func (h *HPAAPI) Update()

func (*HPAAPI) Upsert

func (h *HPAAPI) Upsert()

type KubeAPI

type KubeAPI interface {
	Find()
	Create()
	Update()
	Upsert()
	Delete()
}

type KubeConfigCredential

type KubeConfigCredential struct {
	Path string
}

func (KubeConfigCredential) GetPath

func (k KubeConfigCredential) GetPath() string

func (KubeConfigCredential) Login

func (k KubeConfigCredential) Login(address string) (*kubernetes.Clientset, error)

type Kubernetes

type Kubernetes struct {
	Client    *kubernetes.Clientset
	Statement *Statement

	Error        error
	RowsAffected int64
}

func (*Kubernetes) Create

func (k *Kubernetes) Create(entity interface{}) (tx *Kubernetes)

func (*Kubernetes) Delete

func (k *Kubernetes) Delete(entity interface{}) (tx *Kubernetes)

func (*Kubernetes) Find

func (k *Kubernetes) Find(entity interface{}) (tx *Kubernetes)

func (*Kubernetes) Update

func (k *Kubernetes) Update(entity interface{}) (tx *Kubernetes)

func (*Kubernetes) Upsert

func (k *Kubernetes) Upsert(entity interface{}) (tx *Kubernetes)

type Namespace

type Namespace struct {
	Name   string            `json:"name"`
	Labels map[string]string `json:"labels"`
}

func (*Namespace) Marshal

func (n *Namespace) Marshal() (apiv1.Namespace, error)

func (*Namespace) Unmarshal

func (n *Namespace) Unmarshal(namespace *apiv1.Namespace) error

type NamespaceAPI

type NamespaceAPI struct {
	Kubernetes *Kubernetes
	Client     v1.NamespaceInterface
}

func NewNamespaceAPI

func NewNamespaceAPI(kubernetes *Kubernetes) *NamespaceAPI

func (*NamespaceAPI) Create

func (n *NamespaceAPI) Create()

func (*NamespaceAPI) Delete

func (n *NamespaceAPI) Delete()

func (*NamespaceAPI) Find

func (n *NamespaceAPI) Find()

func (*NamespaceAPI) Update

func (n *NamespaceAPI) Update()

func (*NamespaceAPI) Upsert

func (n *NamespaceAPI) Upsert()

type Port

type Port struct {
	Type string `json:"type"`
	From int32  `json:"from"`
	To   int32  `json:"to"`
}

func (*Port) Marshal

func (p *Port) Marshal() *apiv1.ContainerPort

func (*Port) Unmarshal

func (p *Port) Unmarshal(port *apiv1.ContainerPort)

type Probe

type Probe struct {
	TimeoutSeconds      int32 `json:"timeout_seconds"`
	InitialDelaySeconds int32 `json:"initial_delay_seconds"`
	PeriodSeconds       int32 `json:"period_seconds"`
	SuccessThreshold    int32 `json:"success_threshold"`
	FailureThreshold    int32 `json:"failure_threshold"`
}

func (*Probe) Marshal

func (p *Probe) Marshal() *apiv1.Probe

func (*Probe) Unmarshal

func (p *Probe) Unmarshal(probe apiv1.Probe)

type PullPolicy

type PullPolicy string
const (
	PullAlways       PullPolicy = "Always"
	PullNever        PullPolicy = "Never"
	PullIfNotPresent PullPolicy = "IfNotPresent"
)

type Resource

type Resource struct {
	Requests string `json:"requests"`
	Limits   string `json:"limits"`
}

type Service

type Service struct {
	Name        string            `json:"name"`
	Namespace   string            `json:"namespace"`
	AppSelector string            `json:"-"`
	Labels      map[string]string `json:"labels,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
	Ports       []int32

	CreatedAt time.Time `json:"created_at"`
}

func (*Service) Marshal

func (s *Service) Marshal() (apiv1.Service, error)

func (*Service) ToJSON

func (s *Service) ToJSON() string

func (*Service) Unmarshal

func (s *Service) Unmarshal(service *apiv1.Service) error

type ServiceAPI

type ServiceAPI struct {
	Kubernetes *Kubernetes
}

func NewServiceAPI

func NewServiceAPI(kubernetes *Kubernetes) *ServiceAPI

func (*ServiceAPI) Create

func (s *ServiceAPI) Create()

func (*ServiceAPI) Delete

func (s *ServiceAPI) Delete()

func (*ServiceAPI) Find

func (s *ServiceAPI) Find()

func (*ServiceAPI) GetClient

func (s *ServiceAPI) GetClient() v1.ServiceInterface

func (*ServiceAPI) Update

func (s *ServiceAPI) Update()

func (*ServiceAPI) Upsert

func (s *ServiceAPI) Upsert()

type ServiceAccountCredential

type ServiceAccountCredential struct {
	Name  string
	Token string
}

func (ServiceAccountCredential) Login

type Statement

type Statement struct {
	// A reference to Kubernetes API
	Client *kubernetes.Clientset

	// An object provided during updates
	Origin reflect.Value

	// An object (or list) provided during
	// the creation or while fetching objets
	Target reflect.Value

	// A reference to the API of a given
	// (target) object through reflection
	API KubeAPI
}

func (*Statement) GetOrigin

func (s *Statement) GetOrigin() interface{}

func (*Statement) GetTarget

func (s *Statement) GetTarget() interface{}

func (*Statement) SetTarget

func (s *Statement) SetTarget(value interface{})

type UserPasswordCredential

type UserPasswordCredential struct {
	Username string
	Password string
}

func (UserPasswordCredential) Login

Jump to

Keyboard shortcuts

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