Documentation
¶
Index ¶
- Constants
- Variables
- type CommentStyle
- type ComponentRequirement
- type ComponentType
- type ConversionsRule
- type DeckhouseModule
- type DefinitionFileRule
- type EnabledScriptRule
- type FileTypeConfig
- type HelmignoreRule
- type LayoutRule
- type LegacyReleaseFileRule
- type License
- type LicenseInfo
- type LicenseParser
- type LicenseRule
- type ModuleAccessibility
- type ModuleDescriptions
- type ModuleDisable
- type ModuleDisableMessages
- type ModuleEdition
- type ModulePackage
- type ModulePackageConsistencyRule
- type ModulePlatformRequirements
- type ModuleRequirements
- type ModuleUpdate
- type ModuleUpdateVersion
- type OSSRule
- type PackageAnyOfRequirement
- type PackageModuleRequirement
- type PackageModulesRequirements
- type PackageRequirements
- type PackageSubscribe
- type PackageSubscribeValue
- type PackageVersionRequirement
- type PackageYAMLRule
- type RequirementCheck
- type RequirementsRegistry
- type RequirementsRule
Constants ¶
const ( ReleaseLayoutRuleName = "release-layout" BundleLayoutRuleName = "bundle-layout" )
const ( PackageYAMLRuleName = "package-yaml" PackageConfigFilename = "package.yaml" MinimalDeckhouseVersionForPackageRequirements = "1.77.0" )
const ( RequirementsRuleName = "requirements" // MinimalDeckhouseVersionForStage defines the minimum required Deckhouse version for stage usage MinimalDeckhouseVersionForStage = "1.68.0" // MinimalDeckhouseVersionForGoHooks defines the minimum required Deckhouse version for Go hooks usage MinimalDeckhouseVersionForGoHooks = "1.68.0" // MinimalDeckhouseVersionForReadinessProbes defines the minimum required Deckhouse version for readiness probes usage MinimalDeckhouseVersionForReadinessProbes = "1.71.0" // MinimalDeckhouseVersionForOptionalModules defines the minimum required Deckhouse version for optional modules usage MinimalDeckhouseVersionForOptionalModules = "1.73.0" // MinimalModuleSDKVersionRequiresDeckhouse171 defines the minimum module-sdk version that requires Deckhouse >= 1.71 MinimalModuleSDKVersionRequiresDeckhouse171 = "0.3.0" // MinimalDeckhouseVersionForModuleSDK03 defines the minimum Deckhouse version required for Module-SDK >= 0.3 MinimalDeckhouseVersionForModuleSDK03 = "1.71.0" // MinimalDeckhouseVersionForWeightDeprecation defines the version where weight became irrelevant for non-critical modules MinimalDeckhouseVersionForWeightDeprecation = "1.72.0" // MinimalDeckhouseVersionForBootstrappedDeprecation defines the version where bootstrapped was deprecated MinimalDeckhouseVersionForBootstrappedDeprecation = "1.72.0" // ExternalModuleWeightMin and ExternalModuleWeightMax bound the weight that // Deckhouse requires for external (non-critical) modules on versions where // weight is still meaningful (< MinimalDeckhouseVersionForWeightDeprecation). // Those versions reject an out-of-range weight with // "external module weight must be between 900 and 999". ExternalModuleWeightMin uint32 = 900 ExternalModuleWeightMax uint32 = 999 // Common patterns used in Go files AppRunPattern = `\w+\.Run\(` )
const (
ConversionsRuleName = "conversions"
)
const (
DefinitionFileRuleName = "definition-file"
)
const (
EnabledScriptRuleName = "enabled-script"
)
const (
HelmignoreRuleName = "helmignore"
)
const (
LegacyReleaseFileRuleName = "legacy-release-file"
)
const (
LicenseRuleName = "license"
)
const (
ModuleConfigFilename = "module.yaml"
)
const ModulePackageConsistencyRuleName = "module-package-consistency"
const (
OSSRuleName = "oss"
)
Variables ¶
var ErrUnsupportedFileType = fmt.Errorf("unsupported file type")
var ValidBundles = []string{
"Minimal",
"Managed",
"Default",
}
Valid bundle values
var ValidEditions = []string{
"ce",
"fe",
"ee",
"se",
"se-plus",
"be",
"cse",
"_default",
}
Valid edition values
Functions ¶
This section is empty.
Types ¶
type CommentStyle ¶ added in v0.1.41
type CommentStyle struct {
LinePrefix string // Prefix for single-line comments (e.g., "//", "#")
BlockStart string // Start of block comment (e.g., "/*", "<!--")
BlockEnd string // End of block comment (e.g., "*/", "-->")
BlockLine string // Optional prefix for lines within block (e.g., " * ")
}
CommentStyle defines how comments are formatted in different file types
type ComponentRequirement ¶ added in v0.1.30
type ComponentRequirement struct {
ComponentType ComponentType
MinVersion string
Description string
}
ComponentRequirement defines a requirement for a specific component
type ComponentType ¶ added in v0.1.30
type ComponentType string
ComponentType represents the type of component for requirements validation
const ( ComponentDeckhouse ComponentType = "deckhouse" ComponentK8s ComponentType = "kubernetes" ComponentModule ComponentType = "module" )
type ConversionsRule ¶
func NewConversionsRule ¶
func NewConversionsRule(disable bool, m pkg.Module, errorList *errors.LintRuleErrorsList) *ConversionsRule
func (*ConversionsRule) Check ¶ added in v0.2.0
func (r *ConversionsRule) Check(_ context.Context)
type DeckhouseModule ¶
type DeckhouseModule struct {
Name string `json:"name"`
Critical bool `json:"critical,omitempty"`
Namespace string `json:"namespace"`
Weight uint32 `json:"weight,omitempty"`
Tags []string `json:"tags"`
Subsystems []string `json:"subsystems,omitempty"`
Stage string `json:"stage"`
Description string `json:"description,omitempty"`
ExclusiveGroup string `json:"exclusiveGroup,omitempty"`
Descriptions ModuleDescriptions `json:"descriptions,omitempty"`
Requirements *ModuleRequirements `json:"requirements,omitempty"`
Accessibility *ModuleAccessibility `json:"accessibility,omitempty"`
Update *ModuleUpdate `json:"update,omitempty"`
Disable *ModuleDisable `json:"disable,omitempty"`
}
type DefinitionFileRule ¶
type DefinitionFileRule struct {
pkg.RuleMeta
pkg.BoolRule
// contains filtered or unexported fields
}
func NewDefinitionFileRule ¶
func NewDefinitionFileRule(disable bool, m pkg.Module, errorList *errors.LintRuleErrorsList) *DefinitionFileRule
func (*DefinitionFileRule) Check ¶ added in v0.2.0
func (r *DefinitionFileRule) Check(_ context.Context)
type EnabledScriptRule ¶ added in v0.1.99
func NewEnabledScriptRule ¶ added in v0.1.99
func NewEnabledScriptRule(m pkg.Module, errorList *errors.LintRuleErrorsList) *EnabledScriptRule
func (*EnabledScriptRule) Check ¶ added in v0.2.0
func (r *EnabledScriptRule) Check(_ context.Context)
type FileTypeConfig ¶ added in v0.1.41
type FileTypeConfig struct {
Extensions []string // File extensions (e.g., ".go", ".py")
CommentStyles []CommentStyle // Supported comment styles
}
FileTypeConfig defines comment styles for specific file types
type HelmignoreRule ¶ added in v0.1.28
func NewHelmignoreRule ¶ added in v0.1.28
func NewHelmignoreRule(disable bool, m pkg.Module, errorList *errors.LintRuleErrorsList) *HelmignoreRule
func (*HelmignoreRule) Check ¶ added in v0.2.0
func (r *HelmignoreRule) Check(_ context.Context)
type LayoutRule ¶ added in v0.2.4
LayoutRule reports the files and directories a built image is missing from its package root.
It exists as its own rule rather than as a flag on the rules that parse those files because presence is a property of the scope, not of the file: a source tree may legitimately lack version.json, an image may not. The parsing rules therefore keep returning quietly when a file is absent, and this rule is what the release and bundle scopes ask for to make the absence a finding.
func NewBundleLayoutRule ¶ added in v0.2.4
func NewBundleLayoutRule(m pkg.Module, errorList *errors.LintRuleErrorsList) *LayoutRule
NewBundleLayoutRule checks the root of a bundle image, which carries the whole packaged module — chart, templates and docs included.
The list is what a published bundle actually holds, which is not what its source tree holds: changelog.yaml and version.json ship in the sibling release image, and the ignore file the package carries is .helmignore, not .gitignore.
It is the intersection of eight published CE bundles, not every path they carry — crds/, hooks/, monitoring/ and .werf/ appear in some and not others, so requiring any of them would fail the modules that legitimately have nothing to put there.
func NewReleaseLayoutRule ¶ added in v0.2.4
func NewReleaseLayoutRule(m pkg.Module, errorList *errors.LintRuleErrorsList) *LayoutRule
NewReleaseLayoutRule checks the root of a release image, which carries only the metadata Deckhouse reads to decide whether to install the version.
func (*LayoutRule) Check ¶ added in v0.2.4
func (r *LayoutRule) Check(_ context.Context)
type LegacyReleaseFileRule ¶ added in v0.1.42
func NewLegacyReleaseFileRule ¶ added in v0.1.42
func NewLegacyReleaseFileRule(m pkg.Module, errorList *errors.LintRuleErrorsList) *LegacyReleaseFileRule
func (*LegacyReleaseFileRule) Check ¶ added in v0.2.0
func (r *LegacyReleaseFileRule) Check(_ context.Context)
type License ¶ added in v0.1.41
type License struct {
Type string // "CE" or "EE"
Name string // Human-readable name
Template string // License template with {{YEAR}} placeholder
YearPattern string // Regex pattern for year validation
}
License represents a license type with its template
type LicenseInfo ¶ added in v0.1.41
LicenseInfo contains information about parsed license
type LicenseParser ¶ added in v0.1.41
type LicenseParser struct {
// contains filtered or unexported fields
}
LicenseParser handles license parsing and validation
func NewLicenseParser ¶ added in v0.1.41
func NewLicenseParser() *LicenseParser
NewLicenseParser creates a new license parser with default configuration
func (*LicenseParser) ParseFile ¶ added in v0.1.41
func (p *LicenseParser) ParseFile(filename string) (*LicenseInfo, error)
ParseFile parses a file and extracts license information
type LicenseRule ¶ added in v0.1.3
func NewLicenseRule ¶ added in v0.1.3
func NewLicenseRule(excludeFilesRules []pkg.StringRuleExclude, excludeDirectoryRules []pkg.DirectoryRuleExclude, m pkg.Module, errorList *pkgerrors.LintRuleErrorsList) *LicenseRule
func (*LicenseRule) Check ¶ added in v0.2.0
func (r *LicenseRule) Check(_ context.Context)
type ModuleAccessibility ¶ added in v0.1.33
type ModuleAccessibility struct {
Editions map[string]ModuleEdition `json:"editions"`
}
type ModuleDescriptions ¶ added in v0.1.4
type ModuleDisable ¶ added in v0.1.89
type ModuleDisable struct {
Confirmation bool `json:"confirmation,omitempty"`
Message string `json:"message,omitempty"`
Messages ModuleDisableMessages `json:"messages,omitempty"`
}
type ModuleDisableMessages ¶ added in v0.1.89
type ModuleEdition ¶ added in v0.1.33
type ModulePackage ¶ added in v0.1.75
type ModulePackage struct {
APIVersion string `json:"apiVersion,omitempty"`
Name string `json:"name,omitempty"`
Requirements *PackageRequirements `json:"requirements,omitempty"`
Subscribe *PackageSubscribe `json:"subscribe,omitempty"`
}
ModulePackage describes package.yaml fields used by module lint rules.
type ModulePackageConsistencyRule ¶ added in v0.1.75
ModulePackageConsistencyRule checks that module.yaml and package.yaml do not diverge when both files exist in the module directory.
func NewModulePackageConsistencyRule ¶ added in v0.1.75
func NewModulePackageConsistencyRule(m pkg.Module, errorList *errors.LintRuleErrorsList) *ModulePackageConsistencyRule
NewModulePackageConsistencyRule creates a rule for cross-validating module.yaml against package.yaml.
func (*ModulePackageConsistencyRule) Check ¶ added in v0.2.0
func (r *ModulePackageConsistencyRule) Check(_ context.Context)
type ModuleRequirements ¶
type ModuleRequirements struct {
ModulePlatformRequirements `json:",inline"`
ParentModules map[string]string `json:"modules,omitempty"`
}
type ModuleUpdate ¶ added in v0.1.36
type ModuleUpdate struct {
Versions []ModuleUpdateVersion `json:"versions,omitempty"`
}
type ModuleUpdateVersion ¶ added in v0.1.36
type OSSRule ¶
func NewOSSRule ¶
func NewOSSRule(disable bool, versionNotSemverExclude []pkg.StringRuleExclude, m pkg.Module, errorList *errors.LintRuleErrorsList) *OSSRule
NewOSSRule creates an OSS attribution rule instance.
type PackageAnyOfRequirement ¶ added in v0.1.75
type PackageAnyOfRequirement struct {
Description string `json:"description,omitempty"`
Modules []PackageModuleRequirement `json:"modules,omitempty"`
}
PackageAnyOfRequirement describes an anyOf module dependency group.
type PackageModuleRequirement ¶ added in v0.1.75
type PackageModuleRequirement struct {
Name string `json:"name,omitempty"`
Constraint string `json:"constraint,omitempty"`
}
PackageModuleRequirement describes a package.yaml module dependency.
type PackageModulesRequirements ¶ added in v0.1.75
type PackageModulesRequirements struct {
Mandatory []PackageModuleRequirement `json:"mandatory,omitempty"`
Conditional []PackageModuleRequirement `json:"conditional,omitempty"`
AnyOf []PackageAnyOfRequirement `json:"anyOf,omitempty"`
}
PackageModulesRequirements describes package.yaml module dependency groups.
type PackageRequirements ¶ added in v0.1.75
type PackageRequirements struct {
Kubernetes PackageVersionRequirement `json:"kubernetes,omitempty"`
Deckhouse PackageVersionRequirement `json:"deckhouse,omitempty"`
Modules PackageModulesRequirements `json:"modules,omitempty"`
}
PackageRequirements describes package.yaml requirements.
type PackageSubscribe ¶ added in v0.1.75
type PackageSubscribe struct {
APIs []string `json:"apis,omitempty"`
Values []PackageSubscribeValue `json:"values,omitempty"`
}
PackageSubscribe describes package.yaml subscribe settings.
type PackageSubscribeValue ¶ added in v0.1.75
type PackageSubscribeValue struct {
Module string `json:"module,omitempty"`
Value string `json:"value,omitempty"`
}
PackageSubscribeValue describes a subscribed module value.
type PackageVersionRequirement ¶ added in v0.1.75
type PackageVersionRequirement struct {
Constraint string `json:"constraint,omitempty"`
}
PackageVersionRequirement describes a version constraint requirement.
type PackageYAMLRule ¶ added in v0.1.75
PackageYAMLRule validates the module package.yaml file.
func NewPackageYAMLRule ¶ added in v0.1.75
func NewPackageYAMLRule(m pkg.Module, errorList *errors.LintRuleErrorsList) *PackageYAMLRule
NewPackageYAMLRule creates a rule for validating package.yaml.
func (*PackageYAMLRule) Check ¶ added in v0.2.0
func (r *PackageYAMLRule) Check(_ context.Context)
type RequirementCheck ¶ added in v0.1.30
type RequirementCheck struct {
Name string
Requirements []ComponentRequirement
Description string
Detector func(modulePath string, module *DeckhouseModule) bool
}
RequirementCheck defines a single requirement check configuration. Detector returns true if the check should be applied to the module. When Requirements is non-empty, validateRequirement verifies version constraints. When Requirements is empty, the Description is emitted as the error.
type RequirementsRegistry ¶ added in v0.1.30
type RequirementsRegistry struct {
// contains filtered or unexported fields
}
RequirementsRegistry holds all requirement checks
func NewRequirementsRegistry ¶ added in v0.1.30
func NewRequirementsRegistry() *RequirementsRegistry
NewRequirementsRegistry creates a new registry with default checks
func (*RequirementsRegistry) RegisterCheck ¶ added in v0.1.30
func (r *RequirementsRegistry) RegisterCheck(check RequirementCheck)
RegisterCheck adds a new requirement check to the registry
func (*RequirementsRegistry) RunAllChecks ¶ added in v0.1.30
func (r *RequirementsRegistry) RunAllChecks(modulePath string, module *DeckhouseModule, errorList *errors.LintRuleErrorsList)
RunAllChecks executes all registered requirement checks.
type RequirementsRule ¶ added in v0.1.30
func NewRequirementsRule ¶ added in v0.1.30
func NewRequirementsRule(m pkg.Module, errorList *errors.LintRuleErrorsList) *RequirementsRule
func (*RequirementsRule) Check ¶ added in v0.2.0
func (r *RequirementsRule) Check(_ context.Context)