Documentation ¶
Index ¶
- Constants
- Variables
- func ConfigMapName(appName string) string
- func FillingExtField(s *profile2.SvcProfileV2, meta *ApplicationMeta, ...)
- func GetAppNameFromConfigMapName(cmName string) string
- func GetApplicationName(secretName string) (string, error)
- func HasConfigMapPrefix(key string) bool
- func HasDevStartingSuffix(name string) bool
- type AppType
- type ApplicationDevMeta
- type ApplicationEvent
- type ApplicationMeta
- func (a *ApplicationMeta) CheckIfSvcDeveloping(name, identifier string, svcType base.SvcType, modeType profile2.DevModeType) DevStartStatus
- func (a *ApplicationMeta) Delete() error
- func (a *ApplicationMeta) DoWithTempOperator(configBytes []byte, funny func() error) error
- func (a *ApplicationMeta) GenerateNidINE() error
- func (a *ApplicationMeta) GetApplicationConfig() *profile2.ApplicationConfig
- func (a *ApplicationMeta) GetApplicationDevMeta() ApplicationDevMeta
- func (a *ApplicationMeta) GetClient() *clientgoutils.ClientGoUtils
- func (a *ApplicationMeta) GetCurrentDevModeTypeOfWorkload(workloadName string, workloadType base.SvcType, identifier string) profile2.DevModeType
- func (a *ApplicationMeta) InitGoClient(kubeConfigPath string) error
- func (a *ApplicationMeta) Initial(force bool) error
- func (a *ApplicationMeta) IsHelm() bool
- func (a *ApplicationMeta) IsInstalled() bool
- func (a *ApplicationMeta) IsInstalling() bool
- func (a *ApplicationMeta) IsNotInstall() bool
- func (a *ApplicationMeta) IsUnknown() bool
- func (a *ApplicationMeta) NewResourceReader() *clientgoutils.Resource
- func (a *ApplicationMeta) NotInstallTips() string
- func (a *ApplicationMeta) OneTimesInitial(fun func(meta *ApplicationMeta), force bool) error
- func (a *ApplicationMeta) ProtectedFromReInstall() bool
- func (a *ApplicationMeta) ReAssignmentBySecret(secret *corev1.Secret) error
- func (a *ApplicationMeta) SvcDevEnd(name, identifier string, svcType base.SvcType, modeType profile2.DevModeType) error
- func (a *ApplicationMeta) SvcDevModePossessor(name string, svcType base.SvcType, identifier string, ...) bool
- func (a *ApplicationMeta) SvcDevStartComplete(name string, svcType base.SvcType, identifier string, ...) error
- func (a *ApplicationMeta) SvcDevStarting(name string, svcType base.SvcType, identifier string, ...) error
- func (a *ApplicationMeta) Uninstall(force bool) error
- func (a *ApplicationMeta) Update() error
- type ApplicationMetaSimple
- type ApplicationMetaSimples
- type ApplicationMetas
- type ApplicationState
- type DevStartStatus
- type EVENT
Constants ¶
const ( DEV_STA EVENT = "DEV_STA" DEV_END EVENT = "DEV_END" STARTING DevStartStatus = "STARTING" STARTED DevStartStatus = "STARTED" NONE DevStartStatus = "NONE" )
const ( SecretType = "dev.nocalhost/application.meta" SecretNamePrefix = "dev.nocalhost.application." CmNamePrefix = "dev.nocalhost.config." AnnotationKey = "dev.nocalhost" CmConfigKey = "config" SecretUninstallBackOffKey = "time" SecretHelmReleaseNameKey = "r" SecretNamespaceIdKey = "nid" SecretPostInstallKey = "po" SecretPostUpgradeKey = "pou" SecretPostDeleteKey = "pod" SecretPreInstallKey = "p" SecretPreUpgradeKey = "pu" SecretPreDeleteKey = "pd" SecretManifestKey = "m" SecretDevMetaKey = "v" SecretAppTypeKey = "t" SecretConfigKey = "c" SecretStateKey = "s" SecretDepKey = "d" Helm AppType = "helmGit" HelmRepo AppType = "helmRepo" Manifest AppType = "rawManifest" ManifestGit AppType = "rawManifestGit" ManifestLocal AppType = "rawManifestLocal" HelmLocal AppType = "helmLocal" KustomizeGit AppType = "kustomizeGit" KustomizeLocal AppType = "kustomizeLocal" UNINSTALLED ApplicationState = "UNINSTALLED" INSTALLING ApplicationState = "INSTALLING" INSTALLED ApplicationState = "INSTALLED" UNKNOWN ApplicationState = "UNKNOWN" DependenceConfigMapPrefix = "nocalhost-depends-do-not-overwrite" DEV_STARTING_SUFFIX = ">...Starting" DuplicateSuffix = "-duplicate" )
Variables ¶
var ErrAlreadyDev = errors.New("Svc already in dev mode")
Functions ¶
func ConfigMapName ¶
func FillingExtField ¶
func FillingExtField(s *profile2.SvcProfileV2, meta *ApplicationMeta, appName, ns, identifier string)
func GetApplicationName ¶
resolve Application name by k8s 'metadata.name'
func HasConfigMapPrefix ¶
func HasDevStartingSuffix ¶
Types ¶
type ApplicationDevMeta ¶
func (*ApplicationDevMeta) Events ¶
func (from *ApplicationDevMeta) Events(to ApplicationDevMeta) *[]*ApplicationEvent
type ApplicationEvent ¶
type ApplicationMeta ¶
type ApplicationMeta struct { // could not be updated Application string `json:"application"` HelmReleaseName string `json:"helm_release_name"` // could not be updated Ns string `json:"ns"` ApplicationType AppType `json:"application_type"` ApplicationState ApplicationState `json:"application_state"` DepConfigName string `json:"dep_config_name"` PreInstallManifest string `json:"pre_install_manifest"` PostInstallManifest string `json:"post_install_manifest"` PreUpgradeManifest string `json:"pre_upgrade_manifest"` PostUpgradeManifest string `json:"post_upgrade_manifest"` PreDeleteManifest string `json:"pre_delete_manifest"` PostDeleteManifest string `json:"post_delete_manifest"` Manifest string `json:"manifest"` // back off timestamp when application uninstall // may invalid while inaccurate sys time UninstallBackOff int64 `json:"uninstall_back_off"` // manage the dev status of the application DevMeta ApplicationDevMeta `json:"dev_meta"` // store all the config of application Config *profile2.NocalHostAppConfigV2 `json:"config"` // something like database Secret *corev1.Secret `json:"secret"` // to distinguish same ns/app when using multiple K8s cluster NamespaceId string `json:"namespace_id"` // contains filtered or unexported fields }
application meta is the application meta info container
func FakeAppMeta ¶
func FakeAppMeta(ns, application string) *ApplicationMeta
func (*ApplicationMeta) CheckIfSvcDeveloping ¶
func (a *ApplicationMeta) CheckIfSvcDeveloping(name, identifier string, svcType base.SvcType, modeType profile2.DevModeType) DevStartStatus
func (*ApplicationMeta) Delete ¶
func (a *ApplicationMeta) Delete() error
Delete a application will not actually delete the secret just make the application as UNINSTALL state and set a protect time UninstallBackOff then clean the secret data
func (*ApplicationMeta) DoWithTempOperator ¶
func (a *ApplicationMeta) DoWithTempOperator(configBytes []byte, funny func() error) error
sometimes meta will not initail the go client, this method can present to use a temp kubeconfig for some K8s's oper
func (*ApplicationMeta) GenerateNidINE ¶
func (a *ApplicationMeta) GenerateNidINE() error
func (*ApplicationMeta) GetApplicationConfig ¶
func (a *ApplicationMeta) GetApplicationConfig() *profile2.ApplicationConfig
func (*ApplicationMeta) GetApplicationDevMeta ¶
func (a *ApplicationMeta) GetApplicationDevMeta() ApplicationDevMeta
func (*ApplicationMeta) GetClient ¶
func (a *ApplicationMeta) GetClient() *clientgoutils.ClientGoUtils
func (*ApplicationMeta) GetCurrentDevModeTypeOfWorkload ¶
func (a *ApplicationMeta) GetCurrentDevModeTypeOfWorkload(workloadName string, workloadType base.SvcType, identifier string) profile2.DevModeType
func (*ApplicationMeta) InitGoClient ¶
func (a *ApplicationMeta) InitGoClient(kubeConfigPath string) error
func (*ApplicationMeta) Initial ¶
func (a *ApplicationMeta) Initial(force bool) error
Initial initial the application, try to create a secret if not exist and it's state is INSTALLING or modify the exists secret as INSTALLING if the secret state is UNINSTALL params: force - force to re initial the appmeta, (while app uninstall, there is 10s re initial protect) if want to disable the protect, set force as true
func (*ApplicationMeta) IsHelm ¶
func (a *ApplicationMeta) IsHelm() bool
func (*ApplicationMeta) IsInstalled ¶
func (a *ApplicationMeta) IsInstalled() bool
func (*ApplicationMeta) IsInstalling ¶
func (a *ApplicationMeta) IsInstalling() bool
func (*ApplicationMeta) IsNotInstall ¶
func (a *ApplicationMeta) IsNotInstall() bool
func (*ApplicationMeta) IsUnknown ¶
func (a *ApplicationMeta) IsUnknown() bool
func (*ApplicationMeta) NewResourceReader ¶
func (a *ApplicationMeta) NewResourceReader() *clientgoutils.Resource
func (*ApplicationMeta) NotInstallTips ¶
func (a *ApplicationMeta) NotInstallTips() string
func (*ApplicationMeta) OneTimesInitial ¶
func (a *ApplicationMeta) OneTimesInitial(fun func(meta *ApplicationMeta), force bool) error
Initial initial the application, try to create a secret if not exist and it's state is INSTALLED or modify the exists secret as INSTALLED if the secret state is UNINSTALL
func (*ApplicationMeta) ProtectedFromReInstall ¶
func (a *ApplicationMeta) ProtectedFromReInstall() bool
func (*ApplicationMeta) ReAssignmentBySecret ¶
func (a *ApplicationMeta) ReAssignmentBySecret(secret *corev1.Secret) error
func (*ApplicationMeta) SvcDevEnd ¶
func (a *ApplicationMeta) SvcDevEnd(name, identifier string, svcType base.SvcType, modeType profile2.DevModeType) error
func (*ApplicationMeta) SvcDevModePossessor ¶
func (a *ApplicationMeta) SvcDevModePossessor(name string, svcType base.SvcType, identifier string, modeType profile2.DevModeType) bool
func (*ApplicationMeta) SvcDevStartComplete ¶
func (a *ApplicationMeta) SvcDevStartComplete(name string, svcType base.SvcType, identifier string, modeType profile2.DevModeType) error
func (*ApplicationMeta) SvcDevStarting ¶
func (a *ApplicationMeta) SvcDevStarting(name string, svcType base.SvcType, identifier string, modeType profile2.DevModeType) error
SvcDevStarting call this func first recode 'name>...starting' as developing while complete enter dev start, should call #SvcDevStartComplete to mark svc completely enter dev mode
func (*ApplicationMeta) Uninstall ¶
func (a *ApplicationMeta) Uninstall(force bool) error
Uninstall uninstall the application and delete the secret from k8s cluster
func (*ApplicationMeta) Update ¶
func (a *ApplicationMeta) Update() error
Update if update occurs errors, it will get a new secret from k8s, and retry update again, default retry times is 5
type ApplicationMetaSimple ¶
type ApplicationMetaSimple struct { Application string `json:"application"` Ns string `json:"ns"` ApplicationState ApplicationState `json:"application_state"` // manage the dev status of the application DevMeta ApplicationDevMeta `json:"dev_meta"` Manifest string `json:"manifest"` PreInstallManifest string `json:"pre_install_manifest"` }
type ApplicationMetaSimples ¶
type ApplicationMetaSimples []*ApplicationMetaSimple
type ApplicationMetas ¶
type ApplicationMetas []*ApplicationMeta
func (ApplicationMetas) Desc ¶
func (as ApplicationMetas) Desc() (result ApplicationMetaSimples)
describe the applications meta for output
type ApplicationState ¶
type ApplicationState string
func ApplicationStateOf ¶
func ApplicationStateOf(s string) ApplicationState
type DevStartStatus ¶
type DevStartStatus string