Skip to content

Commit 627f2ad

Browse files
committed
feat: Native DaemonSet Progressive Delivery - Part 1: Core Infrastructure
Signed-off-by: Marco Ma <marco.ma@sap.com>
1 parent 787bb9c commit 627f2ad

22 files changed

+3751
-31
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.20.14-alpine3.19 as builder
1+
FROM golang:1.20.14-alpine3.19 AS builder
22

33
WORKDIR /workspace
44

Dockerfile_multiarch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Build the manager binary
22
ARG BASE_IMAGE=alpine
33
ARG BASE_IMAGE_VERION=3.17
4-
FROM --platform=$BUILDPLATFORM golang:1.19-alpine3.17 as builder
4+
FROM --platform=$BUILDPLATFORM golang:1.19-alpine3.17 AS builder
55

66
WORKDIR /workspace
77

config/rbac/role.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,32 @@ rules:
102102
- get
103103
- patch
104104
- update
105+
- apiGroups:
106+
- apps
107+
resources:
108+
- daemonsets
109+
verbs:
110+
- get
111+
- list
112+
- patch
113+
- update
114+
- watch
115+
- apiGroups:
116+
- apps
117+
resources:
118+
- daemonsets/status
119+
verbs:
120+
- get
121+
- patch
122+
- update
123+
- apiGroups:
124+
- apps
125+
resources:
126+
- controllerrevisions
127+
verbs:
128+
- get
129+
- list
130+
- watch
105131
- apiGroups:
106132
- apps.kruise.io
107133
resources:

config/webhook/manifests.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,26 @@ webhooks:
2424
resources:
2525
- clonesets
2626
sideEffects: None
27+
- admissionReviewVersions:
28+
- v1
29+
- v1beta1
30+
clientConfig:
31+
service:
32+
name: webhook-service
33+
namespace: system
34+
path: /mutate-apps-v1-daemonset
35+
failurePolicy: Fail
36+
name: mdaemonset-native.kb.io
37+
rules:
38+
- apiGroups:
39+
- apps
40+
apiVersions:
41+
- v1
42+
operations:
43+
- UPDATE
44+
resources:
45+
- daemonsets
46+
sideEffects: None
2747
- admissionReviewVersions:
2848
- v1
2949
- v1beta1

pkg/controller/batchrelease/batchrelease_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ func init() {
6161
watchedWorkload = sync.Map{}
6262
watchedWorkload.LoadOrStore(util.ControllerKindDep.String(), struct{}{})
6363
watchedWorkload.LoadOrStore(util.ControllerKindSts.String(), struct{}{})
64+
watchedWorkload.LoadOrStore(util.ControllerKindDS.String(), struct{}{})
6465
watchedWorkload.LoadOrStore(util.ControllerKruiseKindDS.String(), struct{}{})
6566
watchedWorkload.LoadOrStore(util.ControllerKruiseKindCS.String(), struct{}{})
6667
watchedWorkload.LoadOrStore(util.ControllerKruiseKindSts.String(), struct{}{})

pkg/controller/batchrelease/batchrelease_event_handler.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ func (w workloadEventHandler) Update(ctx context.Context, evt event.UpdateEvent,
134134
gvk = util.ControllerKruiseKindCS
135135
case *kruiseappsv1alpha1.DaemonSet:
136136
gvk = util.ControllerKruiseKindDS
137+
case *appsv1.DaemonSet:
138+
gvk = util.ControllerKindDS
137139
case *appsv1.Deployment:
138140
gvk = util.ControllerKindDep
139141
case *appsv1.StatefulSet:
@@ -187,6 +189,8 @@ func (w *workloadEventHandler) handleWorkload(q workqueue.RateLimitingInterface,
187189
gvk = util.ControllerKruiseKindCS
188190
case *kruiseappsv1alpha1.DaemonSet:
189191
gvk = util.ControllerKruiseKindDS
192+
case *appsv1.DaemonSet:
193+
gvk = util.ControllerKindDS
190194
case *appsv1.Deployment:
191195
gvk = util.ControllerKindDep
192196
case *appsv1.StatefulSet:

pkg/controller/batchrelease/batchrelease_executor.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import (
4343
"github.com/openkruise/rollouts/pkg/controller/batchrelease/control/partitionstyle/cloneset"
4444
"github.com/openkruise/rollouts/pkg/controller/batchrelease/control/partitionstyle/daemonset"
4545
partitiondeployment "github.com/openkruise/rollouts/pkg/controller/batchrelease/control/partitionstyle/deployment"
46+
"github.com/openkruise/rollouts/pkg/controller/batchrelease/control/partitionstyle/nativedaemonset"
4647
"github.com/openkruise/rollouts/pkg/controller/batchrelease/control/partitionstyle/statefulset"
4748
"github.com/openkruise/rollouts/pkg/util"
4849
"github.com/openkruise/rollouts/pkg/util/errors"
@@ -230,14 +231,18 @@ func (r *Executor) getReleaseController(release *v1beta1.BatchRelease, newStatus
230231
fallthrough
231232

232233
case v1beta1.PartitionRollingStyle, "":
233-
if targetRef.APIVersion == appsv1alpha1.GroupVersion.String() && targetRef.Kind == reflect.TypeOf(appsv1alpha1.CloneSet{}).Name() {
234-
klog.InfoS("Using CloneSet partition-style release controller for this batch release", "workload name", targetKey.Name, "namespace", targetKey.Namespace)
235-
return partitionstyle.NewControlPlane(cloneset.NewController, r.client, r.recorder, release, newStatus, targetKey, gvk), nil
236-
}
237234
if targetRef.APIVersion == appsv1alpha1.GroupVersion.String() && targetRef.Kind == reflect.TypeOf(appsv1alpha1.DaemonSet{}).Name() {
238235
klog.InfoS("Using DaemonSet partition-style release controller for this batch release", "workload name", targetKey.Name, "namespace", targetKey.Namespace)
239236
return partitionstyle.NewControlPlane(daemonset.NewController, r.client, r.recorder, release, newStatus, targetKey, gvk), nil
240237
}
238+
if targetRef.APIVersion == apps.SchemeGroupVersion.String() && targetRef.Kind == reflect.TypeOf(apps.DaemonSet{}).Name() {
239+
klog.InfoS("Using Native DaemonSet partition-style release controller for this batch release", "workload name", targetKey.Name, "namespace", targetKey.Namespace)
240+
return partitionstyle.NewControlPlane(nativedaemonset.NewController, r.client, r.recorder, release, newStatus, targetKey, gvk), nil
241+
}
242+
if targetRef.APIVersion == appsv1alpha1.GroupVersion.String() && targetRef.Kind == reflect.TypeOf(appsv1alpha1.CloneSet{}).Name() {
243+
klog.InfoS("Using CloneSet partition-style release controller for this batch release", "workload name", targetKey.Name, "namespace", targetKey.Namespace)
244+
return partitionstyle.NewControlPlane(cloneset.NewController, r.client, r.recorder, release, newStatus, targetKey, gvk), nil
245+
}
241246
if targetRef.APIVersion == apps.SchemeGroupVersion.String() && targetRef.Kind == reflect.TypeOf(apps.Deployment{}).Name() {
242247
klog.InfoS("Using Deployment partition-style release controller for this batch release", "workload name", targetKey.Name, "namespace", targetKey.Namespace)
243248
return partitionstyle.NewControlPlane(partitiondeployment.NewController, r.client, r.recorder, release, newStatus, targetKey, gvk), nil

0 commit comments

Comments
 (0)