Documentation ¶
Overview ¶
Package variables calculates variables for patching.
Index ¶
- Constants
- func ControlPlane(cpTopology *clusterv1.ControlPlaneTopology, ...) ([]runtimehooksv1.Variable, error)
- func GetVariableValue(variables map[string]apiextensionsv1.JSON, variablePath string) (*apiextensionsv1.JSON, error)
- func Global(clusterTopology *clusterv1.Topology, cluster *clusterv1.Cluster, ...) ([]runtimehooksv1.Variable, error)
- func IsNotFoundError(err error) bool
- func MachineDeployment(mdTopology *clusterv1.MachineDeploymentTopology, ...) ([]runtimehooksv1.Variable, error)
- func MachinePool(mpTopology *clusterv1.MachinePoolTopology, mp *expv1.MachinePool, ...) ([]runtimehooksv1.Variable, error)
- func MergeVariableMaps(variableMaps ...map[string]apiextensionsv1.JSON) (map[string]apiextensionsv1.JSON, error)
- func ToMap(variables []runtimehooksv1.Variable) map[string]apiextensionsv1.JSON
- type Builtins
- type ClusterBuiltins
- type ClusterNetworkBuiltins
- type ClusterTopologyBuiltins
- type ControlPlaneBuiltins
- type ControlPlaneMachineTemplateBuiltins
- type ControlPlaneMachineTemplateInfrastructureRefBuiltins
- type MachineBootstrapBuiltins
- type MachineBootstrapConfigRefBuiltins
- type MachineDeploymentBuiltins
- type MachineInfrastructureRefBuiltins
- type MachinePoolBuiltins
Constants ¶
const (
// BuiltinsName is the name of the builtin variable.
BuiltinsName = "builtin"
)
Variables ¶
This section is empty.
Functions ¶
func ControlPlane ¶
func ControlPlane(cpTopology *clusterv1.ControlPlaneTopology, cp, cpInfrastructureMachineTemplate *unstructured.Unstructured) ([]runtimehooksv1.Variable, error)
ControlPlane returns variables that apply to templates belonging to the ControlPlane.
func GetVariableValue ¶ added in v1.2.0
func GetVariableValue(variables map[string]apiextensionsv1.JSON, variablePath string) (*apiextensionsv1.JSON, error)
GetVariableValue returns a variable from the variables map.
func Global ¶
func Global(clusterTopology *clusterv1.Topology, cluster *clusterv1.Cluster, definitionFrom string, patchVariableDefinitions map[string]bool) ([]runtimehooksv1.Variable, error)
Global returns variables that apply to all the templates, including user provided variables and builtin variables for the Cluster object.
func IsNotFoundError ¶ added in v1.3.0
IsNotFoundError checks if the passed error is a notFoundError.
func MachineDeployment ¶
func MachineDeployment(mdTopology *clusterv1.MachineDeploymentTopology, md *clusterv1.MachineDeployment, mdBootstrapTemplate, mdInfrastructureMachineTemplate *unstructured.Unstructured, definitionFrom string, patchVariableDefinitions map[string]bool) ([]runtimehooksv1.Variable, error)
MachineDeployment returns variables that apply to templates belonging to a MachineDeployment.
func MachinePool ¶ added in v1.6.0
func MachinePool(mpTopology *clusterv1.MachinePoolTopology, mp *expv1.MachinePool, mpBootstrapObject, mpInfrastructureMachinePool *unstructured.Unstructured, definitionFrom string, patchVariableDefinitions map[string]bool) ([]runtimehooksv1.Variable, error)
MachinePool returns variables that apply to templates belonging to a MachinePool.
func MergeVariableMaps ¶ added in v1.2.0
func MergeVariableMaps(variableMaps ...map[string]apiextensionsv1.JSON) (map[string]apiextensionsv1.JSON, error)
MergeVariableMaps merges variables. This func is useful when merging global and template-specific variables. NOTE: In case a variable exists in multiple maps, the variable from the latter map is preserved. NOTE: The builtin variable object is merged instead of simply overwritten.
func ToMap ¶ added in v1.2.0
func ToMap(variables []runtimehooksv1.Variable) map[string]apiextensionsv1.JSON
ToMap converts a list of Variables to a map of JSON (name is the map key).
Types ¶
type Builtins ¶
type Builtins struct { Cluster *ClusterBuiltins `json:"cluster,omitempty"` ControlPlane *ControlPlaneBuiltins `json:"controlPlane,omitempty"` MachineDeployment *MachineDeploymentBuiltins `json:"machineDeployment,omitempty"` MachinePool *MachinePoolBuiltins `json:"machinePool,omitempty"` }
Builtins represents builtin variables exposed through patches.
type ClusterBuiltins ¶
type ClusterBuiltins struct { // Name is the name of the cluster. Name string `json:"name,omitempty"` // Namespace is the namespace of the cluster. Namespace string `json:"namespace,omitempty"` // Topology represents the cluster topology variables. Topology *ClusterTopologyBuiltins `json:"topology,omitempty"` // Network represents the cluster network variables. Network *ClusterNetworkBuiltins `json:"network,omitempty"` }
ClusterBuiltins represents builtin cluster variables.
type ClusterNetworkBuiltins ¶ added in v1.1.3
type ClusterNetworkBuiltins struct { // ServiceDomain is the domain name for services. ServiceDomain *string `json:"serviceDomain,omitempty"` // Services is the network ranges from which service VIPs are allocated. Services []string `json:"services,omitempty"` // Pods is the network ranges from which Pod networks are allocated. Pods []string `json:"pods,omitempty"` // IPFamily is the IPFamily the Cluster is operating in. One of Invalid, IPv4, IPv6, DualStack. // Note: IPFamily is not a concept in Kubernetes. It was originally introduced in CAPI for CAPD. // IPFamily may be dropped in a future release. More details at https://github.com/kubernetes-sigs/cluster-api/issues/7521 IPFamily string `json:"ipFamily,omitempty"` }
ClusterNetworkBuiltins represents builtin cluster network variables.
type ClusterTopologyBuiltins ¶
type ClusterTopologyBuiltins struct { // Version is the Kubernetes version of the Cluster. // NOTE: Please note that this version might temporarily differ from the version // of the ControlPlane or workers while an upgrade process is being orchestrated. Version string `json:"version,omitempty"` // Class is the name of the ClusterClass of the Cluster. Class string `json:"class,omitempty"` }
ClusterTopologyBuiltins represents builtin cluster topology variables.
type ControlPlaneBuiltins ¶
type ControlPlaneBuiltins struct { // Version is the Kubernetes version of the ControlPlane object. // NOTE: Please note that this version is the version we are currently reconciling towards. // It can differ from the current version of the ControlPlane while an upgrade process is // being orchestrated. Version string `json:"version,omitempty"` // Name is the name of the ControlPlane, // to which the current template belongs to. Name string `json:"name,omitempty"` // Replicas is the value of the replicas field of the ControlPlane object. Replicas *int64 `json:"replicas,omitempty"` // MachineTemplate is the value of the .spec.machineTemplate field of the ControlPlane object. MachineTemplate *ControlPlaneMachineTemplateBuiltins `json:"machineTemplate,omitempty"` }
ControlPlaneBuiltins represents builtin ControlPlane variables. NOTE: These variables are only set for templates belonging to the ControlPlane object.
type ControlPlaneMachineTemplateBuiltins ¶ added in v1.1.3
type ControlPlaneMachineTemplateBuiltins struct { // InfrastructureRef is the value of the infrastructureRef field of ControlPlane.spec.machineTemplate. InfrastructureRef ControlPlaneMachineTemplateInfrastructureRefBuiltins `json:"infrastructureRef,omitempty"` }
ControlPlaneMachineTemplateBuiltins is the value of the .spec.machineTemplate field of the ControlPlane object.
type ControlPlaneMachineTemplateInfrastructureRefBuiltins ¶ added in v1.1.3
type ControlPlaneMachineTemplateInfrastructureRefBuiltins struct { // Name of the infrastructureRef. Name string `json:"name,omitempty"` }
ControlPlaneMachineTemplateInfrastructureRefBuiltins is the value of the infrastructureRef field of ControlPlane.spec.machineTemplate.
type MachineBootstrapBuiltins ¶ added in v1.6.0
type MachineBootstrapBuiltins struct { // ConfigRef is the value of the .spec.template.spec.bootstrap.configRef field of the MachineDeployment. ConfigRef *MachineBootstrapConfigRefBuiltins `json:"configRef,omitempty"` }
MachineBootstrapBuiltins is the value of the .spec.template.spec.bootstrap field of the MachineDeployment or MachinePool.
type MachineBootstrapConfigRefBuiltins ¶ added in v1.6.0
type MachineBootstrapConfigRefBuiltins struct { // Name of the bootstrap.configRef. Name string `json:"name,omitempty"` }
MachineBootstrapConfigRefBuiltins is the value of the .spec.template.spec.bootstrap.configRef field of the MachineDeployment or MachinePool.
type MachineDeploymentBuiltins ¶
type MachineDeploymentBuiltins struct { // Version is the Kubernetes version of the MachineDeployment, // to which the current template belongs to. // NOTE: Please note that this version is the version we are currently reconciling towards. // It can differ from the current version of the MachineDeployment machines while an upgrade process is // being orchestrated. Version string `json:"version,omitempty"` // Class is the class name of the MachineDeployment, // to which the current template belongs to. Class string `json:"class,omitempty"` // Name is the name of the MachineDeployment, // to which the current template belongs to. Name string `json:"name,omitempty"` // TopologyName is the topology name of the MachineDeployment, // to which the current template belongs to. TopologyName string `json:"topologyName,omitempty"` // Replicas is the value of the replicas field of the MachineDeployment, // to which the current template belongs to. Replicas *int64 `json:"replicas,omitempty"` // Bootstrap is the value of the .spec.template.spec.bootstrap field of the MachineDeployment. Bootstrap *MachineBootstrapBuiltins `json:"bootstrap,omitempty"` // InfrastructureRef is the value of the .spec.template.spec.infrastructureRef field of the MachineDeployment. InfrastructureRef *MachineInfrastructureRefBuiltins `json:"infrastructureRef,omitempty"` }
MachineDeploymentBuiltins represents builtin MachineDeployment variables. NOTE: These variables are only set for templates belonging to a MachineDeployment.
type MachineInfrastructureRefBuiltins ¶ added in v1.6.0
type MachineInfrastructureRefBuiltins struct { // Name of the infrastructureRef. Name string `json:"name,omitempty"` }
MachineInfrastructureRefBuiltins is the value of the .spec.template.spec.infrastructureRef field of the MachineDeployment or MachinePool.
type MachinePoolBuiltins ¶ added in v1.6.0
type MachinePoolBuiltins struct { // Version is the Kubernetes version of the MachinePool, // to which the current template belongs to. // NOTE: Please note that this version is the version we are currently reconciling towards. // It can differ from the current version of the MachinePool machines while an upgrade process is // being orchestrated. Version string `json:"version,omitempty"` // Class is the class name of the MachinePool, // to which the current template belongs to. Class string `json:"class,omitempty"` // Name is the name of the MachinePool, // to which the current template belongs to. Name string `json:"name,omitempty"` // TopologyName is the topology name of the MachinePool, // to which the current template belongs to. TopologyName string `json:"topologyName,omitempty"` // Replicas is the value of the replicas field of the MachinePool, // to which the current template belongs to. Replicas *int64 `json:"replicas,omitempty"` // Bootstrap is the value of the .spec.template.spec.bootstrap field of the MachinePool. Bootstrap *MachineBootstrapBuiltins `json:"bootstrap,omitempty"` // InfrastructureRef is the value of the .spec.template.spec.infrastructureRef field of the MachinePool. InfrastructureRef *MachineInfrastructureRefBuiltins `json:"infrastructureRef,omitempty"` }
MachinePoolBuiltins represents builtin MachinePool variables. NOTE: These variables are only set for templates belonging to a MachinePool.