Documentation
¶
Index ¶
Constants ¶
const XGrant = "x-deckhouse-grantable-resource"
XGrant is the OpenAPI extension key that binds a settings field to a grantable cluster resource (see multitenancy-manager AvailableClusterResource). A field carrying this extension is defaulted to the project's default granted name when left empty, and its value is checked against the project's available names.
Variables ¶
This section is empty.
Functions ¶
func YAMLDocLoader ¶
YAMLDocLoader loads a yaml document from either http or a file and converts it to json.
Types ¶
type GrantRef ¶ added in v1.77.0
type GrantRef struct {
// Path is the property path to the field, from the schema root, e.g.
// ["storageClass"] or ["postgres", "storageClass"].
Path []string
// Resource is the grantable resource name from the extension.
Resource string
}
GrantRef is a single field in a schema that references a grantable cluster resource via the x-deckhouse-grantable-resource extension.
func CollectGrantRefs ¶ added in v1.77.0
CollectGrantRefs walks the schema properties recursively and returns every field that carries the x-deckhouse-grantable-resource extension. It validates that each such field is of type string and has a non-empty resource value.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage holds compiled OpenAPI schemas for a package, keyed by Type. All schemas are pre-processed and ready for repeated validation calls.
func NewStorage ¶
NewStorage parses settings and values YAML schema documents, applies the required transformations, and returns a Storage ready for use.
func (*Storage) GrantRefs ¶ added in v1.77.0
GrantRefs returns all x-deckhouse-grantable-resource references declared in the settings schema. It returns nil when no settings schema is registered.
func (*Storage) Validate ¶
Validate validates values against the schema registered for valuesType. It extracts the value under root and runs both CEL rule checks and JSON-Schema validation. Transition rules referencing oldSelf are skipped because no previous values are provided; use ValidateTransition for that. Returns nil if no schema is registered for valuesType.
func (*Storage) ValidateTransition ¶
func (s *Storage) ValidateTransition(valuesType Type, root string, values, oldValues utils.Values) error
ValidateTransition is like Validate but additionally accepts the previously stored values, enabling x-deckhouse-validations transition rules (rules that reference oldSelf) to fire on updates. Pass oldValues=nil for the initial create / when previous values are not available.
type Type ¶
type Type string
Type identifies which schema variant is used for a given validation context.
const ( // TypeSettings is the schema for user-supplied configuration values (config.yaml). TypeSettings Type = "config" // TypeValues is the schema for the full set of internal module values. TypeValues Type = "values" // TypeHelm is derived from TypeValues with x-required-for-helm fields promoted to // required, making those fields mandatory during Helm chart rendering. TypeHelm Type = "helm" )