Documentation
¶
Index ¶
- Variables
- func CheckWorkspaceExistenceByDefaultOperator(name string) (bool, error)
- func CompleteMysqlConfig(config *v1.MysqlConfig)
- func CompleteWholeMysqlConfig(config *v1.MysqlConfig)
- func CompleteWholeOssConfig(config *v1.OssConfig)
- func CompleteWholeS3Config(config *v1.S3Config)
- func CompleteWorkspace(ws *v1.Workspace, name string)
- func CreateWorkspaceByDefaultOperator(ws *v1.Workspace) error
- func DeleteWorkspaceByDefaultOperator(name string) error
- func GetBackendName(configs *v1.BackendConfigs) string
- func GetIntFromGenericConfig(config v1.GenericConfig, key string) (int, error)
- func GetKubernetesConfig(configs *v1.RuntimeConfigs) *v1.KubernetesConfig
- func GetMapFromGenericConfig(config v1.GenericConfig, key string) (map[string]any, error)
- func GetMysqlPasswordFromEnv() string
- func GetOssSensitiveDataFromEnv() (string, string)
- func GetProjectModuleConfig(config *v1.ModuleConfig, projectName string) (v1.GenericConfig, error)
- func GetProjectModuleConfigs(configs v1.ModuleConfigs, projectName string) (map[string]v1.GenericConfig, error)
- func GetProviderConfig(configs *v1.RuntimeConfigs, providerName string) (*v1.ProviderConfig, error)
- func GetS3SensitiveDataFromEnv() (string, string, string)
- func GetStringFromGenericConfig(config v1.GenericConfig, key string) (string, error)
- func GetStringMapFromGenericConfig(config v1.GenericConfig, key string) (map[string]string, error)
- func GetTerraformConfig(configs *v1.RuntimeConfigs) v1.TerraformConfig
- func GetWorkspaceByDefaultOperator(name string) (*v1.Workspace, error)
- func GetWorkspaceNamesByDefaultOperator() ([]string, error)
- func UpdateWorkspaceByDefaultOperator(ws *v1.Workspace) error
- func ValidateBackendConfigs(configs *v1.BackendConfigs) error
- func ValidateGenericObjectStorageConfig(config *v1.GenericObjectStorageConfig) error
- func ValidateKubernetesConfig(config *v1.KubernetesConfig) error
- func ValidateModuleConfig(config *v1.ModuleConfig) error
- func ValidateModuleConfigs(configs v1.ModuleConfigs) error
- func ValidateModuleDefaultConfig(config v1.GenericConfig) error
- func ValidateModulePatcherConfigs(config v1.ModulePatcherConfigs) error
- func ValidateMysqlConfig(config *v1.MysqlConfig) error
- func ValidateProviderConfig(config *v1.ProviderConfig) error
- func ValidateRuntimeConfigs(configs *v1.RuntimeConfigs) error
- func ValidateSecretStoreConfig(spec *v1.SecretStoreSpec) []error
- func ValidateTerraformConfig(config v1.TerraformConfig) error
- func ValidateWholeOssConfig(config *v1.OssConfig) error
- func ValidateWholeS3Config(config *v1.S3Config) error
- func ValidateWorkspace(ws *v1.Workspace) error
- type Operator
- func (o *Operator) CreateWorkspace(ws *v1.Workspace) error
- func (o *Operator) DeleteWorkspace(name string) error
- func (o *Operator) GetWorkspace(name string) (*v1.Workspace, error)
- func (o *Operator) GetWorkspaceNames() ([]string, error)
- func (o *Operator) UpdateWorkspace(ws *v1.Workspace) error
- func (o *Operator) Validate() error
- func (o *Operator) WorkspaceExist(name string) bool
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptyStoragePath = errors.New("empty storage path") ErrUnexpectedDir = errors.New("unexpected dir under storage path") ErrFileNotYAML = errors.New("not yaml file under storage path") ErrEmptyWorkspace = errors.New("empty workspace") ErrWorkspaceNotExist = errors.New("workspace does not exist") ErrWorkspaceAlreadyExist = errors.New("workspace has already existed") )
var ( ErrEmptyWorkspaceName = errors.New("empty workspace name") ErrEmptyModuleName = errors.New("empty module name") ErrEmptyModuleConfig = errors.New("empty module config") ErrEmptyModuleConfigBlock = errors.New("empty config of a module block") ErrEmptyModuleConfigPatcherBlock = errors.New("empty patcher block in module config") ErrEmptyModuleConfigPatcherBlockName = errors.New("empty patcher block name in module config") ErrInvalidModuleConfigPatcherBlockName = errors.New("patcher name must not be default in module config") ErrEmptyModuleConfigProjectSelector = errors.New("empty projectSelector in module config patcher block") ErrNotEmptyModuleConfigProjectSelector = errors.New("not empty projectSelector in module config default block") ErrEmptyModuleConfigProjectName = errors.New("empty project name at projectSelector in module config patcher block") ErrRepeatedModuleConfigSelectedProjects = errors.New("project should not repeat in one patcher block's projectSelector") ErrMultipleModuleConfigSelectedProjects = errors.New("a project cannot assign in more than one patcher block's projectSelector") ErrEmptyKubeConfig = errors.New("empty kubeconfig") ErrEmptyTerraformProviderName = errors.New("empty terraform provider name") ErrEmptyTerraformProviderConfig = errors.New("empty terraform provider config") ErrEmptyTerraformProviderSource = errors.New("empty provider source") ErrEmptyTerraformProviderVersion = errors.New("empty provider version") ErrEmptyTerraformProviderConfigKey = errors.New("empty provider config key") ErrEmptyTerraformProviderConfigValue = errors.New("empty provider config value") ErrMultipleBackends = errors.New("more than one backend configured") ErrEmptyMysqlDBName = errors.New("empty db name") ErrEmptyMysqlUser = errors.New("empty mysql db user") ErrEmptyMysqlHost = errors.New("empty mysql host") ErrInvalidMysqlPort = errors.New("mysql port must be between 1 and 65535") ErrEmptyBucket = errors.New("empty bucket") ErrEmptyAccessKeyID = errors.New("empty access key id") ErrEmptyAccessKeySecret = errors.New("empty access key secret") ErrEmptyOssEndpoint = errors.New("empty oss endpoint") ErrEmptyS3Region = errors.New("empty s3 region") ErrMissingProvider = errors.New("invalid secret store spec, missing provider config") ErrMultiSecretStoreProviders = errors.New("may not specify more than 1 secret store provider") ErrEmptyAWSRegion = errors.New("region must be provided when using AWS Secrets Manager") ErrEmptyVaultServer = errors.New("server address must be provided when using Hashicorp Vault") ErrEmptyVaultURL = errors.New("vault url must be provided when using Azure KeyVault") ErrEmptyTenantID = errors.New("azure tenant id must be provided when using Azure KeyVault") ErrEmptyAlicloudRegion = errors.New("region must be provided when using Alicloud Secrets Manager") ErrMissingProviderType = errors.New("must specify a provider type") )
var ErrEmptyProjectName = errors.New("empty project name")
Functions ¶
func CheckWorkspaceExistenceByDefaultOperator ¶ added in v0.10.0
CheckWorkspaceExistenceByDefaultOperator checks the workspace exists or not by default operator.
func CompleteMysqlConfig ¶ added in v0.10.0
func CompleteMysqlConfig(config *v1.MysqlConfig)
CompleteMysqlConfig sets default value of mysql config if not set.
func CompleteWholeMysqlConfig ¶ added in v0.10.0
func CompleteWholeMysqlConfig(config *v1.MysqlConfig)
CompleteWholeMysqlConfig constructs the whole mysql config by environment variables if set.
func CompleteWholeOssConfig ¶ added in v0.10.0
CompleteWholeOssConfig constructs the whole oss config by environment variables if set.
func CompleteWholeS3Config ¶ added in v0.10.0
CompleteWholeS3Config constructs the whole s3 config by environment variables if set.
func CompleteWorkspace ¶ added in v0.10.0
CompleteWorkspace sets the workspace name and default value of unset item, should be called after Validatev1. The config items set as environment variables are not got by Completev1.
func CreateWorkspaceByDefaultOperator ¶ added in v0.10.0
CreateWorkspaceByDefaultOperator creates a workspace by default operator.
func DeleteWorkspaceByDefaultOperator ¶ added in v0.10.0
DeleteWorkspaceByDefaultOperator deletes a workspace by default operator
func GetBackendName ¶ added in v0.10.0
func GetBackendName(configs *v1.BackendConfigs) string
GetBackendName returns the backend name that is configured in BackendConfigs, should be called after ValidateBackendConfigs.
func GetIntFromGenericConfig ¶ added in v0.10.0
func GetIntFromGenericConfig(config v1.GenericConfig, key string) (int, error)
GetIntFromGenericConfig returns the value of the key in config which should be of type int. If exist but not int, return error. If not exist, return 0, nil.
func GetKubernetesConfig ¶
func GetKubernetesConfig(configs *v1.RuntimeConfigs) *v1.KubernetesConfig
GetKubernetesConfig returns kubernetes config from runtime config, should be called after ValidateRuntimeConfigs. If got empty kubernetes config, return nil.
func GetMapFromGenericConfig ¶ added in v0.10.0
GetMapFromGenericConfig returns the value of the key in config which should be of type map[string]any. If exist but not map[string]any, return error; If not exist, return nil, nil.
func GetMysqlPasswordFromEnv ¶ added in v0.10.0
func GetMysqlPasswordFromEnv() string
GetMysqlPasswordFromEnv returns mysql password set by environment variables.
func GetOssSensitiveDataFromEnv ¶ added in v0.10.0
GetOssSensitiveDataFromEnv returns oss accessKeyID, accessKeySecret set by environment variables.
func GetProjectModuleConfig ¶
func GetProjectModuleConfig(config *v1.ModuleConfig, projectName string) (v1.GenericConfig, error)
GetProjectModuleConfig returns the module config of a specified project, should be called after ValidateModuleConfig. If got empty module config, return nil config and nil error.
func GetProjectModuleConfigs ¶
func GetProjectModuleConfigs(configs v1.ModuleConfigs, projectName string) (map[string]v1.GenericConfig, error)
GetProjectModuleConfigs returns the module configs of a specified project, whose key is the module name, should be called after ValidateModuleConfigs. If got empty module configs, return nil config and nil error.
func GetProviderConfig ¶ added in v0.10.0
func GetProviderConfig(configs *v1.RuntimeConfigs, providerName string) (*v1.ProviderConfig, error)
GetProviderConfig returns the specified terraform provider config from runtime config, should be called after ValidateRuntimeConfigs. If got empty terraform config, return nil config and nil error.
func GetS3SensitiveDataFromEnv ¶ added in v0.10.0
GetS3SensitiveDataFromEnv returns s3 accessKeyID, accessKeySecret, region set by environment variables.
func GetStringFromGenericConfig ¶ added in v0.10.0
func GetStringFromGenericConfig(config v1.GenericConfig, key string) (string, error)
GetStringFromGenericConfig returns the value of the key in config which should be of type string. If exist but not string, return error; If not exist, return "", nil.
func GetStringMapFromGenericConfig ¶ added in v0.10.0
GetStringMapFromGenericConfig returns the value of the key in config which should be of type map[string]string. If exist but not map[string]string, return error; If not exist, return nil, nil.
func GetTerraformConfig ¶
func GetTerraformConfig(configs *v1.RuntimeConfigs) v1.TerraformConfig
GetTerraformConfig returns terraform config from runtime config, should be called after ValidateRuntimeConfigs. If got empty terraform config, return nil.
func GetWorkspaceByDefaultOperator ¶ added in v0.10.0
GetWorkspaceByDefaultOperator gets a workspace by default operator.
func GetWorkspaceNamesByDefaultOperator ¶ added in v0.10.0
GetWorkspaceNamesByDefaultOperator list all the workspace names by default operator.
func UpdateWorkspaceByDefaultOperator ¶ added in v0.10.0
UpdateWorkspaceByDefaultOperator updates a workspace by default operator.
func ValidateBackendConfigs ¶
func ValidateBackendConfigs(configs *v1.BackendConfigs) error
ValidateBackendConfigs is used to validate backendConfigs is valid or not, and does not validate the configs which can get from environment variables, such as access key id, etc.
func ValidateGenericObjectStorageConfig ¶ added in v0.10.0
func ValidateGenericObjectStorageConfig(config *v1.GenericObjectStorageConfig) error
ValidateGenericObjectStorageConfig is used to validate ossConfig and s3Config is valid or not, where the sensitive data items set as environment variables are not included.
func ValidateKubernetesConfig ¶
func ValidateKubernetesConfig(config *v1.KubernetesConfig) error
ValidateKubernetesConfig is used to validate the kubernetesConfig is valid or not.
func ValidateModuleConfig ¶
func ValidateModuleConfig(config *v1.ModuleConfig) error
ValidateModuleConfig is used to validate the moduleConfig is valid or not.
func ValidateModuleConfigs ¶
func ValidateModuleConfigs(configs v1.ModuleConfigs) error
ValidateModuleConfigs validates the moduleConfigs is valid or not.
func ValidateModuleDefaultConfig ¶ added in v0.10.0
func ValidateModuleDefaultConfig(config v1.GenericConfig) error
func ValidateModulePatcherConfigs ¶ added in v0.10.0
func ValidateModulePatcherConfigs(config v1.ModulePatcherConfigs) error
func ValidateMysqlConfig ¶ added in v0.10.0
func ValidateMysqlConfig(config *v1.MysqlConfig) error
ValidateMysqlConfig is used to validate mysqlConfig is valid or not.
func ValidateProviderConfig ¶ added in v0.10.0
func ValidateProviderConfig(config *v1.ProviderConfig) error
ValidateProviderConfig is used to validate the providerConfig is valid or not.
func ValidateRuntimeConfigs ¶
func ValidateRuntimeConfigs(configs *v1.RuntimeConfigs) error
ValidateRuntimeConfigs is used to validate the runtimeConfigs is valid or not.
func ValidateSecretStoreConfig ¶ added in v0.10.0
func ValidateSecretStoreConfig(spec *v1.SecretStoreSpec) []error
ValidateSecretStoreConfig tests that the specified SecretStoreSpec has valid data.
func ValidateTerraformConfig ¶
func ValidateTerraformConfig(config v1.TerraformConfig) error
ValidateTerraformConfig is used to validate the terraformConfig is valid or not.
func ValidateWholeOssConfig ¶ added in v0.10.0
ValidateWholeOssConfig is used to validate ossConfig is valid or not, where all the items are included. If valid, the config contains all valid items to new an oss client.
func ValidateWholeS3Config ¶ added in v0.10.0
ValidateWholeS3Config is used to validate s3Config is valid or not, where all the items are included. If valid, the config contains all valid items to new a s3 client.
func ValidateWorkspace ¶
ValidateWorkspace is used to validate the workspace get or set in the storage, and does not validate the config which can get from environment variables, such as access key id in backend configs.
Types ¶
type Operator ¶
type Operator struct {
// contains filtered or unexported fields
}
Operator is used to handle the CURD operations of workspace. Operator only supports local file system as backend for now.
func NewDefaultOperator ¶
NewDefaultOperator returns a default backend, whose storage path is the directory "workspace" under kfile.KusionDataFolder().
func NewOperator ¶
NewOperator news an Operator with the specified storage path. If the directory of the storage path has not created, then create the directory.
func NewValidDefaultOperator ¶ added in v0.10.0
NewValidDefaultOperator news a default operator and then do the validation work.
func (*Operator) CreateWorkspace ¶
CreateWorkspace creates a workspace. The validation of workspace should be done before creating.
func (*Operator) DeleteWorkspace ¶
DeleteWorkspace deletes a workspace.
func (*Operator) GetWorkspace ¶
GetWorkspace gets the workspace by name. The validity of the returned workspace is not guaranteed.
func (*Operator) GetWorkspaceNames ¶
GetWorkspaceNames gets all the workspace names.
func (*Operator) UpdateWorkspace ¶
UpdateWorkspace updates a workspace.The validation of workspace should be done before updating.
func (*Operator) WorkspaceExist ¶
WorkspaceExist checks the workspace exists or not.