service

package
v0.0.0-...-de0da82 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 63 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReadmeFileName                        = "README.md"
	REGISTRY_TYPE_ECR                     = "ecr"
	REGISTRYTYPE_GCR                      = "gcr"
	REGISTRYTYPE_ARTIFACT_REGISTRY        = "artifact-registry"
	JSON_KEY_USERNAME              string = "_json_key"
	HELM_CLIENT_ERROR                     = "Error in creating Helm client"
	RELEASE_INSTALLED                     = "Release Installed"
)

Variables

This section is empty.

Functions

func ConvertConfigToProxyConfig

func ConvertConfigToProxyConfig(config *client.RemoteConnectionConfig) *bean.ProxyConfig

func ConvertConfigToSSHTunnelConfig

func ConvertConfigToSSHTunnelConfig(config *client.RemoteConnectionConfig) *bean.SSHTunnelConfig

func NewDeployedAppDetail

func NewDeployedAppDetail(config *client.ClusterConfig, release *release.Release) *client.DeployedAppDetail

func NewRegistryConfig

func NewRegistryConfig(credential *client.RegistryCredential) (*registry.Configuration, error)

func TrimSchemeFromURL

func TrimSchemeFromURL(registryUrl string) string

Types

type ApplicationServiceServerImpl

type ApplicationServiceServerImpl struct {
	client.UnimplementedApplicationServiceServer
	Logger                *zap.SugaredLogger
	ChartRepositoryLocker *lock.ChartRepositoryLocker
	HelmAppService        HelmAppService
}

func NewApplicationServiceServerImpl

func NewApplicationServiceServerImpl(logger *zap.SugaredLogger, chartRepositoryLocker *lock.ChartRepositoryLocker,
	HelmAppService HelmAppService) *ApplicationServiceServerImpl

func (*ApplicationServiceServerImpl) AppDetailAdaptor

func (impl *ApplicationServiceServerImpl) AppDetailAdaptor(req *bean.AppDetail) *client.AppDetail

func (*ApplicationServiceServerImpl) GetAppDetail

func (*ApplicationServiceServerImpl) GetAppStatus

func (*ApplicationServiceServerImpl) GetDeploymentDetail

func (*ApplicationServiceServerImpl) GetDeploymentHistory

func (*ApplicationServiceServerImpl) GetDesiredManifest

func (*ApplicationServiceServerImpl) GetNotes

func (*ApplicationServiceServerImpl) GetResourceTreeForExternalResources

func (impl *ApplicationServiceServerImpl) GetResourceTreeForExternalResources(ctx context.Context, req *client.ExternalResourceTreeRequest) (*client.ResourceTreeResponse, error)

func (*ApplicationServiceServerImpl) GetValuesYaml

func (*ApplicationServiceServerImpl) Hibernate

func (*ApplicationServiceServerImpl) InstallRelease

func (*ApplicationServiceServerImpl) InstallReleaseWithCustomChart

func (*ApplicationServiceServerImpl) IsReleaseInstalled

func (impl *ApplicationServiceServerImpl) IsReleaseInstalled(ctx context.Context, releaseIdentifier *client.ReleaseIdentifier) (*client.BooleanResponse, error)

func (*ApplicationServiceServerImpl) ListApplications

func (*ApplicationServiceServerImpl) MustEmbedUnimplementedApplicationServiceServer

func (impl *ApplicationServiceServerImpl) MustEmbedUnimplementedApplicationServiceServer()

func (*ApplicationServiceServerImpl) PushHelmChartToOCIRegistry

func (impl *ApplicationServiceServerImpl) PushHelmChartToOCIRegistry(ctx context.Context, OCIRegistryRequest *client.OCIRegistryRequest) (*client.OCIRegistryResponse, error)

func (*ApplicationServiceServerImpl) ResourceTreeAdapter

func (*ApplicationServiceServerImpl) RollbackRelease

func (*ApplicationServiceServerImpl) TemplateChart

func (*ApplicationServiceServerImpl) TemplateChartAndRetrieveChart

func (*ApplicationServiceServerImpl) TemplateChartBulk

func (*ApplicationServiceServerImpl) UnHibernate

func (*ApplicationServiceServerImpl) UninstallRelease

func (*ApplicationServiceServerImpl) UpgradeRelease

func (*ApplicationServiceServerImpl) UpgradeReleaseWithChartInfo

func (*ApplicationServiceServerImpl) UpgradeReleaseWithCustomChart

func (impl *ApplicationServiceServerImpl) UpgradeReleaseWithCustomChart(ctx context.Context, request *client.UpgradeReleaseRequest) (*client.UpgradeReleaseResponse, error)

func (*ApplicationServiceServerImpl) ValidateOCIRegistry

func (impl *ApplicationServiceServerImpl) ValidateOCIRegistry(ctx context.Context, OCIRegistryRequest *client.RegistryCredential) (*client.OCIRegistryResponse, error)

type ChildObjects

type ChildObjects struct {
	Group    string             `json:"group"`
	Version  string             `json:"version"`
	Resource string             `json:"resource"`
	Scope    meta.RESTScopeName `json:"scope"`
}

func (ChildObjects) GetGvrAndScopeForChildObject

func (r ChildObjects) GetGvrAndScopeForChildObject() *commonBean.GvrAndScope

type ClusterConfig

type ClusterConfig struct {
	Host        string
	BearerToken string
}

type HelmAppService

type HelmAppService interface {
	GetApplicationListForCluster(config *client.ClusterConfig) *client.DeployedAppList
	BuildAppDetail(req *client.AppDetailRequest) (*bean.AppDetail, error)
	FetchApplicationStatus(req *client.AppDetailRequest) (*client.AppStatus, error)
	GetHelmAppValues(req *client.AppDetailRequest) (*client.ReleaseInfo, error)
	ScaleObjects(ctx context.Context, clusterConfig *client.ClusterConfig, requests []*client.ObjectIdentifier, scaleDown bool) (*client.HibernateResponse, error)
	GetDeploymentHistory(req *client.AppDetailRequest) (*client.HelmAppDeploymentHistory, error)
	GetDesiredManifest(req *client.ObjectRequest) (*client.DesiredManifestResponse, error)
	UninstallRelease(releaseIdentifier *client.ReleaseIdentifier) (*client.UninstallReleaseResponse, error)
	UpgradeRelease(ctx context.Context, request *client.UpgradeReleaseRequest) (*client.UpgradeReleaseResponse, error)
	GetDeploymentDetail(request *client.DeploymentDetailRequest) (*client.DeploymentDetailResponse, error)
	InstallRelease(ctx context.Context, request *client.InstallReleaseRequest) (*client.InstallReleaseResponse, error)
	UpgradeReleaseWithChartInfo(ctx context.Context, request *client.InstallReleaseRequest) (*client.UpgradeReleaseResponse, error)
	IsReleaseInstalled(ctx context.Context, releaseIdentifier *client.ReleaseIdentifier) (bool, error)
	RollbackRelease(request *client.RollbackReleaseRequest) (bool, error)
	TemplateChart(ctx context.Context, request *client.InstallReleaseRequest, getChart bool) (string, []byte, error)
	TemplateChartBulk(ctx context.Context, request []*client.InstallReleaseRequest) (map[string]string, error)
	InstallReleaseWithCustomChart(ctx context.Context, req *client.HelmInstallCustomRequest) (bool, error)
	GetNotes(ctx context.Context, installReleaseRequest *client.InstallReleaseRequest) (string, error)
	UpgradeReleaseWithCustomChart(ctx context.Context, request *client.UpgradeReleaseRequest) (bool, error)
	// ValidateOCIRegistryLogin Validates the OCI registry credentials by login
	ValidateOCIRegistryLogin(ctx context.Context, OCIRegistryRequest *client.RegistryCredential) (*client.OCIRegistryResponse, error)
	// PushHelmChartToOCIRegistryRepo Pushes the helm chart to the OCI registry and returns the generated digest and pushedUrl
	PushHelmChartToOCIRegistryRepo(ctx context.Context, OCIRegistryRequest *client.OCIRegistryRequest) (*client.OCIRegistryResponse, error)
	GetResourceTreeForExternalResources(req *client.ExternalResourceTreeRequest) (*bean.ResourceTreeResponse, error)
}

type HelmAppServiceImpl

type HelmAppServiceImpl struct {
	K8sInformer k8sInformer.K8sInformer
	// contains filtered or unexported fields
}

func NewHelmAppServiceImpl

func NewHelmAppServiceImpl(logger *zap.SugaredLogger, k8sService K8sService,
	k8sInformer k8sInformer.K8sInformer, helmReleaseConfig *globalConfig.HelmReleaseConfig,
	k8sUtil k8sUtils.K8sService, converter converter.ClusterBeanConverter,
	clusterRepository repository.ClusterRepository,
	registrySettings registry2.SettingsFactory,
) (*HelmAppServiceImpl, error)

func (*HelmAppServiceImpl) BuildAppDetail

func (impl *HelmAppServiceImpl) BuildAppDetail(req *client.AppDetailRequest) (*bean.AppDetail, error)

func (*HelmAppServiceImpl) CleanDir

func (impl *HelmAppServiceImpl) CleanDir(dir string)

func (*HelmAppServiceImpl) FetchApplicationStatus

func (impl *HelmAppServiceImpl) FetchApplicationStatus(req *client.AppDetailRequest) (*client.AppStatus, error)

func (*HelmAppServiceImpl) GetApplicationListForCluster

func (impl *HelmAppServiceImpl) GetApplicationListForCluster(config *client.ClusterConfig) *client.DeployedAppList

func (*HelmAppServiceImpl) GetDeploymentDetail

func (*HelmAppServiceImpl) GetDeploymentHistory

func (impl *HelmAppServiceImpl) GetDeploymentHistory(req *client.AppDetailRequest) (*client.HelmAppDeploymentHistory, error)

func (*HelmAppServiceImpl) GetDesiredManifest

func (impl *HelmAppServiceImpl) GetDesiredManifest(req *client.ObjectRequest) (*client.DesiredManifestResponse, error)

func (*HelmAppServiceImpl) GetHelmAppValues

func (impl *HelmAppServiceImpl) GetHelmAppValues(req *client.AppDetailRequest) (*client.ReleaseInfo, error)

func (*HelmAppServiceImpl) GetNatsMessageForHelmInstallError

func (impl *HelmAppServiceImpl) GetNatsMessageForHelmInstallError(ctx context.Context, helmInstallMessage HelmReleaseStatusConfig, releaseIdentifier *client.ReleaseIdentifier, installationErr error) (string, error)

func (*HelmAppServiceImpl) GetNatsMessageForHelmInstallSuccess

func (impl *HelmAppServiceImpl) GetNatsMessageForHelmInstallSuccess(helmInstallMessage HelmReleaseStatusConfig) (string, error)

func (*HelmAppServiceImpl) GetNotes

func (impl *HelmAppServiceImpl) GetNotes(ctx context.Context, request *client.InstallReleaseRequest) (string, error)

func (*HelmAppServiceImpl) GetRandomString

func (impl *HelmAppServiceImpl) GetRandomString() string

func (*HelmAppServiceImpl) GetResourceTreeForExternalResources

func (impl *HelmAppServiceImpl) GetResourceTreeForExternalResources(req *client.ExternalResourceTreeRequest) (*bean.ResourceTreeResponse, error)

func (*HelmAppServiceImpl) InstallRelease

func (*HelmAppServiceImpl) InstallReleaseWithCustomChart

func (impl *HelmAppServiceImpl) InstallReleaseWithCustomChart(ctx context.Context, request *client.HelmInstallCustomRequest) (bool, error)

func (*HelmAppServiceImpl) IsReleaseInstalled

func (impl *HelmAppServiceImpl) IsReleaseInstalled(ctx context.Context, releaseIdentifier *client.ReleaseIdentifier) (bool, error)

func (*HelmAppServiceImpl) PushHelmChartToOCIRegistryRepo

func (impl *HelmAppServiceImpl) PushHelmChartToOCIRegistryRepo(ctx context.Context, OCIRegistryRequest *client.OCIRegistryRequest) (*client.OCIRegistryResponse, error)

func (*HelmAppServiceImpl) RollbackRelease

func (impl *HelmAppServiceImpl) RollbackRelease(request *client.RollbackReleaseRequest) (bool, error)

func (*HelmAppServiceImpl) ScaleObjects

func (impl *HelmAppServiceImpl) ScaleObjects(ctx context.Context, clusterConfig *client.ClusterConfig, objects []*client.ObjectIdentifier, scaleDown bool) (*client.HibernateResponse, error)

func (*HelmAppServiceImpl) TemplateChart

func (impl *HelmAppServiceImpl) TemplateChart(ctx context.Context, request *client.InstallReleaseRequest, getChart bool) (string, []byte, error)

func (*HelmAppServiceImpl) TemplateChartBulk

func (impl *HelmAppServiceImpl) TemplateChartBulk(ctx context.Context, request []*client.InstallReleaseRequest) (map[string]string, error)

func (*HelmAppServiceImpl) UninstallRelease

func (impl *HelmAppServiceImpl) UninstallRelease(releaseIdentifier *client.ReleaseIdentifier) (*client.UninstallReleaseResponse, error)

func (*HelmAppServiceImpl) UpgradeRelease

func (*HelmAppServiceImpl) UpgradeReleaseWithChartInfo

func (impl *HelmAppServiceImpl) UpgradeReleaseWithChartInfo(ctx context.Context, request *client.InstallReleaseRequest) (*client.UpgradeReleaseResponse, error)

func (*HelmAppServiceImpl) UpgradeReleaseWithCustomChart

func (impl *HelmAppServiceImpl) UpgradeReleaseWithCustomChart(ctx context.Context, request *client.UpgradeReleaseRequest) (bool, error)

func (*HelmAppServiceImpl) ValidateOCIRegistryLogin

func (impl *HelmAppServiceImpl) ValidateOCIRegistryLogin(ctx context.Context, OCIRegistryRequest *client.RegistryCredential) (*client.OCIRegistryResponse, error)

type HelmReleaseStatusConfig

type HelmReleaseStatusConfig struct {
	InstallAppVersionHistoryId int
	Message                    string
	IsReleaseInstalled         bool
	ErrorInInstallation        bool
}

type K8sService

type K8sService interface {
	CanHaveChild(gvk schema.GroupVersionKind) bool
	GetLiveManifest(restConfig *rest.Config, namespace string, gvk *schema.GroupVersionKind, name string) (*unstructured.Unstructured, *schema.GroupVersionResource, error)
	GetChildObjects(restConfig *rest.Config, namespace string, parentGvk schema.GroupVersionKind, parentName string, parentApiVersion string) ([]*unstructured.Unstructured, error)
	PatchResource(ctx context.Context, restConfig *rest.Config, r *bean.KubernetesResourcePatchRequest) error
}

type K8sServiceImpl

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

func NewK8sServiceImpl

func NewK8sServiceImpl(logger *zap.SugaredLogger, helmReleaseConfig *globalConfig.HelmReleaseConfig) (*K8sServiceImpl, error)

func (K8sServiceImpl) CanHaveChild

func (impl K8sServiceImpl) CanHaveChild(gvk schema.GroupVersionKind) bool

func (K8sServiceImpl) GetChildGvrFromParentGvk

func (impl K8sServiceImpl) GetChildGvrFromParentGvk(parentGvk schema.GroupVersionKind) ([]*k8sCommonBean.GvrAndScope, bool)

func (K8sServiceImpl) GetChildObjects

func (impl K8sServiceImpl) GetChildObjects(restConfig *rest.Config, namespace string, parentGvk schema.GroupVersionKind, parentName string, parentApiVersion string) ([]*unstructured.Unstructured, error)

func (K8sServiceImpl) GetLiveManifest

func (impl K8sServiceImpl) GetLiveManifest(restConfig *rest.Config, namespace string, gvk *schema.GroupVersionKind, name string) (*unstructured.Unstructured, *schema.GroupVersionResource, error)

func (K8sServiceImpl) PatchResource

func (impl K8sServiceImpl) PatchResource(ctx context.Context, restConfig *rest.Config, r *bean.KubernetesResourcePatchRequest) error

type ParentChildGvkMapping

type ParentChildGvkMapping struct {
	Group        string         `json:"group"`
	Version      string         `json:"version"`
	Kind         string         `json:"kind"`
	ChildObjects []ChildObjects `json:"childObjects"`
}

func (ParentChildGvkMapping) GetParentGvk

Jump to

Keyboard shortcuts

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