Skip to content

Commit

Permalink
Add ClusterClass variables to status on reconcile
Browse files Browse the repository at this point in the history
  • Loading branch information
killianmuldoon committed Jan 31, 2023
1 parent 14ffcb2 commit 15c89dd
Show file tree
Hide file tree
Showing 9 changed files with 454 additions and 18 deletions.
32 changes: 32 additions & 0 deletions api/v1beta1/clusterclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,10 @@ type LocalObjectTemplate struct {

// ClusterClassStatus defines the observed state of the ClusterClass.
type ClusterClassStatus struct {
// Variables is a list of ClusterClassStatusVariable that are defined for the ClusterClass.
// +optional
Variables []ClusterClassStatusVariable `json:"variables,omitempty"`

// Conditions defines current observed state of the ClusterClass.
// +optional
Conditions Conditions `json:"conditions,omitempty"`
Expand All @@ -562,6 +566,34 @@ type ClusterClassStatus struct {
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

// ClusterClassStatusVariable defines a variable which appears in the status of a ClusterClass.
type ClusterClassStatusVariable struct {
// Name is the name of the variable.
Name string `json:"name"`

// DefintionsConflict specifies whether or not there are conflicting definitions for a single variable name.
//+optional
DefintionsConflict bool `json:"defintionsConflict,omitempty"`

// Definitions is a list of definitions for a variable.
Definitions []ClusterClassStatusVariableDefinition `json:"definitions"`
}

// ClusterClassStatusVariableDefinition defines a variable which appears in the status of a ClusterClass.
type ClusterClassStatusVariableDefinition struct {
// From specifies the origin of the variable definition.
From string `json:"from"`

// Required specifies if the variable is required.
// Note: this applies to the variable as a whole and thus the
// top-level object defined in the schema. If nested fields are
// required, this will be specified inside the schema.
Required bool `json:"required"`

// Schema defines the schema of the variable.
Schema VariableSchema `json:"schema"`
}

// GetConditions returns the set of conditions for this object.
func (c *ClusterClass) GetConditions() Conditions {
return c.Status.Conditions
Expand Down
4 changes: 4 additions & 0 deletions api/v1beta1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ const (
// instead of being a source of truth for eventual consistency.
// This annotation can be used to inform MachinePool status during in-progress scaling scenarios.
ReplicasManagedByAnnotation = "cluster.x-k8s.io/replicas-managed-by"

// VariableDefinitionFromInline indicates a patch or variable was defined in the `.spec` of a ClusterClass
// rather than from an external patch extension.
VariableDefinitionFromInline = "inline"
)

const (
Expand Down
45 changes: 45 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

102 changes: 101 additions & 1 deletion api/v1beta1/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 15c89dd

Please sign in to comment.