Documentation
¶
Index ¶
- Constants
- func GenerateRequest(name string, templates map[string]string, templateParams interface{}, ...) error
- func IsIntStrEmpty(value intstr.IntOrString) bool
- func New() *service
- func ProcessResource(context *endly.Context, expand bool, resource *url.Resource, reverse bool, ...) error
- func ShortItemInfo(kind string, item map[string]interface{}) map[string]interface{}
- type ApplyRequest
- type ApplyResponse
- type CreateRequest
- type CreateResponse
- type DeleteRequest
- type DeleteResponse
- type ExposeRequest
- type ExposeResponse
- type ExposeTemplateParams
- type ForwardPortsRequest
- type ForwardPortsResponse
- type GetRequest
- type GetResponse
- type ResourceCondition
- type ResourceInfo
- type ResourceInfoResponse
- type ResourceMeta
- type ResourcePatch
- type ResourceStatus
- type ResourcesMetaInfo
- type RunRequest
- type RunResponse
- type RunTemplateParams
- type ShortResourceResponse
Constants ¶
const ( RunV1GeneratorName = "run/v1" RunPodV1GeneratorName = "run-pod/v1" DeploymentAppsV1GeneratorName = "deployment/apps.v1" JobV1GeneratorName = "job/v1" CronJobV1Beta1GeneratorName = "cronjob/v1beta1" )
const (
//ServiceID Kubernetes service ID.
ServiceID = "kubernetes"
)
const (
ServiceV1GeneratorName = "service/v1"
)
Variables ¶
This section is empty.
Functions ¶
func GenerateRequest ¶ added in v0.31.0
func GenerateRequest(name string, templates map[string]string, templateParams interface{}, handler func(meta *ResourceMeta, data map[string]interface{}) error) error
GenerateRequest converts request with provided template and call handler with meta and request data.
func IsIntStrEmpty ¶ added in v0.31.0
func IsIntStrEmpty(value intstr.IntOrString) bool
func ProcessResource ¶
func ShortItemInfo ¶ added in v0.31.0
ShortResourceResponse returns short info
Types ¶
type ApplyRequest ¶
type ApplyRequest struct {
*url.Resource
*ResourceMeta
Expand bool `description:"flag to expand resource with $ expression"`
}
ApplyRequest represents apply request
func (*ApplyRequest) Init ¶ added in v0.33.0
func (r *ApplyRequest) Init() error
Init initializes request
type ApplyResponse ¶ added in v0.31.0
type ApplyResponse ResourceInfoResponse
ApplyResponse represents apply response
type CreateRequest ¶
type CreateRequest struct {
*ResourceMeta
*url.Resource
Expand bool `description:"flag to expand resource with $ expression"`
}
CreateRequest represents create request
func (*CreateRequest) Init ¶ added in v0.31.0
func (r *CreateRequest) Init() (err error)
type CreateResponse ¶
type CreateResponse ResourceInfoResponse
CreateResponse represents create response
type DeleteRequest ¶ added in v0.31.0
type DeleteRequest struct {
Name string
LabelSelector string
metav1.TypeMeta `json:",inline"`
*url.Resource
TimeoutMs int
}
DeleteRequest represents delete response
func (*DeleteRequest) AsGetRequest ¶ added in v0.31.0
func (r *DeleteRequest) AsGetRequest() *GetRequest
AsGetRequest returns get request
func (*DeleteRequest) Init ¶ added in v0.31.0
func (r *DeleteRequest) Init() (err error)
type DeleteResponse ¶ added in v0.31.0
type DeleteResponse ResourceInfoResponse
DeleteResponse represents delete response
type ExposeRequest ¶ added in v0.31.0
type ExposeRequest struct {
Resource string `description:"a target resource name to be exposed"`
ResourceKind string `description:"optional target resource kind"`
Name string `description:"metadata.name"`
Protocol v1.Protocol `description:"spec.ports[].protocol"`
Port int32 `description:"spec.ports[].port: expose port"`
TargetPort string `description:"spec.ports[].targetPort: name or number for the port on the container that the service should direct traffic to"`
Type string `description:"spec.type: for this service: ClusterIP, NodePort, LoadBalancer, or ExternalName"`
LoadBalancerIP string `description:"spec.loadBalancerIP: IP to assign to the LoadBalancer"`
Labels map[string]string `description:"spec.labels"`
ExternalIPs string `description:"spec.ExternalIPs"`
SessionAffinity string `description:"spec.SessionAffinity: if non empty: 'None', 'ClientIP'"`
ClusterIP string `` /* 136-byte string literal not displayed */
ExternalName string `description:"spec.externalName"`
HealthCheckNodePort int `description:"spec.HealthCheckNodePort"`
// contains filtered or unexported fields
}
ExposeRequest represent expose request
func (*ExposeRequest) Init ¶ added in v0.31.0
func (r *ExposeRequest) Init() error
Init initialises request
func (*ExposeRequest) Validate ¶ added in v0.31.0
func (r *ExposeRequest) Validate() error
Validate checks if request is valid
type ExposeResponse ¶ added in v0.31.0
type ExposeResponse ResourceInfoResponse
ExposeResponse represent expose response
type ExposeTemplateParams ¶ added in v0.31.0
type ExposeTemplateParams struct {
*ExposeRequest
Ports []v1.ServicePort
Selector map[string]string
SessionAffinityConfig *v1.SessionAffinityConfig
}
func NewExposeTemplateParams ¶ added in v0.31.0
func NewExposeTemplateParams(source *ResourceInfo, request *ExposeRequest) (*ExposeTemplateParams, error)
func (*ExposeTemplateParams) Apply ¶ added in v0.31.0
func (p *ExposeTemplateParams) Apply(source *ResourceInfo) error
type ForwardPortsRequest ¶ added in v0.33.0
type ForwardPortsRequest struct {
Name string `description:"resource name"`
LabelSelector string `json:"selector" yaml:"selector" description:"selector for matching pod or resource with pod spec"`
metav1.TypeMeta `json:",inline"`
Ports []string `description:"ports to forward in dest:source or just port"`
TimeoutMs int `description:"maximum wait time for pod getting ready"`
}
ForwardPortsRequest represents forward port request
func (*ForwardPortsRequest) AsGetRequest ¶ added in v0.33.0
func (r *ForwardPortsRequest) AsGetRequest() (*GetRequest, error)
AsGetRequest returns get request
func (*ForwardPortsRequest) Init ¶ added in v0.33.0
func (r *ForwardPortsRequest) Init() error
Validate checks if request is valid
func (*ForwardPortsRequest) Validate ¶ added in v0.33.0
func (r *ForwardPortsRequest) Validate() error
Validate checks if request is valid
type ForwardPortsResponse ¶ added in v0.33.0
type ForwardPortsResponse struct {
Name string
}
ForwardPortsRequest represents forward port response
type GetRequest ¶
type GetRequest struct {
Name string
metav1.ListOptions
Describe bool `description:"describe flag control output"`
// contains filtered or unexported fields
}
GetRequest represents get request
func (*GetRequest) Init ¶
func (r *GetRequest) Init() (err error)
func (*GetRequest) Validate ¶ added in v0.31.0
func (r *GetRequest) Validate() (err error)
type ResourceCondition ¶ added in v0.31.0
ResourceCondition contains details for the current condition
type ResourceInfo ¶ added in v0.31.0
type ResourceInfo struct {
metav1.TypeMeta `yaml:",inline"`
metav1.ObjectMeta `yaml:"metadata"`
Spec interface{}
Status interface{}
Raw interface{} `yaml:"-"`
}
ResourceInfo represents generic resource info
func (*ResourceInfo) ContainerPorts ¶ added in v0.31.0
func (i *ResourceInfo) ContainerPorts() []v1.ContainerPort
func (*ResourceInfo) Containers ¶ added in v0.31.0
func (i *ResourceInfo) Containers() []v1.Container
func (*ResourceInfo) IsReady ¶ added in v0.31.0
func (i *ResourceInfo) IsReady() bool
func (*ResourceInfo) ResourceStatus ¶ added in v0.31.0
func (i *ResourceInfo) ResourceStatus() *ResourceStatus
type ResourceInfoResponse ¶ added in v0.31.0
type ResourceInfoResponse struct {
Items []*ResourceInfo
}
ResourceInfoResponse represents info response
type ResourceMeta ¶ added in v0.31.0
type ResourceMeta struct {
metav1.TypeMeta
Metadata metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
}
ResourceMeta represents a k8 resource meta
type ResourcePatch ¶ added in v0.31.0
type ResourcePatch struct {
metav1.TypeMeta `json:",inline"`
Name string
Pt types.PatchType
Data []byte
HasChanged bool
}
ResourcePatch represents resource patch
func NewResourcePatch ¶ added in v0.31.0
func NewResourcePatch(meta *ResourceMeta, original, target interface{}) (*ResourcePatch, error)
NewResourcePatch returns a new resource patch
type ResourceStatus ¶ added in v0.31.0
type ResourceStatus struct {
Conditions []ResourceCondition
PublishNotReadyAddresses *bool
}
type ResourcesMetaInfo ¶ added in v0.31.0
type ResourcesMetaInfo struct {
*ResourceMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`
Items []*ResourceMeta `json:"items,omitempty" yaml:"items,omitempty"`
}
ResourcesMetaInfo represents resource meta info
func ToResourceMetas ¶ added in v0.31.0
func ToResourceMetas(items []*ResourceInfo) *ResourcesMetaInfo
ToResourceMetas converts *ResourceInfo slice to []*ResourceMeta
type RunRequest ¶ added in v0.31.0
type RunRequest struct {
Expose bool
Replicas int
Template string
Schedule string
Labels map[string]string
Name string `description:"metadata.name"`
RestartPolicy core.RestartPolicy `description:"spec.restartPolicy"`
DNSPolicy v1.DNSPolicy `description:"spec.dNSPolicy"`
ServiceAccount string `description:"spec.serviceAccountName"`
ImagePullPolicy core.PullPolicy `description:"spec.containers[].imagePullPolicy"`
Image string `description:"spec.containers[].image"`
Commands []string `description:"spec.containers[].commands"`
Args []string `description:"spec.containers[].args"`
Env map[string]string `description:"spec.containers[].env"`
Limits map[string]string `description:"spec.containers[].resources.limits"`
Requests map[string]string `description:"spec.containers[].resources.requests"`
Port int `description:"spec.containers[].ports[].containerPort"`
HostPort int `description:"spec.containers[].ports[].hostPort"`
}
RunRequest represents run request
func (*RunRequest) Init ¶ added in v0.31.0
func (r *RunRequest) Init() error
func (*RunRequest) Validate ¶ added in v0.31.0
func (r *RunRequest) Validate() error
type RunResponse ¶ added in v0.31.0
type RunResponse ResourceInfoResponse
RunResponse represents run response
type RunTemplateParams ¶ added in v0.31.0
type RunTemplateParams struct {
*RunRequest
Ports []*v1.ContainerPort
Resources []*v1.ResourceRequirements
LabelSelector *metav1.LabelSelector // {MatchLabels: labels}
Envs []v1.EnvVar
}
RunTemplateParams represents run template parameters
func NewRunTemplateParams ¶ added in v0.31.0
func NewRunTemplateParams(request *RunRequest) (*RunTemplateParams, error)
NewRunTemplateParams create a new run template parameters for supplied run request
type ShortResourceResponse ¶ added in v0.31.0
type ShortResourceResponse struct {
Items []interface{}
}
ShortResourceResponse represents resource meta info
func NewShortResourceResponse ¶ added in v0.31.0
func NewShortResourceResponse(response ResourceInfoResponse) *ShortResourceResponse
NewShortResourceResponse create short response