Documentation
¶
Index ¶
- Constants
- Variables
- func DeleteZonesRule(oldRaw, newRaw json.RawMessage) error
- func GetIndexFromNodeName(name string) (int, error)
- func ParseBashibleConfig(paths []string, specPath string) (map[string]interface{}, error)
- func ReadVersionTagFromInstallerContainer() (string, bool)
- func UpdateMasterImageRule(oldRaw, newRaw json.RawMessage) error
- func UpdateReplicasRule(oldRaw, newRaw json.RawMessage) error
- func ValidateClusterSettingsChanges(phase phases.OperationPhase, oldConfig, newConfig string, ...) error
- func ValidateDiscoveryData(config *[]byte, paths []string, opts ...ValidateOption) (bool, error)
- func ValidateInitConfiguration(configData string, schemaStore *SchemaStore, opts ...ValidateOption) error
- func ValidateProviderSpecificClusterConfiguration(providerSpecificClusterConfiguration string, clusterConfig ClusterConfig, ...) error
- func ValidateResources(configData string, opts ...ValidateOption) error
- func ValidateSSHPrivateKey(value json.RawMessage) error
- func ValidateStaticClusterConfiguration(staticClusterConfiguration string, schemaStore *SchemaStore, ...) error
- type ClusterConfig
- type ClusterConfigCloudSpec
- type ConnectionConfig
- type ConnectionConfigParser
- type DeckhouseClusterConfig
- type DeckhouseInstaller
- type Error
- type ErrorKind
- type MasterNodeGroupSpec
- type MetaConfig
- func LoadConfigFromFile(paths []string, opts ...ValidateOption) (*MetaConfig, error)
- func ParseConfig(paths []string, opts ...ValidateOption) (*MetaConfig, error)
- func ParseConfigFromCluster(kubeCl *client.KubernetesClient) (*MetaConfig, error)
- func ParseConfigFromData(configData string, opts ...ValidateOption) (*MetaConfig, error)
- func ParseConfigInCluster(kubeCl *client.KubernetesClient) (*MetaConfig, error)
- func (m *MetaConfig) CachePath() string
- func (m *MetaConfig) ClusterConfigYAML() ([]byte, error)
- func (m *MetaConfig) ConfigForBashibleBundleTemplate(bundle, nodeIP string) (map[string]interface{}, error)
- func (m *MetaConfig) ConfigForKubeadmTemplates(nodeIP string) (map[string]interface{}, error)
- func (m *MetaConfig) DeepCopy() *MetaConfig
- func (m *MetaConfig) EnrichProxyData() (map[string]interface{}, error)
- func (m *MetaConfig) ExtractMasterNodeGroupStaticSettings() map[string]interface{}
- func (m *MetaConfig) FindTerraNodeGroup(nodeGroupName string) []byte
- func (m *MetaConfig) GetTerraNodeGroups() []TerraNodeGroupSpec
- func (m *MetaConfig) LoadImagesDigests(filename string) error
- func (m *MetaConfig) LoadInstallerVersion() error
- func (m *MetaConfig) LoadVersionMap(filename string) error
- func (m *MetaConfig) MarshalConfig() []byte
- func (m *MetaConfig) MarshalFullConfig() []byte
- func (m *MetaConfig) NodeGroupConfig(nodeGroupName string, nodeIndex int, cloudConfig string) []byte
- func (m *MetaConfig) NodeGroupManifest(terraNodeGroup TerraNodeGroupSpec) map[string]interface{}
- func (m *MetaConfig) ParseRegistryData() (map[string]interface{}, error)
- func (m *MetaConfig) Prepare() (*MetaConfig, error)
- func (m *MetaConfig) ProviderClusterConfigYAML() ([]byte, error)
- func (m *MetaConfig) StaticClusterConfigYAML() ([]byte, error)
- type ModuleConfig
- type ModuleConfigSpec
- type OpenAPISchema
- type OpenAPISchemaVersion
- type RegistryData
- type SSHAgentPrivateKey
- type SSHConfig
- type SSHHost
- type SchemaIndex
- type SchemaStore
- func (s *SchemaStore) Get(index *SchemaIndex) *spec.Schema
- func (s *SchemaStore) GetModuleConfigVersion(name string) int
- func (s *SchemaStore) HasSchemaForModuleConfig(name string) bool
- func (s *SchemaStore) UploadByPath(path string) error
- func (s *SchemaStore) Validate(doc *[]byte, opts ...ValidateOption) (*SchemaIndex, error)
- func (s *SchemaStore) ValidateWithIndex(index *SchemaIndex, doc *[]byte, opts ...ValidateOption) error
- type SettingsValues
- type TerraNodeGroupSpec
- type ValidateOption
- type ValidationError
Constants ¶
const ( SSHConfigKind = "SSHConfig" SSHConfigHostKind = "SSHHost" )
const ( DefaultBundle = "Default" DefaultLogLevel = "Info" )
const ( ModuleConfigKind = "ModuleConfig" ModuleConfigResource = "moduleconfigs" ModuleConfigGroup = "deckhouse.io" ModuleConfigVersion = "v1alpha1" )
const ( CloudClusterType = "Cloud" StaticClusterType = "Static" )
const ( InitConfigurationKind = "InitConfiguration" ClusterConfigurationKind = "ClusterConfiguration" StaticClusterConfigurationKind = "StaticClusterConfiguration" )
const (
// don't forget to update the version in release requirements (release.yaml) 'autoK8sVersion' key
DefaultKubernetesVersion = "1.27"
)
Variables ¶
var ( ErrUnsafeFieldChanged = errors.New("unsafe field has been changed") ErrSchemaNotFound = errors.New("schema not found") ErrValidationRuleFailed = errors.New("validation rule failed") )
var ( // ModuleConfigGVR GroupVersionResource ModuleConfigGVR = schema.GroupVersionResource{ Group: ModuleConfigGroup, Version: ModuleConfigVersion, Resource: ModuleConfigResource, } )
Functions ¶
func DeleteZonesRule ¶
func DeleteZonesRule(oldRaw, newRaw json.RawMessage) error
func GetIndexFromNodeName ¶
func ParseBashibleConfig ¶
func UpdateMasterImageRule ¶
func UpdateMasterImageRule(oldRaw, newRaw json.RawMessage) error
func UpdateReplicasRule ¶
func UpdateReplicasRule(oldRaw, newRaw json.RawMessage) error
func ValidateClusterSettingsChanges ¶
func ValidateClusterSettingsChanges( phase phases.OperationPhase, oldConfig, newConfig string, schemaStore *SchemaStore, opts ...ValidateOption, ) error
ValidateClusterSettingsChanges validates changes of current cluster configuration with the previous one. It checks the configuration changes for compliance with the current phase and schema extension rule (x-unsafe). It denies any changes for fields with `x-unsafe: true`. It applies all validation rules to fields with not empty `x-unsafe-rules` extension. On the BaseInfra phase changes are allowed. Non-config resources are checked only for compliance with the yaml format and the validity of apiVersion and kind fields: no changes validation for them. It can be used as an imported functionality in external modules.
func ValidateDiscoveryData ¶
func ValidateDiscoveryData(config *[]byte, paths []string, opts ...ValidateOption) (bool, error)
func ValidateInitConfiguration ¶
func ValidateInitConfiguration(configData string, schemaStore *SchemaStore, opts ...ValidateOption) error
ValidateInitConfiguration parses and validates cluster InitConfiguration. It requires one doc with InitConfiguration kind.
func ValidateProviderSpecificClusterConfiguration ¶
func ValidateProviderSpecificClusterConfiguration( providerSpecificClusterConfiguration string, clusterConfig ClusterConfig, schemaStore *SchemaStore, opts ...ValidateOption, ) error
ValidateProviderSpecificClusterConfiguration parses and validates cluster ProviderSpecificClusterConfiguration. It requires one doc with kind in [ "OpenStackClusterConfiguration", "AWSClusterConfiguration", "GCPClusterConfiguration", "YandexClusterConfiguration", "VsphereClusterConfiguration", "AzureClusterConfiguration", "VCDClusterConfiguration", "ZvirtClusterConfiguration", ]
func ValidateResources ¶
func ValidateResources(configData string, opts ...ValidateOption) error
ValidateResources parses and validates cluster ResourcesConfiguration/InitResourcesConfiguration. It requires all resources to have group, version and kind.
func ValidateSSHPrivateKey ¶
func ValidateSSHPrivateKey(value json.RawMessage) error
func ValidateStaticClusterConfiguration ¶
func ValidateStaticClusterConfiguration( staticClusterConfiguration string, schemaStore *SchemaStore, opts ...ValidateOption, ) error
ValidateStaticClusterConfiguration parses and validates cluster StaticClusterConfiguration. It requires one or zero doc with StaticClusterConfiguration kind.
Types ¶
type ClusterConfig ¶
type ClusterConfig struct { ClusterType string `yaml:"clusterType"` Cloud struct { Provider string `json:"provider"` } `yaml:"cloud"` }
func ValidateClusterConfiguration ¶
func ValidateClusterConfiguration( clusterConfigData string, schemaStore *SchemaStore, opts ...ValidateOption, ) (ClusterConfig, error)
ValidateClusterConfiguration parses and validates cluster ClusterConfiguration. It requires one doc with ClusterConfiguration kind. Returns ClusterConfig that needs to validate ProviderSpecificClusterConfiguration. ClusterConfig may not be empty even is error is returned.
type ClusterConfigCloudSpec ¶
type ConnectionConfig ¶
func ParseConnectionConfig ¶
func ParseConnectionConfig( configData string, schemaStore *SchemaStore, opts ...ValidateOption, ) (*ConnectionConfig, error)
type ConnectionConfigParser ¶
type ConnectionConfigParser struct{}
func (ConnectionConfigParser) ParseConnectionConfigFromFile ¶
func (ConnectionConfigParser) ParseConnectionConfigFromFile() error
ParseConnectionConfigFromFile parses SSH connection config from file (app.ConnectionConfigPath) and fills app.SSH* variables with corresponding data.
type DeckhouseClusterConfig ¶
type DeckhouseClusterConfig struct { ReleaseChannel string `json:"releaseChannel,omitempty"` DevBranch string `json:"devBranch,omitempty"` Bundle string `json:"bundle,omitempty"` LogLevel string `json:"logLevel,omitempty"` ImagesRepo string `json:"imagesRepo"` RegistryDockerCfg string `json:"registryDockerCfg,omitempty"` RegistryCA string `json:"registryCA,omitempty"` RegistryScheme string `json:"registryScheme,omitempty"` ConfigOverrides map[string]interface{} `json:"configOverrides"` }
type DeckhouseInstaller ¶
type DeckhouseInstaller struct { Registry RegistryData LogLevel string Bundle string DevBranch string UUID string KubeDNSAddress string ClusterConfig []byte ProviderClusterConfig []byte StaticClusterConfig []byte TerraformState []byte NodesTerraformState map[string][]byte CloudDiscovery []byte ModuleConfigs []*ModuleConfig KubeadmBootstrap bool MasterNodeSelector bool ReleaseChannel string InstallerVersion string CommanderMode bool CommanderUUID uuid.UUID }
func PrepareDeckhouseInstallConfig ¶
func PrepareDeckhouseInstallConfig(metaConfig *MetaConfig) (*DeckhouseInstaller, error)
func (*DeckhouseInstaller) GetImage ¶
func (c *DeckhouseInstaller) GetImage(forceVersionTag bool) string
func (*DeckhouseInstaller) IsRegistryAccessRequired ¶
func (c *DeckhouseInstaller) IsRegistryAccessRequired() bool
type MasterNodeGroupSpec ¶
type MasterNodeGroupSpec struct {
Replicas int `json:"replicas"`
}
type MetaConfig ¶
type MetaConfig struct { ClusterType string `json:"-"` Layout string `json:"-"` ProviderName string `json:"-"` OriginalProviderName string `json:"-"` ClusterPrefix string `json:"-"` ClusterDNSAddress string `json:"-"` DeckhouseConfig DeckhouseClusterConfig `json:"-"` MasterNodeGroupSpec MasterNodeGroupSpec `json:"-"` TerraNodeGroupSpecs []TerraNodeGroupSpec `json:"-"` ClusterConfig map[string]json.RawMessage `json:"clusterConfiguration"` InitClusterConfig map[string]json.RawMessage `json:"-"` ModuleConfigs []*ModuleConfig `json:"-"` ProviderClusterConfig map[string]json.RawMessage `json:"providerClusterConfiguration,omitempty"` StaticClusterConfig map[string]json.RawMessage `json:"staticClusterConfiguration,omitempty"` VersionMap map[string]interface{} `json:"-"` Images imagesDigests `json:"-"` Registry RegistryData `json:"-"` UUID string `json:"clusterUUID,omitempty"` InstallerVersion string `json:"-"` ResourcesYAML string `json:"-"` }
func LoadConfigFromFile ¶
func LoadConfigFromFile(paths []string, opts ...ValidateOption) (*MetaConfig, error)
func ParseConfig ¶
func ParseConfig(paths []string, opts ...ValidateOption) (*MetaConfig, error)
func ParseConfigFromCluster ¶
func ParseConfigFromCluster(kubeCl *client.KubernetesClient) (*MetaConfig, error)
func ParseConfigFromData ¶
func ParseConfigFromData(configData string, opts ...ValidateOption) (*MetaConfig, error)
func ParseConfigInCluster ¶
func ParseConfigInCluster(kubeCl *client.KubernetesClient) (*MetaConfig, error)
func (*MetaConfig) CachePath ¶
func (m *MetaConfig) CachePath() string
func (*MetaConfig) ClusterConfigYAML ¶
func (m *MetaConfig) ClusterConfigYAML() ([]byte, error)
func (*MetaConfig) ConfigForBashibleBundleTemplate ¶
func (m *MetaConfig) ConfigForBashibleBundleTemplate(bundle, nodeIP string) (map[string]interface{}, error)
func (*MetaConfig) ConfigForKubeadmTemplates ¶
func (m *MetaConfig) ConfigForKubeadmTemplates(nodeIP string) (map[string]interface{}, error)
func (*MetaConfig) DeepCopy ¶
func (m *MetaConfig) DeepCopy() *MetaConfig
func (*MetaConfig) EnrichProxyData ¶
func (m *MetaConfig) EnrichProxyData() (map[string]interface{}, error)
func (*MetaConfig) ExtractMasterNodeGroupStaticSettings ¶
func (m *MetaConfig) ExtractMasterNodeGroupStaticSettings() map[string]interface{}
func (*MetaConfig) FindTerraNodeGroup ¶
func (m *MetaConfig) FindTerraNodeGroup(nodeGroupName string) []byte
func (*MetaConfig) GetTerraNodeGroups ¶
func (m *MetaConfig) GetTerraNodeGroups() []TerraNodeGroupSpec
func (*MetaConfig) LoadImagesDigests ¶
func (m *MetaConfig) LoadImagesDigests(filename string) error
func (*MetaConfig) LoadInstallerVersion ¶
func (m *MetaConfig) LoadInstallerVersion() error
func (*MetaConfig) LoadVersionMap ¶
func (m *MetaConfig) LoadVersionMap(filename string) error
func (*MetaConfig) MarshalConfig ¶
func (m *MetaConfig) MarshalConfig() []byte
func (*MetaConfig) MarshalFullConfig ¶
func (m *MetaConfig) MarshalFullConfig() []byte
func (*MetaConfig) NodeGroupConfig ¶
func (m *MetaConfig) NodeGroupConfig(nodeGroupName string, nodeIndex int, cloudConfig string) []byte
NodeGroupConfig returns values for terraform to order master node or static node
func (*MetaConfig) NodeGroupManifest ¶
func (m *MetaConfig) NodeGroupManifest(terraNodeGroup TerraNodeGroupSpec) map[string]interface{}
NodeGroupManifest prepares NodeGroup custom resource for static nodes, which were ordered by Terraform
func (*MetaConfig) ParseRegistryData ¶
func (m *MetaConfig) ParseRegistryData() (map[string]interface{}, error)
func (*MetaConfig) Prepare ¶
func (m *MetaConfig) Prepare() (*MetaConfig, error)
Prepare extracts all necessary information from raw json messages to the root structure
func (*MetaConfig) ProviderClusterConfigYAML ¶
func (m *MetaConfig) ProviderClusterConfigYAML() ([]byte, error)
func (*MetaConfig) StaticClusterConfigYAML ¶
func (m *MetaConfig) StaticClusterConfigYAML() ([]byte, error)
type ModuleConfig ¶
type ModuleConfig struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec ModuleConfigSpec `json:"spec"` }
ModuleConfig is a configuration for module or for global config values.
func ConvertInitConfigurationToModuleConfigs ¶
func ConvertInitConfigurationToModuleConfigs(metaConfig *MetaConfig, schemasStore *SchemaStore, bundle string, level string) ([]*ModuleConfig, error)
ConvertInitConfigurationToModuleConfigs turns InitConfiguration into a set of ModuleConfig's. At first, it creates a mandatory "deckhouse" ModuleConfig, then it checks for any module configuration overrides within InitConfiguration.configOverrides. If it detects such overrides, it converts them into ModuleConfig resources as well. Finally, it unlocks further bootstrap by allowing modules hooks to run with created ModuleConfig's.
type ModuleConfigSpec ¶
type ModuleConfigSpec struct { Version int `json:"version,omitempty"` Settings SettingsValues `json:"settings,omitempty"` Enabled *bool `json:"enabled,omitempty"` }
type OpenAPISchema ¶
type OpenAPISchema struct { Kind string `json:"kind"` Versions []OpenAPISchemaVersion `json:"apiVersions"` }
type OpenAPISchemaVersion ¶
type OpenAPISchemaVersion struct { Version string `json:"apiVersion"` Schema interface{} `json:"openAPISpec"` }
type RegistryData ¶
type RegistryData struct { Address string `json:"address"` Path string `json:"path"` Scheme string `json:"scheme"` CA string `json:"ca"` DockerCfg string `json:"dockerCfg"` }
func (*RegistryData) Auth ¶
func (r *RegistryData) Auth() (string, error)
func (*RegistryData) ConvertToMap ¶
func (r *RegistryData) ConvertToMap() map[string]interface{}
type SSHAgentPrivateKey ¶
type SSHConfig ¶
type SSHConfig struct { SSHUser string `json:"sshUser"` SSHPort *int32 `json:"sshPort,omitempty"` SSHAgentPrivateKeys []SSHAgentPrivateKey `json:"sshAgentPrivateKeys"` SSHExtraArgs string `json:"sshExtraArgs,omitempty"` SSHBastionHost string `json:"sshBastionHost,omitempty"` SSHBastionPort *int32 `json:"sshBastionPort,omitempty"` SSHBastionUser string `json:"sshBastionUser,omitempty"` }
type SchemaIndex ¶
func (*SchemaIndex) IsValid ¶
func (i *SchemaIndex) IsValid() bool
func (*SchemaIndex) String ¶
func (i *SchemaIndex) String() string
type SchemaStore ¶
type SchemaStore struct {
// contains filtered or unexported fields
}
func NewSchemaStore ¶
func NewSchemaStore(paths ...string) *SchemaStore
func (*SchemaStore) Get ¶
func (s *SchemaStore) Get(index *SchemaIndex) *spec.Schema
func (*SchemaStore) GetModuleConfigVersion ¶
func (s *SchemaStore) GetModuleConfigVersion(name string) int
func (*SchemaStore) HasSchemaForModuleConfig ¶
func (s *SchemaStore) HasSchemaForModuleConfig(name string) bool
func (*SchemaStore) UploadByPath ¶
func (s *SchemaStore) UploadByPath(path string) error
func (*SchemaStore) Validate ¶
func (s *SchemaStore) Validate(doc *[]byte, opts ...ValidateOption) (*SchemaIndex, error)
func (*SchemaStore) ValidateWithIndex ¶
func (s *SchemaStore) ValidateWithIndex(index *SchemaIndex, doc *[]byte, opts ...ValidateOption) error
ValidateWithIndex validate one document with schema two separated kinds will validate: ModuleConfig and another kinds with schema eg InitConfiguration if schema not fount then return ErrSchemaNotFound if schema not found for ModuleConfig then return ErrSchemaNotFound also
type SettingsValues ¶
type SettingsValues map[string]interface{}
SettingsValues empty interface in needed to handle DeepCopy generation. DeepCopy does not work with unnamed empty interfaces
type TerraNodeGroupSpec ¶
type ValidateOption ¶
type ValidateOption func(o *validateOptions)
func ValidateOptionCommanderMode ¶
func ValidateOptionCommanderMode(v bool) ValidateOption
func ValidateOptionRequiredSSHHost ¶
func ValidateOptionRequiredSSHHost(v bool) ValidateOption
func ValidateOptionStrictUnmarshal ¶
func ValidateOptionStrictUnmarshal(v bool) ValidateOption
func ValidateOptionValidateExtensions ¶
func ValidateOptionValidateExtensions(v bool) ValidateOption
type ValidationError ¶
func (*ValidationError) Append ¶
func (v *ValidationError) Append(kind ErrorKind, e Error)
func (*ValidationError) Error ¶
func (v *ValidationError) Error() string
func (*ValidationError) ErrorOrNil ¶
func (v *ValidationError) ErrorOrNil() error