Documentation
¶
Index ¶
- Variables
- func AppIcon(config string) string
- func AppTitle(config string) string
- func ApplyAppEnv(ctx context.Context, c client.Client, appConfig *appcfg.ApplicationConfig) (*sysv1alpha1.AppEnv, error)
- func BuildPrevPortsMap(prevConfig *appcfg.ApplicationConfig) map[string]int32
- func CheckAppEnvs(ctx context.Context, ctrlClient client.Client, envs []sysv1alpha1.AppEnvVar, ...) (*api.AppEnvCheckResult, error)
- func CheckAppK8sRequestResource(appConfig *appcfg.ApplicationConfig, op v1alpha1.OpType) (constants.ResourceType, constants.ResourceConditionType, error)
- func CheckAppRequirement(token string, appConfig *appcfg.ApplicationConfig, op v1alpha1.OpType) (constants.ResourceType, constants.ResourceConditionType, error)
- func CheckCfgFileVersion(version, constraint string) error
- func CheckChartSource(source api.AppSource) error
- func CheckCloneEntrances(ctrlClient client.Client, appConfig *appcfg.ApplicationConfig, ...) (*api.AppEntranceCheckResult, error)
- func CheckConflicts(ctx context.Context, conflicts []appcfg.Conflict, owner string) error
- func CheckDependencies(ctx context.Context, ctrlClient client.Client, deps []appcfg.Dependency, ...) ([]appcfg.Dependency, error)
- func CheckDependencies2(ctx context.Context, ctrlClient client.Client, deps []appcfg.Dependency, ...) error
- func CheckMiddlewareRequirement(ctx context.Context, ctrlClient client.Client, middleware *tapr.Middleware) (bool, error)
- func CheckNamespace(ns string) error
- func CheckTailScaleACLs(acls []appcfg.ACL) error
- func CheckUserResRequirement(ctx context.Context, appConfig *appcfg.ApplicationConfig, op v1alpha1.OpType) (constants.ResourceType, constants.ResourceConditionType, error)
- func CheckUserRole(appConfig *appcfg.ApplicationConfig, owner string) error
- func CreateSysAppMgr(app, owner string) error
- func FmtAppMgrName(app, owner, ns string) (string, error)
- func FormatAppEnvName(appName, appowner string) string
- func FormatCacheDirs(dirs []string) []string
- func FormatDependencyError(deps []appcfg.Dependency) error
- func GetAppConfig(ctx context.Context, options *ConfigOptions) (*appcfg.ApplicationConfig, string, error)
- func GetAppConfigVersion(ctx context.Context, options *ConfigOptions) (appcfg.APIVersion, error)
- func GetAppID(name string) string
- func GetAppMgrStatus(name string) (*v1alpha1.ApplicationManagerStatus, error)
- func GetClusterAvailableResource() (*resources, error)
- func GetClusterResource(token string) (*prometheus.ClusterMetrics, []string, error)
- func GetDeployedReleaseVersion(actionConfig *action.Configuration, appName string) (string, int, error)
- func GetFirstSubDir(fullPath, basePath string) string
- func GetIndexAndDownloadChart(ctx context.Context, options *ConfigOptions) (string, error)
- func GetPendingOrRunningTask(ctx context.Context) (ams []v1alpha1.ApplicationManager, err error)
- func GetRawAppName(AppName, rawAppName string) string
- func GetRequestResources() (map[string]resources, error)
- func IsClonedApp(appName, rawAppName string) bool
- func IsForbidNamespace(namespace string) bool
- func IsProtectedNamespace(namespace string) bool
- func ResolveAppMgrName(ctx context.Context, app, owner string) (name string, isShared bool, err error)
- func SetExposePorts(ctx context.Context, appConfig *appcfg.ApplicationConfig, ...) error
- func SharedAppMgrName(app string) string
- func SharedAppNamespace(app string) string
- func TryConnect(host string, port string) bool
- func TryToGetAppdataDirFromDeployment(ctx context.Context, namespace, name, owner string, appData bool) (appCacheDirs []string, appDataDirs []string, err error)
- func UpdateAppMgrState(ctx context.Context, name string, state v1alpha1.ApplicationManagerState) error
- func UpdateAppMgrStatus(name string, status v1alpha1.ApplicationManagerStatus, ...) (*v1alpha1.ApplicationManager, error)
- func UpdateAppState(ctx context.Context, am *v1alpha1.ApplicationManager, state string) error
- func UpdateStatus(appMgr *appcfg.ApplicationManager, state appcfg.ApplicationManagerState, ...) error
- type ConfigOptions
- type HardwareUnmetReason
- type Metadata
- type MetricLabelSet
- type Metrics
- type OlaresAppProviderPermissionHelper
- type ProviderHelper
- type ProviderPermissionHelper
- type ProviderPermissionsConvertor
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidAction = errors.New("invalid action") ErrInvalidPortFormat = errors.New("invalid port format") )
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
var ErrAppNotFoundInChartRepo = errors.New("app not found in chart repo")
var ErrProviderNotFound = errors.New("provider not found")
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 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 CheckAppK8sRequestResource ¶
func CheckAppK8sRequestResource(appConfig *appcfg.ApplicationConfig, op v1alpha1.OpType) (constants.ResourceType, constants.ResourceConditionType, error)
func CheckAppRequirement ¶
func CheckAppRequirement(token string, appConfig *appcfg.ApplicationConfig, op v1alpha1.OpType) (constants.ResourceType, constants.ResourceConditionType, error)
CheckAppRequirement check if the cluster has enough resources for application install/upgrade.
func CheckCfgFileVersion ¶
func CheckChartSource ¶
func CheckCloneEntrances ¶
func CheckCloneEntrances(ctrlClient client.Client, appConfig *appcfg.ApplicationConfig, insReq *api.InstallRequest) (*api.AppEntranceCheckResult, error)
func CheckConflicts ¶
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 CheckNamespace ¶
func CheckTailScaleACLs ¶
func CheckUserResRequirement ¶
func CheckUserResRequirement(ctx context.Context, appConfig *appcfg.ApplicationConfig, op v1alpha1.OpType) (constants.ResourceType, constants.ResourceConditionType, error)
CheckUserResRequirement check if the user has enough resources for application install/upgrade.
func CheckUserRole ¶
func CheckUserRole(appConfig *appcfg.ApplicationConfig, owner string) error
func CreateSysAppMgr ¶
CreateSysAppMgr create an applicationmanager for the system application.
func FmtAppMgrName ¶
FmtAppMgrName returns applicationmanager name for application.
func FormatAppEnvName ¶
func FormatCacheDirs ¶
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 ¶
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 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 GetRequestResources ¶
func IsClonedApp ¶
func IsForbidNamespace ¶
func IsProtectedNamespace ¶
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 ¶
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 ¶
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 ¶
TryConnect try to connect to a service with specified host and port.
func UpdateAppMgrState ¶
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 ¶
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 ¶
HardwareUnmetReason describes one unmet hardware condition.
type Metadata ¶
type Metadata struct {
Data []kubesphere.Metadata `json:"data" description:"actual array of results"`
}
type MetricLabelSet ¶
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 ¶
func (*ProviderHelper) GetEntrance ¶
type ProviderPermissionHelper ¶
type ProviderPermissionHelper appcfg.ProviderPermission
func (ProviderPermissionHelper) GetPermissionCfg ¶
func (h ProviderPermissionHelper) GetPermissionCfg(ctx context.Context, appCfg *appcfg.ApplicationConfig) (*appcfg.PermissionCfg, error)
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)