service

package
v0.0.0-...-0bef3e3 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 66 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

This section is empty.

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 (impl *ApplicationServiceServerImpl) GetAppDetail(ctxt context.Context, req *client.AppDetailRequest) (*client.AppDetail, error)

func (*ApplicationServiceServerImpl) GetAppStatus

func (impl *ApplicationServiceServerImpl) GetAppStatus(ctx context.Context, req *client.AppDetailRequest) (*client.AppStatus, error)

func (*ApplicationServiceServerImpl) GetDeploymentDetail

func (impl *ApplicationServiceServerImpl) GetDeploymentDetail(ctx context.Context, in *client.DeploymentDetailRequest) (*client.DeploymentDetailResponse, error)

func (*ApplicationServiceServerImpl) GetDeploymentHistory

func (impl *ApplicationServiceServerImpl) GetDeploymentHistory(ctxt context.Context, in *client.AppDetailRequest) (*client.HelmAppDeploymentHistory, error)

func (*ApplicationServiceServerImpl) GetDesiredManifest

func (impl *ApplicationServiceServerImpl) GetDesiredManifest(ctx context.Context, in *client.ObjectRequest) (*client.DesiredManifestResponse, error)

func (*ApplicationServiceServerImpl) GetNotes

func (impl *ApplicationServiceServerImpl) GetNotes(ctx context.Context, installReleaseRequest *client.InstallReleaseRequest) (*client.ChartNotesResponse, error)

func (*ApplicationServiceServerImpl) GetResourceTreeForExternalResources

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

func (*ApplicationServiceServerImpl) GetValuesYaml

func (impl *ApplicationServiceServerImpl) GetValuesYaml(ctx context.Context, in *client.AppDetailRequest) (*client.ReleaseInfo, error)

func (*ApplicationServiceServerImpl) Hibernate

func (impl *ApplicationServiceServerImpl) Hibernate(ctx context.Context, in *client.HibernateRequest) (*client.HibernateResponse, error)

func (*ApplicationServiceServerImpl) InstallRelease

func (impl *ApplicationServiceServerImpl) InstallRelease(ctx context.Context, in *client.InstallReleaseRequest) (*client.InstallReleaseResponse, error)

func (*ApplicationServiceServerImpl) InstallReleaseWithCustomChart

func (impl *ApplicationServiceServerImpl) InstallReleaseWithCustomChart(ctx context.Context, req *client.HelmInstallCustomRequest) (*client.HelmInstallCustomResponse, error)

func (*ApplicationServiceServerImpl) IsReleaseInstalled

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

func (*ApplicationServiceServerImpl) ListApplications

func (impl *ApplicationServiceServerImpl) ListApplications(req *client.AppListRequest, res client.ApplicationService_ListApplicationsServer) error

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 (impl *ApplicationServiceServerImpl) ResourceTreeAdapter(req *bean.ResourceTreeResponse) *client.ResourceTreeResponse

func (*ApplicationServiceServerImpl) RollbackRelease

func (impl *ApplicationServiceServerImpl) RollbackRelease(ctx context.Context, in *client.RollbackReleaseRequest) (*client.BooleanResponse, error)

func (*ApplicationServiceServerImpl) TemplateChart

func (impl *ApplicationServiceServerImpl) TemplateChart(ctx context.Context, in *client.InstallReleaseRequest) (*client.TemplateChartResponse, error)

func (*ApplicationServiceServerImpl) UnHibernate

func (impl *ApplicationServiceServerImpl) UnHibernate(ctx context.Context, in *client.HibernateRequest) (*client.HibernateResponse, error)

func (*ApplicationServiceServerImpl) UninstallRelease

func (impl *ApplicationServiceServerImpl) UninstallRelease(ctx context.Context, in *client.ReleaseIdentifier) (*client.UninstallReleaseResponse, error)

func (*ApplicationServiceServerImpl) UpgradeRelease

func (impl *ApplicationServiceServerImpl) UpgradeRelease(ctx context.Context, in *client.UpgradeReleaseRequest) (*client.UpgradeReleaseResponse, error)

func (*ApplicationServiceServerImpl) UpgradeReleaseWithChartInfo

func (impl *ApplicationServiceServerImpl) UpgradeReleaseWithChartInfo(ctx context.Context, in *client.InstallReleaseRequest) (*client.UpgradeReleaseResponse, error)

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) (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)
	// ExtractCredentialsForRegistry Takes client.RegistryCredential and extracts credentials for the provided registry details
	ExtractCredentialsForRegistry(registryCredential *client.RegistryCredential) (string, string, error)
	// OCIRegistryLogin Takes client.OCIRegistryRequest and helm client, Performs registry login for the given client session and return err if fails
	OCIRegistryLogin(client *registry.Client, registryCredential *client.RegistryCredential) 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 *HelmReleaseConfig,
	k8sUtil k8sUtils.K8sService, converter converter.ClusterBeanConverter,
	clusterRepository repository.ClusterRepository) *HelmAppServiceImpl

func (HelmAppServiceImpl) BuildAppDetail

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

func (HelmAppServiceImpl) CleanDir

func (impl HelmAppServiceImpl) CleanDir(dir string)

func (HelmAppServiceImpl) ExtractCredentialsForRegistry

func (impl HelmAppServiceImpl) ExtractCredentialsForRegistry(registryCredential *client.RegistryCredential) (string, string, error)

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) GetOCIChartName

func (impl HelmAppServiceImpl) GetOCIChartName(registryUrl, repoName string) string

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) OCIRegistryLogin

func (impl HelmAppServiceImpl) OCIRegistryLogin(client *registry.Client, registryCredential *client.RegistryCredential) 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) (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 HelmReleaseConfig

type HelmReleaseConfig struct {
	EnableHelmReleaseCache    bool   `env:"ENABLE_HELM_RELEASE_CACHE" envDefault:"true"`
	MaxCountForHelmRelease    int    `env:"MAX_COUNT_FOR_HELM_RELEASE" envDefault:"20"`
	ManifestFetchBatchSize    int    `env:"MANIFEST_FETCH_BATCH_SIZE" envDefault:"2"`
	RunHelmInstallInAsyncMode bool   `env:"RUN_HELM_INSTALL_IN_ASYNC_MODE" envDefault:"false"`
	ParentChildGvkMapping     string `env:"PARENT_CHILD_GVK_MAPPING" envDefault:""`
}

func GetHelmReleaseConfig

func GetHelmReleaseConfig() (*HelmReleaseConfig, 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 *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

type Resource

type Resource struct {
	UidToResourceRefMapping map[string]*bean.ResourceRef
}

Jump to

Keyboard shortcuts

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