k8s

package
v0.6.17 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Kibibyte = 1024
	Mebibyte = 1024 * 1024
	Gibibyte = 1024 * 1024 * 1024

	Megabyte = 1000 * 1000
	Gigabyte = 1000 * 1000 * 1000
)
View Source
const (
	AWSNodeGroupLabel    = "alpha.eksctl.io/nodegroup-name"
	AzureNodeGroupLabel  = "kubernetes.azure.com/agentpool"
	GcpNodeGroupLabel    = "cloud.google.com/gke-nodepool"
	KopsNodeGroupLabel   = "kops.k8s.io/instancegroup"
	AWSEKSNodeGroupLabel = "eks.amazonaws.com/nodegroup"
)

below const set is used for pod filters

View Source
const (
	// PodDeleteStatusTypeOkay is "Okay"
	PodDeleteStatusTypeOkay = "Okay"
	// PodDeleteStatusTypeSkip is "Skip"
	PodDeleteStatusTypeSkip = "Skip"
	// PodDeleteStatusTypeWarning is "Warning"
	PodDeleteStatusTypeWarning = "Warning"
	// PodDeleteStatusTypeError is "Error"
	PodDeleteStatusTypeError = "Error"
)

below const set is used for pod delete status

View Source
const (
	// EvictionKind represents the kind of evictions object
	EvictionKind = "Eviction"
	// EvictionSubresource represents the kind of evictions object as pod's subresource
	EvictionSubresource = "pods/eviction"
)
View Source
const (
	DEFAULT_CLUSTER = "default_cluster"
)
View Source
const DEFAULT_NAMESPACE = "default"
View Source
const EVENT_K8S_KIND = "Event"
View Source
const LIST_VERB = "list"

Variables

TODO: add any new nodeGrouplabel in this array

Functions

func AddTwoResourceList added in v0.4.24

func AddTwoResourceList(oldResourceList corev1.ResourceList, newResourceList corev1.ResourceList) corev1.ResourceList

func CheckEvictionSupport added in v0.6.10

func CheckEvictionSupport(clientset kubernetes.Interface) (schema.GroupVersion, error)

CheckEvictionSupport uses Discovery API to find out if the server support eviction subresource If support, it will return its groupVersion; Otherwise, it will return an empty GroupVersion

func DeletePod added in v0.6.10

func DeletePod(pod corev1.Pod, k8sClientSet *kubernetes.Clientset, deleteOptions v1.DeleteOptions) error

DeletePod will delete the given pod, or return an error if it couldn't

func EvictPod added in v0.6.10

func EvictPod(pod corev1.Pod, k8sClientSet *kubernetes.Clientset, evictionGroupVersion schema.GroupVersion, deleteOptions v1.DeleteOptions) error

EvictPod will evict the given pod, or return an error if it couldn't

func GetAndUpdateConnectionStatusForOneCluster added in v0.4.24

func GetAndUpdateConnectionStatusForOneCluster(k8sClientSet *kubernetes.Clientset, clusterId int, respMap map[int]error, wg *sync.WaitGroup, mutex *sync.Mutex)

Types

type BatchResourceResponse added in v0.6.4

type BatchResourceResponse struct {
	ManifestResponse *application.ManifestResponse
	Err              error
}

type ClusterCapacityDetail added in v0.4.24

type ClusterCapacityDetail struct {
	Id                int                                   `json:"id,omitempty"`
	Name              string                                `json:"name,omitempty"`
	ErrorInConnection string                                `json:"errorInNodeListing,omitempty"`
	NodeCount         int                                   `json:"nodeCount,omitempty"`
	NodeDetails       []NodeNameGroupName                   `json:"nodeDetails"`
	NodeErrors        map[corev1.NodeConditionType][]string `json:"nodeErrors"`
	NodeK8sVersions   []string                              `json:"nodeK8sVersions"`
	ServerVersion     string                                `json:"serverVersion,omitempty"`
	Cpu               *ResourceDetailObject                 `json:"cpu"`
	Memory            *ResourceDetailObject                 `json:"memory"`
	IsVirtualCluster  bool                                  `json:"isVirtualCluster"`
}

type ClusterCronService added in v0.4.24

type ClusterCronService interface {
}

type ClusterCronServiceImpl added in v0.4.24

type ClusterCronServiceImpl struct {
	// contains filtered or unexported fields
}

func NewClusterCronServiceImpl added in v0.4.24

func NewClusterCronServiceImpl(logger *zap.SugaredLogger, clusterService cluster.ClusterService,
	k8sApplicationService K8sApplicationService, clusterRepository clusterRepository.ClusterRepository) (*ClusterCronServiceImpl, error)

func (*ClusterCronServiceImpl) GetAndUpdateClusterConnectionStatus added in v0.4.24

func (impl *ClusterCronServiceImpl) GetAndUpdateClusterConnectionStatus()

func (*ClusterCronServiceImpl) HandleErrorInClusterConnections added in v0.4.24

func (impl *ClusterCronServiceImpl) HandleErrorInClusterConnections(respMap map[int]error)

type ClusterStatusConfig added in v0.6.9

type ClusterStatusConfig struct {
	ClusterStatusCronTime int `env:"CLUSTER_STATUS_CRON_TIME" envDefault:"15"`
}

type K8sApplicationRestHandler

type K8sApplicationRestHandler interface {
	GetResource(w http.ResponseWriter, r *http.Request)
	CreateResource(w http.ResponseWriter, r *http.Request)
	UpdateResource(w http.ResponseWriter, r *http.Request)
	DeleteResource(w http.ResponseWriter, r *http.Request)
	ListEvents(w http.ResponseWriter, r *http.Request)
	GetPodLogs(w http.ResponseWriter, r *http.Request)
	GetTerminalSession(w http.ResponseWriter, r *http.Request)
	GetResourceInfo(w http.ResponseWriter, r *http.Request)
	GetHostUrlsByBatch(w http.ResponseWriter, r *http.Request)
	GetAllApiResources(w http.ResponseWriter, r *http.Request)
	GetResourceList(w http.ResponseWriter, r *http.Request)
	ApplyResources(w http.ResponseWriter, r *http.Request)
	RotatePod(w http.ResponseWriter, r *http.Request)
}

type K8sApplicationRestHandlerImpl

type K8sApplicationRestHandlerImpl struct {
	// contains filtered or unexported fields
}

func NewK8sApplicationRestHandlerImpl

func NewK8sApplicationRestHandlerImpl(logger *zap.SugaredLogger,
	k8sApplicationService K8sApplicationService, pump connector.Pump,
	terminalSessionHandler terminal.TerminalSessionHandler,
	enforcer casbin.Enforcer, enforcerUtilHelm rbac.EnforcerUtilHelm, enforcerUtil rbac.EnforcerUtil,
	helmAppService client.HelmAppService, userService user.UserService) *K8sApplicationRestHandlerImpl

func (*K8sApplicationRestHandlerImpl) ApplyResources added in v0.6.11

func (handler *K8sApplicationRestHandlerImpl) ApplyResources(w http.ResponseWriter, r *http.Request)

func (*K8sApplicationRestHandlerImpl) CreateResource

func (handler *K8sApplicationRestHandlerImpl) CreateResource(w http.ResponseWriter, r *http.Request)

func (*K8sApplicationRestHandlerImpl) DeleteResource

func (handler *K8sApplicationRestHandlerImpl) DeleteResource(w http.ResponseWriter, r *http.Request)

func (*K8sApplicationRestHandlerImpl) GetAllApiResources added in v0.6.11

func (handler *K8sApplicationRestHandlerImpl) GetAllApiResources(w http.ResponseWriter, r *http.Request)

func (*K8sApplicationRestHandlerImpl) GetHostUrlsByBatch added in v0.6.4

func (handler *K8sApplicationRestHandlerImpl) GetHostUrlsByBatch(w http.ResponseWriter, r *http.Request)

func (*K8sApplicationRestHandlerImpl) GetPodLogs

func (handler *K8sApplicationRestHandlerImpl) GetPodLogs(w http.ResponseWriter, r *http.Request)

func (*K8sApplicationRestHandlerImpl) GetResource

func (handler *K8sApplicationRestHandlerImpl) GetResource(w http.ResponseWriter, r *http.Request)

func (*K8sApplicationRestHandlerImpl) GetResourceInfo added in v0.4.0

func (handler *K8sApplicationRestHandlerImpl) GetResourceInfo(w http.ResponseWriter, r *http.Request)

func (*K8sApplicationRestHandlerImpl) GetResourceList added in v0.6.11

func (handler *K8sApplicationRestHandlerImpl) GetResourceList(w http.ResponseWriter, r *http.Request)

func (*K8sApplicationRestHandlerImpl) GetTerminalSession

func (handler *K8sApplicationRestHandlerImpl) GetTerminalSession(w http.ResponseWriter, r *http.Request)

func (*K8sApplicationRestHandlerImpl) ListEvents

func (handler *K8sApplicationRestHandlerImpl) ListEvents(w http.ResponseWriter, r *http.Request)

func (*K8sApplicationRestHandlerImpl) RotatePod added in v0.6.17

func (handler *K8sApplicationRestHandlerImpl) RotatePod(w http.ResponseWriter, r *http.Request)

func (*K8sApplicationRestHandlerImpl) UpdateResource

func (handler *K8sApplicationRestHandlerImpl) UpdateResource(w http.ResponseWriter, r *http.Request)

type K8sApplicationRouter

type K8sApplicationRouter interface {
	InitK8sApplicationRouter(helmRouter *mux.Router)
}

type K8sApplicationRouterImpl

type K8sApplicationRouterImpl struct {
	// contains filtered or unexported fields
}

func NewK8sApplicationRouterImpl

func NewK8sApplicationRouterImpl(k8sApplicationRestHandler K8sApplicationRestHandler) *K8sApplicationRouterImpl

func (*K8sApplicationRouterImpl) InitK8sApplicationRouter

func (impl *K8sApplicationRouterImpl) InitK8sApplicationRouter(k8sAppRouter *mux.Router)

type K8sApplicationService

type K8sApplicationService interface {
	GetResource(ctx context.Context, request *ResourceRequestBean) (resp *application.ManifestResponse, err error)
	CreateResource(ctx context.Context, request *ResourceRequestBean) (resp *application.ManifestResponse, err error)
	UpdateResource(ctx context.Context, request *ResourceRequestBean) (resp *application.ManifestResponse, err error)
	DeleteResource(ctx context.Context, request *ResourceRequestBean, userId int32) (resp *application.ManifestResponse, err error)
	ListEvents(ctx context.Context, request *ResourceRequestBean) (*application.EventsResponse, error)
	GetPodLogs(ctx context.Context, request *ResourceRequestBean) (io.ReadCloser, error)
	ValidateResourceRequest(ctx context.Context, appIdentifier *client.AppIdentifier, request *application.K8sRequestBean) (bool, error)
	ValidateClusterResourceRequest(ctx context.Context, clusterResourceRequest *ResourceRequestBean,
		rbacCallback func(clusterName string, resourceIdentifier application.ResourceIdentifier) bool) (bool, error)
	ValidateClusterResourceBean(ctx context.Context, clusterId int, manifest unstructured.Unstructured, gvk schema.GroupVersionKind, rbacCallback func(clusterName string, resourceIdentifier application.ResourceIdentifier) bool) bool
	GetResourceInfo(ctx context.Context) (*ResourceInfo, error)
	GetRestConfigByClusterId(ctx context.Context, clusterId int) (*rest.Config, error)
	GetRestConfigByCluster(ctx context.Context, cluster *cluster.ClusterBean) (*rest.Config, error)
	GetManifestsByBatch(ctx context.Context, request []ResourceRequestBean) ([]BatchResourceResponse, error)
	FilterServiceAndIngress(ctx context.Context, resourceTreeInf map[string]interface{}, validRequests []ResourceRequestBean, appDetail bean.AppDetailContainer, appId string) []ResourceRequestBean
	GetUrlsByBatch(ctx context.Context, resp []BatchResourceResponse) []interface{}
	GetAllApiResources(ctx context.Context, clusterId int, isSuperAdmin bool, userId int32) (*application.GetAllApiResourcesResponse, error)
	GetResourceList(ctx context.Context, token string, request *ResourceRequestBean, validateResourceAccess func(token string, clusterName string, request ResourceRequestBean, casbinAction string) bool) (*util.ClusterResourceListMap, error)
	ApplyResources(ctx context.Context, token string, request *application.ApplyResourcesRequest, resourceRbacHandler func(token string, clusterName string, request ResourceRequestBean, casbinAction string) bool) ([]*application.ApplyResourcesResponse, error)
	RotatePods(ctx context.Context, request *RotatePodRequest) (*RotatePodResponse, error)
}

type K8sApplicationServiceConfig added in v0.6.4

type K8sApplicationServiceConfig struct {
	BatchSize        int `env:"BATCH_SIZE" envDefault:"5"`
	TimeOutInSeconds int `env:"TIMEOUT_IN_SECONDS" envDefault:"5"`
}

type K8sApplicationServiceImpl

type K8sApplicationServiceImpl struct {
	K8sUtil *util.K8sUtil

	K8sApplicationServiceConfig *K8sApplicationServiceConfig
	K8sResourceHistoryService   kubernetesResourceAuditLogs.K8sResourceHistoryService
	// contains filtered or unexported fields
}

func NewK8sApplicationServiceImpl

func NewK8sApplicationServiceImpl(Logger *zap.SugaredLogger,
	clusterService cluster.ClusterService,
	pump connector.Pump, k8sClientService application.K8sClientService,
	helmAppService client.HelmAppService, K8sUtil *util.K8sUtil, aCDAuthConfig *util3.ACDAuthConfig,
	K8sResourceHistoryService kubernetesResourceAuditLogs.K8sResourceHistoryService) *K8sApplicationServiceImpl

func (*K8sApplicationServiceImpl) ApplyResources added in v0.6.11

func (impl *K8sApplicationServiceImpl) ApplyResources(ctx context.Context, token string, request *application.ApplyResourcesRequest, validateResourceAccess func(token string, clusterName string, request ResourceRequestBean, casbinAction string) bool) ([]*application.ApplyResourcesResponse, error)

func (*K8sApplicationServiceImpl) CreateResource

func (*K8sApplicationServiceImpl) DeleteResource

func (impl *K8sApplicationServiceImpl) DeleteResource(ctx context.Context, request *ResourceRequestBean, userId int32) (*application.ManifestResponse, error)

func (*K8sApplicationServiceImpl) FilterServiceAndIngress added in v0.6.4

func (impl *K8sApplicationServiceImpl) FilterServiceAndIngress(ctx context.Context, resourceTree map[string]interface{}, validRequests []ResourceRequestBean, appDetail bean.AppDetailContainer, appId string) []ResourceRequestBean

func (*K8sApplicationServiceImpl) GetAllApiResources added in v0.6.11

func (impl *K8sApplicationServiceImpl) GetAllApiResources(ctx context.Context, clusterId int, isSuperAdmin bool, userId int32) (*application.GetAllApiResourcesResponse, error)

func (*K8sApplicationServiceImpl) GetManifestsByBatch added in v0.6.4

func (impl *K8sApplicationServiceImpl) GetManifestsByBatch(ctx context.Context, requests []ResourceRequestBean) ([]BatchResourceResponse, error)

func (*K8sApplicationServiceImpl) GetPodLogs

func (impl *K8sApplicationServiceImpl) GetPodLogs(ctx context.Context, request *ResourceRequestBean) (io.ReadCloser, error)

func (*K8sApplicationServiceImpl) GetResource

func (*K8sApplicationServiceImpl) GetResourceInfo added in v0.4.0

func (impl *K8sApplicationServiceImpl) GetResourceInfo(ctx context.Context) (*ResourceInfo, error)

func (*K8sApplicationServiceImpl) GetResourceList added in v0.6.11

func (impl *K8sApplicationServiceImpl) GetResourceList(ctx context.Context, token string, request *ResourceRequestBean, validateResourceAccess func(token string, clusterName string, request ResourceRequestBean, casbinAction string) bool) (*util.ClusterResourceListMap, error)

func (*K8sApplicationServiceImpl) GetRestConfigByCluster added in v0.4.24

func (impl *K8sApplicationServiceImpl) GetRestConfigByCluster(ctx context.Context, cluster *cluster.ClusterBean) (*rest.Config, error)

func (*K8sApplicationServiceImpl) GetRestConfigByClusterId added in v0.4.24

func (impl *K8sApplicationServiceImpl) GetRestConfigByClusterId(ctx context.Context, clusterId int) (*rest.Config, error)

func (*K8sApplicationServiceImpl) GetUrlsByBatch added in v0.6.4

func (impl *K8sApplicationServiceImpl) GetUrlsByBatch(ctx context.Context, resp []BatchResourceResponse) []interface{}

func (*K8sApplicationServiceImpl) ListEvents

func (*K8sApplicationServiceImpl) RotatePods added in v0.6.17

func (*K8sApplicationServiceImpl) UpdateResource

func (*K8sApplicationServiceImpl) ValidateClusterResourceBean added in v0.6.13

func (impl *K8sApplicationServiceImpl) ValidateClusterResourceBean(ctx context.Context, clusterId int, manifest unstructured.Unstructured, gvk schema.GroupVersionKind, rbacCallback func(clusterName string, resourceIdentifier application.ResourceIdentifier) bool) bool

func (*K8sApplicationServiceImpl) ValidateClusterResourceRequest added in v0.6.13

func (impl *K8sApplicationServiceImpl) ValidateClusterResourceRequest(ctx context.Context, clusterResourceRequest *ResourceRequestBean,
	rbacCallback func(clusterName string, resourceIdentifier application.ResourceIdentifier) bool) (bool, error)

func (*K8sApplicationServiceImpl) ValidateResourceRequest

func (impl *K8sApplicationServiceImpl) ValidateResourceRequest(ctx context.Context, appIdentifier *client.AppIdentifier, request *application.K8sRequestBean) (bool, error)

type K8sCapacityRestHandler added in v0.4.24

type K8sCapacityRestHandler interface {
	GetClusterListRaw(w http.ResponseWriter, r *http.Request)
	GetClusterListWithDetail(w http.ResponseWriter, r *http.Request)
	GetClusterDetail(w http.ResponseWriter, r *http.Request)
	GetNodeList(w http.ResponseWriter, r *http.Request)
	GetNodeDetail(w http.ResponseWriter, r *http.Request)
	UpdateNodeManifest(w http.ResponseWriter, r *http.Request)
	DeleteNode(w http.ResponseWriter, r *http.Request)
	CordonOrUnCordonNode(w http.ResponseWriter, r *http.Request)
	DrainNode(w http.ResponseWriter, r *http.Request)
	EditNodeTaints(w http.ResponseWriter, r *http.Request)
}

type K8sCapacityRestHandlerImpl added in v0.4.24

type K8sCapacityRestHandlerImpl struct {
	// contains filtered or unexported fields
}

func NewK8sCapacityRestHandlerImpl added in v0.4.24

func NewK8sCapacityRestHandlerImpl(logger *zap.SugaredLogger,
	k8sCapacityService K8sCapacityService, userService user.UserService,
	enforcer casbin.Enforcer,
	clusterService cluster.ClusterService,
	environmentService cluster.EnvironmentService) *K8sCapacityRestHandlerImpl

func (*K8sCapacityRestHandlerImpl) CheckRbacForCluster added in v0.4.24

func (handler *K8sCapacityRestHandlerImpl) CheckRbacForCluster(cluster *cluster.ClusterBean, token string) (authenticated bool, err error)

func (*K8sCapacityRestHandlerImpl) CordonOrUnCordonNode added in v0.6.10

func (handler *K8sCapacityRestHandlerImpl) CordonOrUnCordonNode(w http.ResponseWriter, r *http.Request)

func (*K8sCapacityRestHandlerImpl) DeleteNode added in v0.6.10

func (handler *K8sCapacityRestHandlerImpl) DeleteNode(w http.ResponseWriter, r *http.Request)

func (*K8sCapacityRestHandlerImpl) DrainNode added in v0.6.10

func (handler *K8sCapacityRestHandlerImpl) DrainNode(w http.ResponseWriter, r *http.Request)

func (*K8sCapacityRestHandlerImpl) EditNodeTaints added in v0.6.10

func (handler *K8sCapacityRestHandlerImpl) EditNodeTaints(w http.ResponseWriter, r *http.Request)

func (*K8sCapacityRestHandlerImpl) GetClusterDetail added in v0.4.24

func (handler *K8sCapacityRestHandlerImpl) GetClusterDetail(w http.ResponseWriter, r *http.Request)

func (*K8sCapacityRestHandlerImpl) GetClusterListRaw added in v0.6.17

func (handler *K8sCapacityRestHandlerImpl) GetClusterListRaw(w http.ResponseWriter, r *http.Request)

func (*K8sCapacityRestHandlerImpl) GetClusterListWithDetail added in v0.6.17

func (handler *K8sCapacityRestHandlerImpl) GetClusterListWithDetail(w http.ResponseWriter, r *http.Request)

func (*K8sCapacityRestHandlerImpl) GetNodeDetail added in v0.4.24

func (handler *K8sCapacityRestHandlerImpl) GetNodeDetail(w http.ResponseWriter, r *http.Request)

func (*K8sCapacityRestHandlerImpl) GetNodeList added in v0.4.24

func (handler *K8sCapacityRestHandlerImpl) GetNodeList(w http.ResponseWriter, r *http.Request)

func (*K8sCapacityRestHandlerImpl) UpdateNodeManifest added in v0.4.24

func (handler *K8sCapacityRestHandlerImpl) UpdateNodeManifest(w http.ResponseWriter, r *http.Request)

type K8sCapacityRouter added in v0.4.24

type K8sCapacityRouter interface {
	InitK8sCapacityRouter(helmRouter *mux.Router)
}

type K8sCapacityRouterImpl added in v0.4.24

type K8sCapacityRouterImpl struct {
	// contains filtered or unexported fields
}

func NewK8sCapacityRouterImpl added in v0.4.24

func NewK8sCapacityRouterImpl(k8sCapacityRestHandler K8sCapacityRestHandler) *K8sCapacityRouterImpl

func (*K8sCapacityRouterImpl) InitK8sCapacityRouter added in v0.4.24

func (impl *K8sCapacityRouterImpl) InitK8sCapacityRouter(k8sCapacityRouter *mux.Router)

type K8sCapacityService added in v0.4.24

type K8sCapacityService interface {
	GetClusterCapacityDetailList(ctx context.Context, clusters []*cluster.ClusterBean) ([]*ClusterCapacityDetail, error)
	GetClusterCapacityDetail(ctx context.Context, cluster *cluster.ClusterBean, callForList bool) (*ClusterCapacityDetail, error)
	GetNodeCapacityDetailsListByCluster(ctx context.Context, cluster *cluster.ClusterBean) ([]*NodeCapacityDetail, error)
	GetNodeCapacityDetailByNameAndCluster(ctx context.Context, cluster *cluster.ClusterBean, name string) (*NodeCapacityDetail, error)
	UpdateNodeManifest(ctx context.Context, request *NodeUpdateRequestDto) (*application.ManifestResponse, error)
	DeleteNode(ctx context.Context, request *NodeUpdateRequestDto) (*application.ManifestResponse, error)
	CordonOrUnCordonNode(ctx context.Context, request *NodeUpdateRequestDto) (string, error)
	DrainNode(ctx context.Context, request *NodeUpdateRequestDto) (string, error)
	EditNodeTaints(ctx context.Context, request *NodeUpdateRequestDto) (string, error)
}

type K8sCapacityServiceImpl added in v0.4.24

type K8sCapacityServiceImpl struct {
	// contains filtered or unexported fields
}

func NewK8sCapacityServiceImpl added in v0.4.24

func NewK8sCapacityServiceImpl(Logger *zap.SugaredLogger,
	clusterService cluster.ClusterService,
	k8sApplicationService K8sApplicationService,
	k8sClientService application.K8sClientService,
	clusterCronService ClusterCronService) *K8sCapacityServiceImpl

func (*K8sCapacityServiceImpl) CordonOrUnCordonNode added in v0.6.10

func (impl *K8sCapacityServiceImpl) CordonOrUnCordonNode(ctx context.Context, request *NodeUpdateRequestDto) (string, error)

func (*K8sCapacityServiceImpl) DeleteNode added in v0.6.10

func (*K8sCapacityServiceImpl) DrainNode added in v0.6.10

func (impl *K8sCapacityServiceImpl) DrainNode(ctx context.Context, request *NodeUpdateRequestDto) (string, error)

func (*K8sCapacityServiceImpl) EditNodeTaints added in v0.6.10

func (impl *K8sCapacityServiceImpl) EditNodeTaints(ctx context.Context, request *NodeUpdateRequestDto) (string, error)

func (*K8sCapacityServiceImpl) GetClusterCapacityDetail added in v0.4.24

func (impl *K8sCapacityServiceImpl) GetClusterCapacityDetail(ctx context.Context, cluster *cluster.ClusterBean, callForList bool) (*ClusterCapacityDetail, error)

func (*K8sCapacityServiceImpl) GetClusterCapacityDetailList added in v0.4.24

func (impl *K8sCapacityServiceImpl) GetClusterCapacityDetailList(ctx context.Context, clusters []*cluster.ClusterBean) ([]*ClusterCapacityDetail, error)

func (*K8sCapacityServiceImpl) GetNodeCapacityDetailByNameAndCluster added in v0.4.24

func (impl *K8sCapacityServiceImpl) GetNodeCapacityDetailByNameAndCluster(ctx context.Context, cluster *cluster.ClusterBean, name string) (*NodeCapacityDetail, error)

func (*K8sCapacityServiceImpl) GetNodeCapacityDetailsListByCluster added in v0.4.24

func (impl *K8sCapacityServiceImpl) GetNodeCapacityDetailsListByCluster(ctx context.Context, cluster *cluster.ClusterBean) ([]*NodeCapacityDetail, error)

func (*K8sCapacityServiceImpl) UpdateNodeManifest added in v0.4.24

func (impl *K8sCapacityServiceImpl) UpdateNodeManifest(ctx context.Context, request *NodeUpdateRequestDto) (*application.ManifestResponse, error)

type LabelAnnotationTaintObject added in v0.4.24

type LabelAnnotationTaintObject struct {
	Key    string `json:"key"`
	Value  string `json:"value"`
	Effect string `json:"effect,omitempty"`
}

type NodeCapacityDetail added in v0.4.24

type NodeCapacityDetail struct {
	Name          string                              `json:"name"`
	Version       string                              `json:"version,omitempty"`
	Kind          string                              `json:"kind,omitempty"`
	Roles         []string                            `json:"roles"`
	K8sVersion    string                              `json:"k8sVersion"`
	Cpu           *ResourceDetailObject               `json:"cpu,omitempty"`
	Memory        *ResourceDetailObject               `json:"memory,omitempty"`
	Age           string                              `json:"age,omitempty"`
	Status        string                              `json:"status,omitempty"`
	PodCount      int                                 `json:"podCount,omitempty"`
	Errors        map[corev1.NodeConditionType]string `json:"errors"`
	InternalIp    string                              `json:"internalIp"`
	ExternalIp    string                              `json:"externalIp"`
	Unschedulable bool                                `json:"unschedulable"`
	CreatedAt     string                              `json:"createdAt"`
	Labels        []*LabelAnnotationTaintObject       `json:"labels,omitempty"`
	Annotations   []*LabelAnnotationTaintObject       `json:"annotations,omitempty"`
	Taints        []*LabelAnnotationTaintObject       `json:"taints,omitempty"`
	Conditions    []*NodeConditionObject              `json:"conditions,omitempty"`
	Resources     []*ResourceDetailObject             `json:"resources,omitempty"`
	Pods          []*PodCapacityDetail                `json:"pods,omitempty"`
	Manifest      unstructured.Unstructured           `json:"manifest,omitempty"`
	ClusterName   string                              `json:"clusterName,omitempty"`
	NodeGroup     string                              `json:"nodeGroup"`
}

type NodeConditionObject added in v0.4.24

type NodeConditionObject struct {
	Type      string `json:"type"`
	HaveIssue bool   `json:"haveIssue"`
	Reason    string `json:"reason"`
	Message   string `json:"message"`
}

type NodeCordonHelper added in v0.6.10

type NodeCordonHelper struct {
	UnschedulableDesired bool `json:"unschedulableDesired"`
}

type NodeDrainHelper added in v0.6.10

type NodeDrainHelper struct {
	Force              bool `json:"force"`
	DeleteEmptyDirData bool `json:"deleteEmptyDirData"`
	// GracePeriodSeconds is how long to wait for a pod to terminate.
	// IMPORTANT: 0 means "delete immediately"; set to a negative value
	// to use the pod's terminationGracePeriodSeconds.
	GracePeriodSeconds  int  `json:"gracePeriodSeconds"`
	IgnoreAllDaemonSets bool `json:"ignoreAllDaemonSets"`
	// DisableEviction forces drain to use delete rather than evict
	DisableEviction bool `json:"disableEviction"`
	// contains filtered or unexported fields
}

type NodeNameGroupName added in v0.6.15

type NodeNameGroupName struct {
	NodeName  string `json:"nodeName"`
	NodeGroup string `json:"nodeGroup"`
}

type NodeUpdateRequestDto added in v0.6.10

type NodeUpdateRequestDto struct {
	ClusterId        int               `json:"clusterId"`
	Name             string            `json:"name"`
	ManifestPatch    string            `json:"manifestPatch"`
	Version          string            `json:"version"`
	Kind             string            `json:"kind"`
	Taints           []corev1.Taint    `json:"taints"`
	NodeCordonHelper *NodeCordonHelper `json:"nodeCordonOptions"`
	NodeDrainHelper  *NodeDrainHelper  `json:"nodeDrainOptions"`
}

type PodCapacityDetail added in v0.4.24

type PodCapacityDetail struct {
	Name      string                `json:"name"`
	Namespace string                `json:"namespace"`
	Cpu       *ResourceDetailObject `json:"cpu"`
	Memory    *ResourceDetailObject `json:"memory"`
	Age       string                `json:"age"`
	CreatedAt string                `json:"createdAt"`
}

type PodDelete added in v0.6.10

type PodDelete struct {
	Pod    corev1.Pod
	Status PodDeleteStatus
}

PodDelete informs filtering logic whether a pod should be deleted or not

type PodDeleteList added in v0.6.10

type PodDeleteList struct {
	// contains filtered or unexported fields
}

PodDeleteList is a wrapper around []PodDelete

func (*PodDeleteList) Pods added in v0.6.10

func (l *PodDeleteList) Pods() []corev1.Pod

Pods returns a list of all pods marked for deletion after filtering.

type PodDeleteStatus added in v0.6.10

type PodDeleteStatus struct {
	Delete  bool
	Reason  string
	Message string
}

PodDeleteStatus informs filters if a pod should be deleted

func MakePodDeleteStatusOkay added in v0.6.10

func MakePodDeleteStatusOkay() PodDeleteStatus

MakePodDeleteStatusOkay is a helper method to return the corresponding PodDeleteStatus

func MakePodDeleteStatusSkip added in v0.6.10

func MakePodDeleteStatusSkip() PodDeleteStatus

MakePodDeleteStatusSkip is a helper method to return the corresponding PodDeleteStatus

func MakePodDeleteStatusWithError added in v0.6.10

func MakePodDeleteStatusWithError(message string) PodDeleteStatus

MakePodDeleteStatusWithError is a helper method to return the corresponding PodDeleteStatus

func MakePodDeleteStatusWithWarning added in v0.6.10

func MakePodDeleteStatusWithWarning(delete bool, message string) PodDeleteStatus

MakePodDeleteStatusWithWarning is a helper method to return the corresponding PodDeleteStatus

type PodFilter added in v0.6.10

type PodFilter func(corev1.Pod) PodDeleteStatus

PodFilter takes a pod and returns a PodDeleteStatus

type ResourceDetailObject added in v0.4.24

type ResourceDetailObject struct {
	ResourceName      string `json:"name,omitempty"`
	Capacity          string `json:"capacity,omitempty"`
	Allocatable       string `json:"allocatable,omitempty"`
	Usage             string `json:"usage,omitempty"`
	Request           string `json:"request,omitempty"`
	Limit             string `json:"limit,omitempty"`
	UsagePercentage   string `json:"usagePercentage,omitempty"`
	RequestPercentage string `json:"requestPercentage,omitempty"`
	LimitPercentage   string `json:"limitPercentage,omitempty"`
	//below fields to be used at FE for sorting
	CapacityInBytes    int64 `json:"capacityInBytes,omitempty"`
	AllocatableInBytes int64 `json:"allocatableInBytes,omitempty"`
	UsageInBytes       int64 `json:"usageInBytes,omitempty"`
	RequestInBytes     int64 `json:"requestInBytes,omitempty"`
	LimitInBytes       int64 `json:"limitInBytes,omitempty"`
}

type ResourceInfo added in v0.4.0

type ResourceInfo struct {
	PodName string `json:"podName"`
}

type ResourceRequestBean

type ResourceRequestBean struct {
	AppId         string                      `json:"appId"`
	AppIdentifier *client.AppIdentifier       `json:"-"`
	K8sRequest    *application.K8sRequestBean `json:"k8sRequest"`
	ClusterId     int                         `json:"clusterId"` // clusterId is used when request is for direct cluster (not for helm release)
}

type Response added in v0.6.4

type Response struct {
	Kind     string   `json:"kind"`
	Name     string   `json:"name"`
	PointsTo string   `json:"pointsTo"`
	Urls     []string `json:"urls"`
}

type RotatePodRequest added in v0.6.17

type RotatePodRequest struct {
	ClusterId int                              `json:"clusterId"`
	Resources []application.ResourceIdentifier `json:"resources"`
}

type RotatePodResourceResponse added in v0.6.17

type RotatePodResourceResponse struct {
	application.ResourceIdentifier
	ErrorResponse string `json:"errorResponse"`
}

type RotatePodResponse added in v0.6.17

type RotatePodResponse struct {
	Responses     []*RotatePodResourceResponse `json:"responses"`
	ContainsError bool                         `json:"containsError"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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