Documentation
¶
Index ¶
- Constants
- Variables
- func JsonPrettyPrint(jsonContent []GenericJson, np *jww.Notepad) (err error)
- func LoadJsonFromFile(path string, b interface{}) (err error)
- func Prompt(np *jww.Notepad, prompt string) string
- func UserLogin(db *dbconfig.ConfigDB, login, password string, np *jww.Notepad) (token string, err error)
- func UserLogout(db *dbconfig.ConfigDB) error
- func YamlPrint(jsonContent []GenericJson, np *jww.Notepad) (err error)
- type Client
- func (c *Client) Create(jsonToSend GenericJson) (err error)
- func (c *Client) Delete(kind, name, nameSpace string, allPods bool) (err error)
- func (c *Client) Expose(name string, ports []Port, nameSpace string) (apiResult TcpApiResult, err error)
- func (c *Client) Get(kind, name, nameSpace string) (apiResult TcpApiResult, err error)
- func (c *Client) Login(login, password string) (token string, err error)
- func (c *Client) Run(name string, params ConfigureParams, nameSpace string) (result TcpApiResult, err error)
- func (c *Client) Set(deploy, container, parameter, value, nameSpace string) (res TcpApiResult, err error)
- type CommonObject
- type Condiniton
- type ConfigureParams
- type Container
- type ContainerStatus
- type Deploy
- type EnvVar
- type GenericJson
- type HttpApiHandler
- func (h *HttpApiHandler) Create(jsonToSend GenericJson, kind, nameSpace string) (result HttpApiResult, err error)
- func (h *HttpApiHandler) Delete(kind, name, nameSpace string, allPods bool) (result HttpApiResult, err error)
- func (h *HttpApiHandler) DeleteNameSpaces(name string) (result HttpApiResult, err error)
- func (h *HttpApiHandler) Expose(jsonToSend GenericJson, nameSpace string) (result HttpApiResult, err error)
- func (h *HttpApiHandler) Get(kind, name, nameSpace string) (result HttpApiResult, err error)
- func (h *HttpApiHandler) GetNameSpaces(name string) (result HttpApiResult, err error)
- func (h *HttpApiHandler) Login(jsonToSend GenericJson) (result HttpApiResult, err error)
- func (h *HttpApiHandler) Replace(jsonToSend GenericJson, nameSpace, kind string) (result HttpApiResult, err error)
- func (h *HttpApiHandler) ReplaceNameSpaces(jsonToSend GenericJson) (result HttpApiResult, err error)
- func (h *HttpApiHandler) Run(jsonToSend GenericJson, nameSpace string) (result HttpApiResult, err error)
- func (h *HttpApiHandler) SetForContainer(jsonToSend GenericJson, containerName, nameSpace string) (result HttpApiResult, err error)
- func (h *HttpApiHandler) SetForDeploy(jsonToSend GenericJson, deploy, nameSpace string) (result HttpApiResult, err error)
- type HttpApiResult
- type HwResources
- type HwSpecs
- type Metadata
- type Namespace
- type NodeSelector
- type Pod
- type Port
- type Resources
- type Service
- type Spec
- type Specs
- type TcpApiHandler
- type TcpApiResult
Constants ¶
View Source
const ( KindDeployments = "deployments" KindNamespaces = "namespaces" KindPods = "pods" KindService = "services" )
View Source
const ( KeyImage = "image" KeyReplicas = "replicas" )
View Source
const ( DefaultReplicas = 1 DefaultCPURequest = "100m" DefaultMemoryRequest = "128Mi" )
View Source
const ( LabelRegex = `^[a-z0-9]([-a-z0-9]*[a-z0-9])?$` CpuRegex = `^\d+(.\d+)?m?$` MemRegex = `^\d+(.\d+)?(Mi|Gi)$` DeployRegex = LabelRegex // deployment name appears in labels )
View Source
const DefaultProto = "TCP"
Variables ¶
View Source
var ( ConfigDir string ConfigFile string SrcFolder string TemplatesFolder string RunFile string ExposeFile string )
View Source
var ( DevGoPath string DevGoRoot string )
View Source
var ( CommitHash string BuildDate string )
Functions ¶
func JsonPrettyPrint ¶
func JsonPrettyPrint(jsonContent []GenericJson, np *jww.Notepad) (err error)
func LoadJsonFromFile ¶
func UserLogout ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Create ¶
func (c *Client) Create(jsonToSend GenericJson) (err error)
func (*Client) Get ¶
func (c *Client) Get(kind, name, nameSpace string) (apiResult TcpApiResult, err error)
func (*Client) Run ¶
func (c *Client) Run(name string, params ConfigureParams, nameSpace string) (result TcpApiResult, err error)
type CommonObject ¶
type Condiniton ¶
type Condiniton struct {
LastTransitionTime time.Time `json:"lastTransitionTime,omitempty"`
LastUpdateTime time.Time `json:"lastUpdateTime,omitempty"`
Message string `json:"message,omitempty"`
Reason string `json:"reason,omitempty"`
Status string `json:"status,omitempty"`
Type string `json:"type,omitempty"`
}
type ConfigureParams ¶
type ConfigureParams struct {
Image string
Ports []int
Labels map[string]string
Env []EnvVar
CPU string
Memory string
Replicas int
Command []string
}
func ParamsFromArgs ¶
func ParamsFromArgs(np *jww.Notepad, flags *pflag.FlagSet) (params ConfigureParams)
func PromptParams ¶
func PromptParams(np *jww.Notepad) (params ConfigureParams)
type Container ¶
type Container struct {
Command []string `json:"command,omitempty"`
Env []EnvVar `json:"env,omitempty"`
Image string `json:"image,omitempty"`
ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
Name string `json:"name,omitempty"`
Ports []Port `json:"ports,omitempty"`
Resources Resources `json:"resources,omitempty"`
TerminationMessagePath string `json:"terminationMessagePath,omitempty"`
TerminationMessagePolicy string `json:"terminationMessagePolicy,omitempty"`
}
type ContainerStatus ¶
type ContainerStatus struct {
ContainerID string `json:"containerID,omitempty"`
Image string `json:"image,omitempty"`
ImageID string `json:"imageID,omitempty"`
Name string `json:"name,omitempty"`
Ready bool `json:"ready,omitempty"`
RestartCount int `json:"restartCount,omitempty"`
State map[string]interface{} `json:"state,omitempty"`
}
type Deploy ¶
type Deploy struct {
CommonObject
Spec struct {
ProgressDeadlineSeconds int `json:"progressDeadlineSeconds,omitempty"`
Replicas int `json:"replicas"`
RevisionHistoryLimit int `json:"revisionHistoryLimit,omitempty"`
Selector *struct {
MatchLabels map[string]string `json:"matchLabels,omitempty"`
} `json:"selector,omitempty"`
Strategy map[string]interface{} `json:"strategy,omitempty"`
Template struct {
Metadata Metadata `json:"metadata,omitempty"`
Spec Spec `json:"spec,omitempty"`
} `json:"template,omitempty"`
} `json:"spec,omitempty"`
Status *struct {
AvailableReplicas int `json:"availableReplicas,omitempty"`
Conditions []Condiniton `json:"conditions,omitempty"`
ObservedGeneration int `json:"observedGeneration,omitempty"`
ReadyReplicas int `json:"readyReplicas,omitempty"`
Replicas int `json:"replicas,omitempty"`
UpdatedReplicas int `json:"updatedReplicas,omitempty"`
UnavaliableReplicas int `json:"unavaliableReplicas,omitempty"`
} `json:"status,omitempty"`
}
type GenericJson ¶
type GenericJson map[string]interface{}
func GetCmdRequestJson ¶
func GetCmdRequestJson(client *Client, kind, name, nameSpace string) (ret []GenericJson, err error)
type HttpApiHandler ¶
type HttpApiHandler struct {
// contains filtered or unexported fields
}
func NewHttpApiHandler ¶
func NewHttpApiHandler(cfg dbconfig.HttpApiConfig, uuid, token string, np *jww.Notepad) *HttpApiHandler
func (*HttpApiHandler) Create ¶
func (h *HttpApiHandler) Create(jsonToSend GenericJson, kind, nameSpace string) (result HttpApiResult, err error)
func (*HttpApiHandler) Delete ¶
func (h *HttpApiHandler) Delete(kind, name, nameSpace string, allPods bool) (result HttpApiResult, err error)
func (*HttpApiHandler) DeleteNameSpaces ¶
func (h *HttpApiHandler) DeleteNameSpaces(name string) (result HttpApiResult, err error)
func (*HttpApiHandler) Expose ¶
func (h *HttpApiHandler) Expose(jsonToSend GenericJson, nameSpace string) (result HttpApiResult, err error)
func (*HttpApiHandler) Get ¶
func (h *HttpApiHandler) Get(kind, name, nameSpace string) (result HttpApiResult, err error)
func (*HttpApiHandler) GetNameSpaces ¶
func (h *HttpApiHandler) GetNameSpaces(name string) (result HttpApiResult, err error)
func (*HttpApiHandler) Login ¶
func (h *HttpApiHandler) Login(jsonToSend GenericJson) (result HttpApiResult, err error)
func (*HttpApiHandler) Replace ¶
func (h *HttpApiHandler) Replace(jsonToSend GenericJson, nameSpace, kind string) (result HttpApiResult, err error)
func (*HttpApiHandler) ReplaceNameSpaces ¶
func (h *HttpApiHandler) ReplaceNameSpaces(jsonToSend GenericJson) (result HttpApiResult, err error)
func (*HttpApiHandler) Run ¶
func (h *HttpApiHandler) Run(jsonToSend GenericJson, nameSpace string) (result HttpApiResult, err error)
func (*HttpApiHandler) SetForContainer ¶
func (h *HttpApiHandler) SetForContainer(jsonToSend GenericJson, containerName, nameSpace string) (result HttpApiResult, err error)
func (*HttpApiHandler) SetForDeploy ¶
func (h *HttpApiHandler) SetForDeploy(jsonToSend GenericJson, deploy, nameSpace string) (result HttpApiResult, err error)
type HttpApiResult ¶
type HttpApiResult map[string]interface{}
func (*HttpApiResult) HandleApiResult ¶
func (apiResult *HttpApiResult) HandleApiResult() error
type HwResources ¶
type Metadata ¶
type Metadata struct {
Annotations map[string]string `json:"annotations,omitempty"`
CreationTimestamp *time.Time `json:"creationTimestamp,omitempty"`
GenerateName string `json:"generateName,omitempty"`
Labels map[string]string `json:"labels"`
Name string `json:"name,omitempty"`
Namespace string `json:"namespace,omitempty"`
OwnerReferences []struct {
APIVersion string `json:"apiVersion,omitempty"`
BlockOwnerDeletion bool `json:"blockOwnerDeletion,omitempty"`
Controller bool `json:"controller,omitempty"`
Kind string `json:"kind,omitempty"`
Name string `json:"name,omitempty"`
UID string `json:"uid,omitempty"`
} `json:"ownerReferences,omitempty"`
ResourceVersion string `json:"resourceVersion,omitempty"`
SelfLink string `json:"selfLink,omitempty"`
UID string `json:"uid,omitempty"`
}
type Namespace ¶
type Namespace struct {
CommonObject
Data struct {
APIVersion string `json:"apiVersion,omitempty"`
Kind string `json:"kind,omitempty"`
Metadata Metadata `json:"metadata,omitempty"`
Spec Specs `json:"spec,omitempty"`
Status struct {
Hard HwSpecs `json:"hard,omitempty"`
Used HwSpecs `json:"used,omitempty"`
Phase string `json:"phase,omitempty"`
} `json:"status,omitempty"`
} `json:"data,omitempty"`
}
type NodeSelector ¶
type NodeSelector struct {
Role string `json:"role,omitempty"`
}
type Pod ¶
type Pod struct {
CommonObject
Spec Spec `json:"spec,omitempty"`
Status struct {
Conditions []Condiniton `json:"conditions,omitempty"`
ContainerStatuses []ContainerStatus `json:"containerStatuses,omitempty"`
HostIP net.IP `json:"hostIP,omitempty"`
Phase string `json:"phase,omitempty"`
PodIP net.IP `json:"podIP,omitempty"`
QosClass string `json:"qosClass,omitempty"`
StartTime time.Time `json:"startTime,omitempty"`
} `json:"status,omitempty"`
}
type Resources ¶
type Resources struct {
Limits *HwResources `json:"limits,omitempty"`
Requests *HwResources `json:"requests,omitempty"`
}
type Service ¶
type Service struct {
CommonObject
Spec struct {
ClusterIP net.IP `json:"clusterIP,omitempty"`
DeprecatedPublicIPs []net.IP `json:"deprecatedPublicIPs,omitempty"`
ExternalHosts []string `json:"externalHosts,omitempty"`
DomainHosts []string `json:"domainHosts,omitempty"`
Ports []Port `json:"ports,omitempty"`
Selector map[string]string `json:"selector,omitempty"`
SessionAffinity string `json:"sessionAffinity,omitempty"`
Type string `json:"type,omitempty"`
} `json:"spec,omitempty"`
Status map[string]interface{} `json:"status,omitempty"`
}
type Spec ¶
type Spec struct {
AutomountServiceAccountToken bool `json:"automountServiceAccountToken,omitempty"`
Containers []Container `json:"containers,omitempty"`
DNSPolicy string `json:"dnsPolicy,omitempty"`
NodeName string `json:"nodeName,omitempty"`
RestartPolicy string `json:"restartPolicy,omitempty"`
SchedulerName string `json:"schedulerName,omitempty"`
ServiceAccount string `json:"serviceAccount,omitempty"`
ServiceAccountName string `json:"serviceAccountName,omitempty"`
TerminationGracePeriodSeconds int `json:"terminationGracePeriodSeconds,omitempty"`
Tolerations []struct {
Effect string `json:"effect,omitempty"`
Key string `json:"key,omitempty"`
Operator string `json:"operator,omitempty"`
TolerationSeconds int `json:"tolerationSeconds,omitempty"`
} `json:"tolerations,omitempty"`
}
type TcpApiHandler ¶
type TcpApiHandler struct {
// contains filtered or unexported fields
}
func NewTcpApiHandler ¶
func NewTcpApiHandler(cfg dbconfig.TcpApiConfig, uuid, token string, np *jww.Notepad) *TcpApiHandler
func (*TcpApiHandler) Close ¶
func (t *TcpApiHandler) Close()
func (*TcpApiHandler) Connect ¶
func (t *TcpApiHandler) Connect() (result TcpApiResult, err error)
func (*TcpApiHandler) Receive ¶
func (t *TcpApiHandler) Receive() (result TcpApiResult, err error)
type TcpApiResult ¶
type TcpApiResult map[string]interface{}
func (*TcpApiResult) CheckHttpStatus ¶
func (t *TcpApiResult) CheckHttpStatus() error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.