Skip to content

Commit e9a7318

Browse files
authored
Merge pull request #7991 from killianmuldoon/pr-exvars-cc-status-var
🌱 Add ClusterClass variables to status on reconcile
2 parents eb808f2 + 0118e20 commit e9a7318

File tree

9 files changed

+459
-18
lines changed

9 files changed

+459
-18
lines changed

api/v1beta1/clusterclass_types.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,10 @@ type LocalObjectTemplate struct {
553553

554554
// ClusterClassStatus defines the observed state of the ClusterClass.
555555
type ClusterClassStatus struct {
556+
// Variables is a list of ClusterClassStatusVariable that are defined for the ClusterClass.
557+
// +optional
558+
Variables []ClusterClassStatusVariable `json:"variables,omitempty"`
559+
556560
// Conditions defines current observed state of the ClusterClass.
557561
// +optional
558562
Conditions Conditions `json:"conditions,omitempty"`
@@ -562,6 +566,36 @@ type ClusterClassStatus struct {
562566
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
563567
}
564568

569+
// ClusterClassStatusVariable defines a variable which appears in the status of a ClusterClass.
570+
type ClusterClassStatusVariable struct {
571+
// Name is the name of the variable.
572+
Name string `json:"name"`
573+
574+
// DefintionsConflict specifies whether or not there are conflicting definitions for a single variable name.
575+
// +optional
576+
DefintionsConflict bool `json:"defintionsConflict,omitempty"`
577+
578+
// Definitions is a list of definitions for a variable.
579+
Definitions []ClusterClassStatusVariableDefinition `json:"definitions"`
580+
}
581+
582+
// ClusterClassStatusVariableDefinition defines a variable which appears in the status of a ClusterClass.
583+
type ClusterClassStatusVariableDefinition struct {
584+
// From specifies the origin of the variable definition.
585+
// This will be `inline` for variables defined in the ClusterClass or the name of a patch defined in the ClusterClass
586+
// for variables discovered from a DiscoverVariables runtime extensions.
587+
From string `json:"from"`
588+
589+
// Required specifies if the variable is required.
590+
// Note: this applies to the variable as a whole and thus the
591+
// top-level object defined in the schema. If nested fields are
592+
// required, this will be specified inside the schema.
593+
Required bool `json:"required"`
594+
595+
// Schema defines the schema of the variable.
596+
Schema VariableSchema `json:"schema"`
597+
}
598+
565599
// GetConditions returns the set of conditions for this object.
566600
func (c *ClusterClass) GetConditions() Conditions {
567601
return c.Status.Conditions

api/v1beta1/common_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ const (
120120
// instead of being a source of truth for eventual consistency.
121121
// This annotation can be used to inform MachinePool status during in-progress scaling scenarios.
122122
ReplicasManagedByAnnotation = "cluster.x-k8s.io/replicas-managed-by"
123+
124+
// VariableDefinitionFromInline indicates a patch or variable was defined in the `.spec` of a ClusterClass
125+
// rather than from an external patch extension.
126+
VariableDefinitionFromInline = "inline"
123127
)
124128

125129
const (

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta1/zz_generated.openapi.go

Lines changed: 101 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)