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 24, 2023
1 parent aef77c3 commit c232f78
Show file tree
Hide file tree
Showing 7 changed files with 441 additions and 1 deletion.
32 changes: 32 additions & 0 deletions api/v1beta1/clusterclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,43 @@ 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"`
}

// 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"`

// RequiresNamespace specifies whether or not a variable must be addressed by namespace when a value is provided for
// it in a Cluster.
RequiresNamespace bool `json:"requiresNamespace"`

// Definitions is a list of variables with a schema for each namespace the variable is defined in.
Definitions []ClusterClassStatusVariableDefinition `json:"definitions"`
}

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

// 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"

// VariableNamespaceInline is a namespace that indicates a patch or variable was defined in the `.spec` of a ClusterClass
// rather than being generated externally.
VariableNamespaceInline = "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.

103 changes: 102 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 c232f78

Please sign in to comment.