Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteZonesRule(oldRaw, newRaw json.RawMessage) error
- func GetIndexFromNodeName(name string) (int, error)
- func ParseBashibleConfig(path, specPath string) (map[string]interface{}, error)
- func ReadVersionTagFromInstallerContainer() (string, bool)
- func UpdateReplicasRule(oldRaw, newRaw json.RawMessage) error
- func ValidateClusterSettings(configData string) error
- func ValidateClusterSettingsChanges(phase phases.OperationPhase, oldSettings, newSettings string, ...) error
- func ValidateClusterSettingsFormat(settings string, opts ValidateOptions) error
- func ValidateDiscoveryData(config *[]byte, paths ...string) (bool, error)
- type ClusterConfigCloudSpec
- type DeckhouseClusterConfig
- type DeckhouseInstaller
- type MasterNodeGroupSpec
- type MetaConfig
- func LoadConfigFromFile(path string) (*MetaConfig, error)
- func ParseConfig(path string) (*MetaConfig, error)
- func ParseConfigFromCluster(kubeCl *client.KubernetesClient) (*MetaConfig, error)
- func ParseConfigFromData(configData string) (*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 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) (*SchemaIndex, error)
- func (s *SchemaStore) ValidateWithIndex(index *SchemaIndex, doc *[]byte) error
- type SettingsValues
- type TerraNodeGroupSpec
- type ValidateOptions
- type ValidationRule
Constants ¶
const ( DefaultBundle = "Default" DefaultLogLevel = "Info" )
const ( ModuleConfigKind = "ModuleConfig" ModuleConfigResource = "moduleconfigs" ModuleConfigGroup = "deckhouse.io" ModuleConfigVersion = "v1alpha1" )
const ( CloudClusterType = "Cloud" StaticClusterType = "Static" )
const (
// don't forget to update the version in release requirements (release.yaml)
DefaultKubernetesVersion = "1.25"
)
Variables ¶
var ( ErrUnsafeFieldChanged = errors.New("unsafe field has been changed") ErrConfigAmountChanged = errors.New("cannot change amount of cluster configuration yamls") 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 UpdateReplicasRule ¶
func UpdateReplicasRule(oldRaw, newRaw json.RawMessage) error
func ValidateClusterSettings ¶
ValidateClusterSettings parses and validates cluster configuration and resources. It checks the cluster configuration yamls for compliance with the yaml format and schema. Non-config resources are checked only for compliance with the yaml format and the validity of apiVersion and kind fields. It can be used as an imported functionality in external modules.
func ValidateClusterSettingsChanges ¶
func ValidateClusterSettingsChanges( phase phases.OperationPhase, oldSettings, newSettings string, opts ValidateOptions, ) 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 ValidateClusterSettingsFormat ¶
func ValidateClusterSettingsFormat(settings string, opts ValidateOptions) error
ValidateClusterSettingsFormat parses and validates cluster configuration and resources. It checks the cluster configuration yamls for compliance with the yaml format and schema. Non-config resources are checked only for compliance with the yaml format and the validity of apiVersion and kind fields. It can be used as an imported functionality in external modules.
Types ¶
type ClusterConfigCloudSpec ¶
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 }
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:"-"` }
func LoadConfigFromFile ¶
func LoadConfigFromFile(path string) (*MetaConfig, error)
func ParseConfig ¶
func ParseConfig(path string) (*MetaConfig, error)
func ParseConfigFromCluster ¶
func ParseConfigFromCluster(kubeCl *client.KubernetesClient) (*MetaConfig, error)
func ParseConfigFromData ¶
func ParseConfigFromData(configData string) (*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 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) (*SchemaIndex, error)
func (*SchemaStore) ValidateWithIndex ¶
func (s *SchemaStore) ValidateWithIndex(index *SchemaIndex, doc *[]byte) error
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 ValidateOptions ¶
type ValidateOptions struct {
CommanderMode bool
}
type ValidationRule ¶
type ValidationRule func(oldValue, newValue json.RawMessage) error