Skip to content
Merged
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
11 changes: 9 additions & 2 deletions api/v1alpha1/hostedcontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
//+kubebuilder:resource:path=hostedcontrolplanes,scope=Namespaced,categories=cluster-api,shortName=hcp
//+kubebuilder:subresource:status
//+kubebuilder:storageversion
//+kubebuilder:printcolumn:name="Initialized",type=boolean,JSONPath=`.status.initialized`
//+kubebuilder:printcolumn:name="Initialized",type=boolean,JSONPath=`.status.initialization.controlPlaneInitialized`
//+kubebuilder:printcolumn:name="API Server Available",type=string,JSONPath=`.status.conditions[?(@.type == "Ready")].status`
//+kubebuilder:printcolumn:name="Replicas",type=integer,JSONPath=`.spec.replicas`
//+kubebuilder:printcolumn:name="Ready",type=integer,JSONPath=`.status.readyReplicas`
Expand Down Expand Up @@ -243,6 +243,8 @@ type HostedControlPlaneStatus struct {
//+kubebuilder:validation:Optional
UpdatedReplicas int32 `json:"updatedReplicas,omitempty"`
//+kubebuilder:validation:Optional
UpToDateReplicas int32 `json:"upToDateReplicas,omitempty"`
//+kubebuilder:validation:Optional
ReadyReplicas int32 `json:"readyReplicas,omitempty"`
//+kubebuilder:validation:Optional
UnavailableReplicas int32 `json:"unavailableReplicas,omitempty"`
Expand All @@ -251,14 +253,19 @@ type HostedControlPlaneStatus struct {
// https://cluster-api.sigs.k8s.io/developer/providers/contracts/control-plane

//+kubebuilder:validation:Optional
Initialized bool `json:"initialized"`
Initialization HostedControlPlaneInitializationStatus `json:"initialization,omitempty"`
//+kubebuilder:validation:Optional
Ready bool `json:"ready"`
//+kubebuilder:validation:Optional
Version string `json:"version,omitempty"`
ExternalManagedControlPlane *bool `json:"externalManagedControlPlane"`
}

type HostedControlPlaneInitializationStatus struct {
//+kubebuilder:validation:Optional
ControlPlaneInitialized *bool `json:"controlPlaneInitialized,omitempty"`
}

//+kubebuilder:object:root=true

type HostedControlPlaneList struct {
Expand Down
21 changes: 21 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion pkg/hostedcontrolplane/lifecycle_phases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,7 @@ func TestHostedControlPlane_FullLifecycle(t *testing.T) {
return condition.Type != capiv2.PausedCondition && condition.Status != metav1.ConditionTrue
})).To(BeEmpty())
g.Expect(hcp.Status.Ready).To(BeTrue())
g.Expect(hcp.Status.Initialized).To(BeTrue())
g.Expect(hcp.Status.Initialization.ControlPlaneInitialized).To(PointTo(BeTrue()))

// Check that major conditions exist
majorConditions := []string{
Expand Down
1 change: 1 addition & 0 deletions pkg/reconcilers/apiserverresources/apiserverresources.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ func (arr *apiServerResourcesReconciler) reconcileAPIServerDeployment(
hostedControlPlane.Status.UnavailableReplicas = deployment.Status.UnavailableReplicas
hostedControlPlane.Status.ReadyReplicas = deployment.Status.ReadyReplicas
hostedControlPlane.Status.UpdatedReplicas = deployment.Status.UpdatedReplicas
hostedControlPlane.Status.UpToDateReplicas = deployment.Status.UpdatedReplicas
return ready, nil
}
},
Expand Down
3 changes: 2 additions & 1 deletion pkg/reconcilers/workload/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
bootstrapapi "k8s.io/cluster-bootstrap/token/api"
konstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
"k8s.io/utils/ptr"
capiv2 "sigs.k8s.io/cluster-api/api/core/v1beta2"
"sigs.k8s.io/cluster-api/util/conditions"
)
Expand Down Expand Up @@ -266,7 +267,7 @@ func (wr *workloadClusterReconciler) ReconcileWorkloadClusterResources(
}
}

hostedControlPlane.Status.Initialized = true
hostedControlPlane.Status.Initialization.ControlPlaneInitialized = ptr.To(true)

return "", nil
},
Expand Down