Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cc mp reconcile #60

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/v1alpha4/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ func (src *ClusterClass) ConvertTo(dstRaw conversion.Hub) error {
dst.Spec.Workers.MachineDeployments[i].Strategy = restored.Spec.Workers.MachineDeployments[i].Strategy
}

dst.Spec.Workers.MachinePools = restored.Spec.Workers.MachinePools

dst.Status = restored.Status

return nil
Expand Down
6 changes: 3 additions & 3 deletions api/v1beta1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,10 @@ type MachinePoolTopology struct {
// the values are hashed together.
Name string `json:"name"`

// FailureDomains is the list of failure domains the machine pool will be created in.
// Must match a key in the FailureDomains map stored on the cluster object.
// FailureDomain is the failure domain the machine pools will be created in.
// Must match a key in the FailureDomain map stored on the cluster object.
// +optional
FailureDomains []string `json:"failureDomains,omitempty"`
FailureDomain *string `json:"failureDomain,omitempty"`

// NodeDrainTimeout is the total amount of time that the controller will spend on draining a node.
// The default value is 0, meaning that the node can be drained without any time limitations.
Expand Down
8 changes: 4 additions & 4 deletions api/v1beta1/clusterclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ type MachineDeploymentClass struct {
MachineHealthCheck *MachineHealthCheckClass `json:"machineHealthCheck,omitempty"`

// FailureDomain is the failure domain the machines will be created in.
// Must match a key in the FailureDomains map stored on the cluster object.
// Must match a key in the FailureDomain map stored on the cluster object.
// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
// +optional
FailureDomain *string `json:"failureDomain,omitempty"`
Expand Down Expand Up @@ -261,11 +261,11 @@ type MachinePoolClass struct {
// MachinePools objects representing a pool of worker nodes.
Template MachinePoolClassTemplate `json:"template"`

// FailureDomains is the list of failure domains the MachinePool should be attached to.
// Must match a key in the FailureDomains map stored on the cluster object.
// FailureDomain is the failure domain the machine pools will be created in.
// Must match a key in the FailureDomain map stored on the cluster object.
// NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass.
// +optional
FailureDomains []string `json:"failureDomains,omitempty"`
FailureDomain *string `json:"failureDomain,omitempty"`

// NodeDrainTimeout is the total amount of time that the controller will spend on draining a node.
// The default value is 0, meaning that the node can be drained without any time limitations.
Expand Down
12 changes: 12 additions & 0 deletions api/v1beta1/condition_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,18 @@ const (
// not yet completed because the upgrade for at least one of the MachineDeployments has been deferred.
TopologyReconciledMachineDeploymentsUpgradeDeferredReason = "MachineDeploymentsUpgradeDeferred"

// TopologyReconciledMachinePoolsUpgradePendingReason (Severity=Info) documents reconciliation of a Cluster topology
// not yet completed because at least one of the MachinePools is not yet updated to match the desired topology spec.
TopologyReconciledMachinePoolsUpgradePendingReason = "MachinePoolsUpgradePending"

// TopologyReconciledMachinePoolsCreatePendingReason (Severity=Info) documents reconciliation of a Cluster topology
// not yet completed because at least one of the MachinePools is yet to be created.
TopologyReconciledMachinePoolsCreatePendingReason = "MachinePoolsCreatePending"

// TopologyReconciledMachinePoolsUpgradeDeferredReason (Severity=Info) documents reconciliation of a Cluster topology
// not yet completed because the upgrade for at least one of the MachinePools has been deferred.
TopologyReconciledMachinePoolsUpgradeDeferredReason = "MachinePoolsUpgradeDeferred"

// TopologyReconciledHookBlockingReason (Severity=Info) documents reconciliation of a Cluster topology
// not yet completed because at least one of the lifecycle hooks is blocking.
TopologyReconciledHookBlockingReason = "LifecycleHookBlocking"
Expand Down
16 changes: 8 additions & 8 deletions api/v1beta1/zz_generated.deepcopy.go

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

34 changes: 9 additions & 25 deletions api/v1beta1/zz_generated.openapi.go

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

11 changes: 11 additions & 0 deletions cmd/clusterctl/client/cluster/topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,17 @@ func clusterClassUsesTemplate(cc *clusterv1.ClusterClass, templateRef *corev1.Ob
}
}

for _, mpClass := range cc.Spec.Workers.MachinePools {
// Check the bootstrap ref
if equalRef(mpClass.Template.Bootstrap.Ref, templateRef) {
return true
}
// Check the infrastructure ref.
if equalRef(mpClass.Template.Infrastructure.Ref, templateRef) {
return true
}
}

return false
}

Expand Down
18 changes: 8 additions & 10 deletions config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml

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

13 changes: 5 additions & 8 deletions config/crd/bases/cluster.x-k8s.io_clusters.yaml

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

47 changes: 47 additions & 0 deletions config/crd/bases/cluster.x-k8s.io_machinepools.yaml

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

4 changes: 4 additions & 0 deletions exp/api/v1alpha3/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ func Convert_v1alpha3_MachinePool_To_v1beta1_MachinePool(in *MachinePool, out *e
return nil
}

func Convert_v1beta1_MachinePoolSpec_To_v1alpha3_MachinePoolSpec(in *expv1.MachinePoolSpec, out *MachinePoolSpec, s apimachineryconversion.Scope) error {
return autoConvert_v1beta1_MachinePoolSpec_To_v1alpha3_MachinePoolSpec(in, out, s)
}

func Convert_v1beta1_MachinePool_To_v1alpha3_MachinePool(in *expv1.MachinePool, out *MachinePool, s apimachineryconversion.Scope) error {
if err := autoConvert_v1beta1_MachinePool_To_v1alpha3_MachinePool(in, out, s); err != nil {
return err
Expand Down
16 changes: 6 additions & 10 deletions exp/api/v1alpha3/zz_generated.conversion.go

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

6 changes: 6 additions & 0 deletions exp/api/v1alpha4/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@ limitations under the License.
package v1alpha4

import (
apimachineryconversion "k8s.io/apimachinery/pkg/conversion"
"sigs.k8s.io/controller-runtime/pkg/conversion"

expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1"
v1beta1 "sigs.k8s.io/cluster-api/exp/api/v1beta1"
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
)

func Convert_v1beta1_MachinePoolSpec_To_v1alpha4_MachinePoolSpec(in *v1beta1.MachinePoolSpec, out *MachinePoolSpec, s apimachineryconversion.Scope) error {
return autoConvert_v1beta1_MachinePoolSpec_To_v1alpha4_MachinePoolSpec(in, out, s)
}

func (src *MachinePool) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*expv1.MachinePool)

Expand Down
Loading