Skip to content

Commit 6f43c23

Browse files
Aniruddha Basakjaniskemper
authored andcommitted
✨ Adapt new cluster stack convention
Adapt controller with runtime sdk - API change for hook - Control loop for new way of cluster addon - fix hook server - update packages Signed-off-by: Aniruddha Basak <[email protected]>
1 parent 4189514 commit 6f43c23

File tree

311 files changed

+80173
-126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

311 files changed

+80173
-126
lines changed

api/v1alpha1/clusteraddon_types.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ const (
2727
ClusterAddonFinalizer = "clusteraddon.clusterstack.x-k8s.io"
2828
)
2929

30+
// HelmChartStatusConditions defines the status of helm chart in the cluster addon.
31+
type HelmChartStatusConditions string
32+
33+
var (
34+
None = HelmChartStatusConditions("")
35+
WaitingForPreCondition = HelmChartStatusConditions("waitingForPreCondition")
36+
ApplyingOrDeleting = HelmChartStatusConditions("applyingOrDeleting")
37+
WaitingForPostCondition = HelmChartStatusConditions("waitingForPostCondition")
38+
Done = HelmChartStatusConditions("done")
39+
)
40+
3041
// ClusterAddonSpec defines the desired state of a ClusterAddon object.
3142
type ClusterAddonSpec struct {
3243
// ClusterStack is the full string <provider>-<name>-<Kubernetes version>-<version> that will be filled with the cluster stack that
@@ -38,6 +49,10 @@ type ClusterAddonSpec struct {
3849
// +optional
3950
Version string `json:"version,omitempty"`
4051

52+
// Hook specifies the runtime hook for the Cluster event.
53+
// +optional
54+
Hook string `json:"hook,omitempty"`
55+
4156
// ClusterRef is the reference to the clusterv1.Cluster object that corresponds to the workload cluster where this
4257
// controller applies the cluster addons.
4358
ClusterRef *corev1.ObjectReference `json:"clusterRef"`
@@ -49,6 +64,14 @@ type ClusterAddonStatus struct {
4964
// +optional
5065
Resources []*Resource `json:"resources,omitempty"`
5166

67+
// CurrentHook specifies the current running Hook.
68+
// +optional
69+
CurrentHook string `json:"currentHook,omitempty"`
70+
71+
// HelmChartStatus defines the status of helm chart in the cluster addon.
72+
// +optional
73+
HelmChartStatus map[string]HelmChartStatusConditions `json:"helmChartStatus,omitempty"`
74+
5275
// +optional
5376
// +kubebuilder:default:=false
5477
Ready bool `json:"ready"`

api/v1alpha1/conditions_const.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,25 @@ const (
2626
ControlPlaneNotReadyReason = "ControlPlaneNotReady"
2727
)
2828

29+
const (
30+
// EvaluatedCELCondition reports on whether the CEL expression is evaluated properly.
31+
EvaluatedCELCondition clusterv1.ConditionType = "EvaluatedCEL"
32+
33+
// FailedToEvaluatePreConditionReason is used when some pre CEL expression have been failed to evaluate.
34+
FailedToEvaluatePreConditionReason = "FailedToEvaluatePreCondition"
35+
36+
// FailedToEvaluatePostConditionReason is used when some post CEL expression have been failed to evaluate.
37+
FailedToEvaluatePostConditionReason = "FailedToEvaluatePostCondition"
38+
)
39+
40+
const (
41+
// HelmChartFoundCondition reports when mentioned helm chart is present in the cluster addon tar archive.
42+
HelmChartFoundCondition = "HelmChartFound"
43+
44+
// HelmChartMissingReason is used when mentioned helm chart is missing in the cluster addon tar archive.
45+
HelmChartMissingReason = "HelmChartMissing"
46+
)
47+
2948
const (
3049
// HelmChartAppliedCondition reports on whether the relevant helm chart has been applied.
3150
HelmChartAppliedCondition clusterv1.ConditionType = "HelmChartApplied"
@@ -37,6 +56,14 @@ const (
3756
ObjectsApplyingOngoingReason = "ObjectsApplyingOngoing"
3857
)
3958

59+
const (
60+
// HelmChartDeletedCondition reports on whether the relevant helm chart has been applied.
61+
HelmChartDeletedCondition clusterv1.ConditionType = "HelmChartDeleted"
62+
63+
// FailedToApplyObjectsReason is used when some objects have been failed to delete.
64+
FailedToDeleteObjectsReason = "FailedToDeleteObjects"
65+
)
66+
4067
const (
4168
// ProviderClusterStackReleasesSyncedCondition reports on whether the ProviderClusterStackReleases are ready.
4269
ProviderClusterStackReleasesSyncedCondition = "ProviderClusterStackReleasesSynced"

api/v1alpha1/zz_generated.deepcopy.go

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

cmd/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
4040
_ "k8s.io/client-go/plugin/pkg/client/auth"
4141
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
42+
dockerv1beta1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1beta1"
4243
"sigs.k8s.io/cluster-api/util/record"
4344
ctrl "sigs.k8s.io/controller-runtime"
4445
"sigs.k8s.io/controller-runtime/pkg/cache"
@@ -55,6 +56,7 @@ var (
5556
func init() {
5657
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
5758
utilruntime.Must(csov1alpha1.AddToScheme(scheme))
59+
utilruntime.Must(dockerv1beta1.AddToScheme(scheme))
5860
utilruntime.Must(clusterv1.AddToScheme(scheme))
5961
//+kubebuilder:scaffold:scheme
6062
}

config/crd/bases/clusterstack.x-k8s.io_clusteraddons.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ spec:
110110
ClusterStack is the full string <provider>-<name>-<Kubernetes version>-<version> that will be filled with the cluster stack that
111111
the respective cluster uses currently. It always matches cluster.spec.topology.class if the work of this controller is done.
112112
type: string
113+
hook:
114+
description: Hook specifies the runtime hook for the Cluster event.
115+
type: string
113116
version:
114117
description: Version is the version of the cluster addons that have
115118
been applied in the workload cluster.
@@ -165,6 +168,17 @@ spec:
165168
- type
166169
type: object
167170
type: array
171+
currentHook:
172+
description: CurrentHook specifies the current running Hook.
173+
type: string
174+
helmChartStatus:
175+
additionalProperties:
176+
description: HelmChartStatusConditions defines the status of helm
177+
chart in the cluster addon.
178+
type: string
179+
description: HelmChartStatus defines the status of helm chart in the
180+
cluster addon.
181+
type: object
168182
ready:
169183
default: false
170184
type: boolean

extension/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go

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

extension/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go

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

0 commit comments

Comments
 (0)