app

package
v0.0.0-...-ca9f2bf Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: AGPL-3.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidAction     = errors.New("invalid action")
	ErrInvalidPortFormat = errors.New("invalid port format")
)
View Source
var ACLProto = sets.NewString("", "igmp", "ipv4", "ip-in-ip", "tcp", "egp", "igp", "udp", "gre", "esp", "ah", "sctp", "icmp")

ACLProto If the ACL proto field is empty, it allows ICMPv4, ICMPv6, TCP, and UDP as per Tailscale behaviour

View Source
var ErrAppNotFoundInChartRepo = errors.New("app not found in chart repo")
View Source
var ErrProviderNotFound = errors.New("provider not found")
View Source
var StateTransitionGuard func(from, to v1alpha1.ApplicationManagerState) bool

StateTransitionGuard, if non-nil, is consulted by UpdateAppMgrStatus to decide whether a (currentState -> requestedState) transition is allowed. Returning false rejects the patch.

It is injected at init time by the pkg/appstate package (which owns the authoritative transition table). The indirection breaks an import cycle: pkg/appstate already imports pkg/utils/app, so pkg/utils/app cannot import pkg/appstate directly. When the guard is nil (e.g. in unit tests that do not link pkg/appstate) the legacy behaviour is preserved — any transition is accepted.

Functions

func AppIcon

func AppIcon(config string) string

func AppTitle

func AppTitle(config string) string

func ApplyAppEnv

func ApplyAppEnv(ctx context.Context, c client.Client, appConfig *appcfg.ApplicationConfig) (*sysv1alpha1.AppEnv, error)

ApplyAppEnv applies the environment variable configuration of the app: if no existing AppEnv is found for the app, the AppEnv is created if existing AppEnv is found for the app, any new configured env is added to the AppEnv

func BuildPrevPortsMap

func BuildPrevPortsMap(prevConfig *appcfg.ApplicationConfig) map[string]int32

BuildPrevPortsMap builds a map of port name -> expose port from previous config.

func CheckAppEnvs

func CheckAppEnvs(ctx context.Context, ctrlClient client.Client, envs []sysv1alpha1.AppEnvVar, owner string) (*api.AppEnvCheckResult, error)

func CheckAppRequirement

CheckAppRequirement check if the cluster has enough resources for application install/upgrade.

func CheckCfgFileVersion

func CheckCfgFileVersion(version, constraint string) error

func CheckChartSource

func CheckChartSource(source api.AppSource) error

func CheckCloneEntrances

func CheckCloneEntrances(ctrlClient client.Client, appConfig *appcfg.ApplicationConfig, insReq *api.InstallRequest) (*api.AppEntranceCheckResult, error)

func CheckConflicts

func CheckConflicts(ctx context.Context, conflicts []appcfg.Conflict, owner string) error

func CheckDependencies

func CheckDependencies(ctx context.Context, ctrlClient client.Client, deps []appcfg.Dependency, owner string, checkAll bool) ([]appcfg.Dependency, error)

CheckDependencies check application dependencies, returns unsatisfied dependency.

func CheckDependencies2

func CheckDependencies2(ctx context.Context, ctrlClient client.Client, deps []appcfg.Dependency, owner string, checkAll bool) error

func CheckMiddlewareRequirement

func CheckMiddlewareRequirement(ctx context.Context, ctrlClient client.Client, middleware *tapr.Middleware) (bool, error)

func CheckNamespace

func CheckNamespace(ns string) error

func CheckTailScaleACLs

func CheckTailScaleACLs(acls []appcfg.ACL) error

func CheckUserResRequirement

CheckUserResRequirement check if the user has enough resources for application install/upgrade.

func CheckUserRole

func CheckUserRole(appConfig *appcfg.ApplicationConfig, owner string) error

func CreateSysAppMgr

func CreateSysAppMgr(app, owner string) error

CreateSysAppMgr create an applicationmanager for the system application.

func FmtAppMgrName

func FmtAppMgrName(app, owner, ns string) (string, error)

FmtAppMgrName returns applicationmanager name for application.

func FormatAppEnvName

func FormatAppEnvName(appName, appowner string) string

func FormatCacheDirs

func FormatCacheDirs(dirs []string) []string

func FormatDependencyError

func FormatDependencyError(deps []appcfg.Dependency) error

func GetAppConfig

func GetAppConfig(ctx context.Context, options *ConfigOptions) (*appcfg.ApplicationConfig, string, error)

GetAppConfig get app installation configuration from app store

func GetAppConfigVersion

func GetAppConfigVersion(ctx context.Context, options *ConfigOptions) (appcfg.APIVersion, error)

func GetAppID

func GetAppID(name string) string

GetAppID returns appID for an application. for system app appID equals name, otherwise appID equals md5(name)[:8].

func GetAppMgrStatus

func GetAppMgrStatus(name string) (*v1alpha1.ApplicationManagerStatus, error)

GetAppMgrStatus returns status of an applicationmanager.

func GetClusterAvailableResource

func GetClusterAvailableResource() (*resources, error)

func GetClusterResource

func GetClusterResource(token string) (*prometheus.ClusterMetrics, []string, error)

GetClusterResource returns cluster resource metrics and cluster arches.

func GetDeployedReleaseVersion

func GetDeployedReleaseVersion(actionConfig *action.Configuration, appName string) (string, int, error)

GetDeployedReleaseVersion check whether app has been deployed and return release chart version

func GetFirstSubDir

func GetFirstSubDir(fullPath, basePath string) string

func GetIndexAndDownloadChart

func GetIndexAndDownloadChart(ctx context.Context, options *ConfigOptions) (string, error)

GetIndexAndDownloadChart download a chart and returns download chart path.

func GetPendingOrRunningTask

func GetPendingOrRunningTask(ctx context.Context) (ams []v1alpha1.ApplicationManager, err error)

GetPendingOrRunningTask returns pending and running state applicationmanager.

func GetRawAppName

func GetRawAppName(AppName, rawAppName string) string

func GetRequestResources

func GetRequestResources() (map[string]resources, error)

func IsClonedApp

func IsClonedApp(appName, rawAppName string) bool

func IsForbidNamespace

func IsForbidNamespace(namespace string) bool

func IsProtectedNamespace

func IsProtectedNamespace(namespace string) bool

func ResolveAppMgrName

func ResolveAppMgrName(ctx context.Context, app, owner string) (name string, isShared bool, err error)

ResolveAppMgrName returns the ApplicationManager name for the given app:

  • if a shared AM exists at SharedAppMgrName(app), return that name and isShared=true.
  • otherwise fall back to FmtAppMgrName(app, owner, "") and isShared=false. This covers both v1 apps and v3+per-user apps, both of which use the per-user "{app}-{owner}-{app}" name format.

Lifecycle handlers should call this first so any admin can target a shared app regardless of who originally installed it. Install does NOT need this helper — install creates the AM, it doesn't look it up.

func SetExposePorts

func SetExposePorts(ctx context.Context, appConfig *appcfg.ApplicationConfig, prevPortsMap map[string]int32) error

SetExposePorts sets expose ports for app config.

func SharedAppMgrName

func SharedAppMgrName(app string) string

SharedAppMgrName returns the deterministic ApplicationManager name for a shared app: '{app}-shared-{app}', following the same '{ns}-{app}' rule FmtAppMgrName uses for v1/v2.

func SharedAppNamespace

func SharedAppNamespace(app string) string

SharedAppNamespace returns the deterministic namespace used for a shared app. Single source of truth so install handlers, lookups and the proxy all agree on the same value.

func TryConnect

func TryConnect(host string, port string) bool

TryConnect try to connect to a service with specified host and port.

func TryToGetAppdataDirFromDeployment

func TryToGetAppdataDirFromDeployment(ctx context.Context, namespace, name, owner string, appData bool) (appCacheDirs []string, appDataDirs []string, err error)

func UpdateAppMgrState

func UpdateAppMgrState(ctx context.Context, name string, state v1alpha1.ApplicationManagerState) error

func UpdateAppMgrStatus

func UpdateAppMgrStatus(name string, status v1alpha1.ApplicationManagerStatus, modifiers ...func(*v1alpha1.ApplicationManager)) (*v1alpha1.ApplicationManager, error)

UpdateAppMgrStatus update applicationmanager status, if filed in parameter status is empty that field will not be set.

func UpdateAppState

func UpdateAppState(ctx context.Context, am *v1alpha1.ApplicationManager, state string) error

UpdateAppState update application status state.

func UpdateStatus

func UpdateStatus(appMgr *appcfg.ApplicationManager, state appcfg.ApplicationManagerState,
	opRecord *appcfg.OpRecord, message string) error

UpdateStatus update application state and applicationmanager state.

Types

type ConfigOptions

type ConfigOptions struct {
	App          string
	RepoURL      string
	Owner        string
	Version      string
	Token        string
	Admin        string
	MarketSource string
	IsAdmin      bool
	RawAppName   string
	SelectedGpu  string
	// NeedDownloadChart controls whether GetIndexAndDownloadChart should be
	// invoked to fetch the chart from the repo. When false (the default), the
	// download step is skipped and the chart is assumed to be already present
	// at the conventional local path (appcfg.ChartsPath + "/" + RawAppName).
	NeedDownloadChart bool
	// for v3 app, upload source need to find origin chart
	ChartOwner string
}

type HardwareUnmetReason

type HardwareUnmetReason struct {
	Type   string `json:"type"`
	Reason string `json:"reason"`
}

HardwareUnmetReason describes one unmet hardware condition.

type Metadata

type Metadata struct {
	Data []kubesphere.Metadata `json:"data" description:"actual array of results"`
}

type MetricLabelSet

type MetricLabelSet struct {
	Data []map[string]string `json:"data" description:"actual array of results"`
}

type Metrics

type Metrics struct {
	Results     []kubesphere.Metric `json:"results" description:"actual array of results"`
	CurrentPage int                 `json:"page,omitempty" description:"current page returned"`
	TotalPages  int                 `json:"total_page,omitempty" description:"total number of pages"`
	TotalItems  int                 `json:"total_item,omitempty" description:"page size"`
}

type OlaresAppProviderPermissionHelper

type OlaresAppProviderPermissionHelper appcfg.ProviderPermission

func (OlaresAppProviderPermissionHelper) GetPermissionCfg

func (c OlaresAppProviderPermissionHelper) GetPermissionCfg(ctx context.Context, kubeClient *clientset.ClientSet, owner string) (cfg *appcfg.PermissionCfg, err error)

type ProviderHelper

type ProviderHelper struct {
	appcfg.Provider
	// contains filtered or unexported fields
}

func (*ProviderHelper) GetEntrance

func (p *ProviderHelper) GetEntrance(ctx context.Context) (*v1alpha1.Entrance, error)

type ProviderPermissionHelper

type ProviderPermissionHelper appcfg.ProviderPermission

func (ProviderPermissionHelper) GetPermissionCfg

type ProviderPermissionsConvertor

type ProviderPermissionsConvertor []appcfg.ProviderPermission

func (ProviderPermissionsConvertor) ToPermissionCfg

func (c ProviderPermissionsConvertor) ToPermissionCfg(ctx context.Context, owner string, marksetSrouce string) (cfg []appcfg.PermissionCfg, err error)

Jump to

Keyboard shortcuts

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