k8s

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClientErrorMessage added in v0.7.2

func GetClientErrorMessage(err error) string

func IsBadRequestErr added in v0.7.2

func IsBadRequestErr(err error) bool

func IsResourceNotFoundErr added in v0.6.29

func IsResourceNotFoundErr(err error) bool

func IsServerTimeoutErr added in v0.7.2

func IsServerTimeoutErr(err error) bool

func NewCmCsRequestBean added in v0.7.2

func NewCmCsRequestBean(clusterId int, namespace string) *bean.CmCsRequestBean

func ParseK8sClientErrorToApiError added in v0.7.2

func ParseK8sClientErrorToApiError(err error) *util.ApiError

func StripPrereleaseFromK8sVersion added in v0.7.0

func StripPrereleaseFromK8sVersion(k8sVersion string) string

StripPrereleaseFromK8sVersion takes in k8sVersion and stripe pre-release from semver version and return sanitized k8sVersion or error if invalid version provided, e.g. if k8sVersion = "1.25.16-eks-b9c9ed7", then it returns "1.25.16".

Types

type K8sApplicationServiceConfig

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

type K8sCommonService

type K8sCommonService interface {
	GetResource(ctx context.Context, request *bean5.ResourceRequestBean) (resp *bean5.ResourceGetResponse, err error)
	GetDataFromConfigMaps(ctx context.Context, request *bean5.CmCsRequestBean) (map[string]*apiV1.ConfigMap, error)
	GetDataFromSecrets(ctx context.Context, request *bean5.CmCsRequestBean) (map[string]*apiV1.Secret, error)
	UpdateResource(ctx context.Context, request *bean5.ResourceRequestBean) (resp *k8s.ManifestResponse, err error)
	DeleteResource(ctx context.Context, request *bean5.ResourceRequestBean) (resp *k8s.ManifestResponse, err error)
	ListEvents(ctx context.Context, request *bean5.ResourceRequestBean) (*k8s.EventsResponse, error)
	GetRestConfigByClusterId(ctx context.Context, clusterId int) (*rest.Config, error, *bean2.ClusterBean)
	GetManifestsByBatch(ctx context.Context, request []bean5.ResourceRequestBean) ([]bean5.BatchResourceResponse, error)
	FilterK8sResources(ctx context.Context, resourceTreeInf map[string]interface{}, appDetail AppView.AppDetailContainer, appId string, kindsToBeFiltered []string, externalArgoAppName string) []bean5.ResourceRequestBean
	RotatePods(ctx context.Context, request *bean5.RotatePodRequest) (*bean5.RotatePodResponse, error)
	GetCoreClientByClusterId(clusterId int) (*kubernetes.Clientset, *clientV1.CoreV1Client, error)
	GetCoreClientByClusterIdForExternalArgoApps(req *bean4.EphemeralContainerRequest) (*kubernetes.Clientset, *clientV1.CoreV1Client, error)
	GetK8sServerVersion(clusterId int) (*version.Info, error)
	PortNumberExtraction(resp []bean5.BatchResourceResponse, resourceTree map[string]interface{}) map[string]interface{}
	GetRestConfigOfCluster(ctx context.Context, request *bean5.ResourceRequestBean) (*rest.Config, error)
	GetK8sConfigAndClients(ctx context.Context, cluster *bean2.ClusterBean) (*rest.Config, *http.Client, *kubernetes.Clientset, error)
	GetK8sConfigAndClientsByClusterId(ctx context.Context, clusterId int) (*rest.Config, *http.Client, *kubernetes.Clientset, error)
	GetPreferredVersionForAPIGroup(ctx context.Context, clusterId int, groupName string) (string, error)
}

type K8sCommonServiceImpl

type K8sCommonServiceImpl struct {
	K8sUtil                     *k8s.K8sServiceImpl
	K8sApplicationServiceConfig *K8sApplicationServiceConfig

	ClusterReadService read.ClusterReadService
	// contains filtered or unexported fields
}

func NewK8sCommonServiceImpl

func NewK8sCommonServiceImpl(Logger *zap.SugaredLogger, k8sUtils *k8s.K8sServiceImpl,
	argoApplicationConfigService config.ArgoApplicationConfigService,
	ClusterReadService read.ClusterReadService) *K8sCommonServiceImpl

func (*K8sCommonServiceImpl) DeleteResource

func (impl *K8sCommonServiceImpl) DeleteResource(ctx context.Context, request *bean5.ResourceRequestBean) (*k8s.ManifestResponse, error)

func (*K8sCommonServiceImpl) FilterK8sResources

func (impl *K8sCommonServiceImpl) FilterK8sResources(ctx context.Context, resourceTree map[string]interface{}, appDetail AppView.AppDetailContainer, appId string, kindsToBeFiltered []string, externalArgoAppName string) []bean5.ResourceRequestBean

func (*K8sCommonServiceImpl) GetCoreClientByClusterId

func (impl *K8sCommonServiceImpl) GetCoreClientByClusterId(clusterId int) (*kubernetes.Clientset, *clientV1.CoreV1Client, error)

func (*K8sCommonServiceImpl) GetCoreClientByClusterIdForExternalArgoApps added in v0.6.29

func (impl *K8sCommonServiceImpl) GetCoreClientByClusterIdForExternalArgoApps(req *bean4.EphemeralContainerRequest) (*kubernetes.Clientset, *clientV1.CoreV1Client, error)

func (*K8sCommonServiceImpl) GetDataFromConfigMaps added in v0.7.2

func (impl *K8sCommonServiceImpl) GetDataFromConfigMaps(ctx context.Context, request *bean5.CmCsRequestBean) (map[string]*apiV1.ConfigMap, error)

func (*K8sCommonServiceImpl) GetDataFromSecrets added in v0.7.2

func (impl *K8sCommonServiceImpl) GetDataFromSecrets(ctx context.Context, request *bean5.CmCsRequestBean) (map[string]*apiV1.Secret, error)

func (*K8sCommonServiceImpl) GetK8sConfigAndClients added in v0.7.2

func (impl *K8sCommonServiceImpl) GetK8sConfigAndClients(ctx context.Context, cluster *bean2.ClusterBean) (*rest.Config, *http.Client, *kubernetes.Clientset, error)

func (*K8sCommonServiceImpl) GetK8sConfigAndClientsByClusterId added in v0.7.2

func (impl *K8sCommonServiceImpl) GetK8sConfigAndClientsByClusterId(ctx context.Context, clusterId int) (*rest.Config, *http.Client, *kubernetes.Clientset, error)

func (*K8sCommonServiceImpl) GetK8sServerVersion

func (impl *K8sCommonServiceImpl) GetK8sServerVersion(clusterId int) (*version.Info, error)

func (*K8sCommonServiceImpl) GetManifestsByBatch

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

func (*K8sCommonServiceImpl) GetPreferredVersionForAPIGroup added in v0.7.2

func (impl *K8sCommonServiceImpl) GetPreferredVersionForAPIGroup(ctx context.Context, clusterId int, groupName string) (string, error)

func (*K8sCommonServiceImpl) GetResource

func (*K8sCommonServiceImpl) GetRestConfigByClusterId

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

func (*K8sCommonServiceImpl) GetRestConfigOfCluster added in v0.7.2

func (impl *K8sCommonServiceImpl) GetRestConfigOfCluster(ctx context.Context, request *bean5.ResourceRequestBean) (*rest.Config, error)

func (*K8sCommonServiceImpl) ListEvents

func (*K8sCommonServiceImpl) PortNumberExtraction added in v0.6.23

func (impl *K8sCommonServiceImpl) PortNumberExtraction(resp []bean5.BatchResourceResponse, resourceTree map[string]interface{}) map[string]interface{}

func (*K8sCommonServiceImpl) RotatePods

func (*K8sCommonServiceImpl) UpdateResource

func (impl *K8sCommonServiceImpl) UpdateResource(ctx context.Context, request *bean5.ResourceRequestBean) (*k8s.ManifestResponse, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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