OpenKruise v1.1 Highlights: In‑Place Upgrade, PVC Auto‑Delete, and DeepCopy Optimizations
OpenKruise v1.1 extends Kubernetes with ordered container startup, in‑place upgrade sequencing, StatefulSet PVC auto‑deletion policies, a refactored Advanced DaemonSet with lifecycle hooks, and a DisableDeepCopy performance tweak, all while remaining compatible with clusters running Kubernetes 1.16 or newer.
OpenKruise v1.1 Overview
OpenKruise is a CNCF Sandbox project that extends Kubernetes with CRDs to improve deployment, upgrade, operation, and stability. Version 1.1 adds several feature enhancements and performance improvements while remaining compatible with Kubernetes ≥ 1.16 (code dependency upgraded to v1.22).
1. Container Launch Priority & In‑Place Upgrade
v1.1 introduces support for ordered container startup and in‑place upgrades based on the KRUISE_CONTAINER_PRIORITY annotation. Pods that define priority values will start higher‑priority containers first, and during a single in‑place upgrade the controller upgrades containers sequentially according to that priority.
Example CloneSet manifest (excerpt):
apiVersion: apps.kruise.io/v1alpha1
kind: CloneSet
metadata: …
spec:
replicas: 1
template:
metadata:
annotations:
app-config: "... config v1 ..."
spec:
containers:
- name: sidecar
env:
- name: KRUISE_CONTAINER_PRIORITY
value: "10"
- name: APP_CONFIG
valueFrom:
fieldRef:
fieldPath: metadata.annotations['app-config']
- name: main
image: main-image:v1
updateStrategy:
type: InPlaceIfPossibleWhen the CloneSet is updated, Kruise first recreates the sidecar container to apply the new environment, then upgrades the main container, recording progress in the apps.kruise.io/inplace-update-state annotation.
2. StatefulSetAutoDeletePVC
Starting with Kubernetes v1.23, native StatefulSet supports a persistentVolumeClaimRetentionPolicy field. OpenKruise v1.1 syncs this feature to its Advanced StatefulSet, allowing users to set .spec.persistentVolumeClaimRetentionPolicy.whenDeleted and .whenScaled to Retain or Delete. The feature gate StatefulSetAutoDeletePVC must be enabled.
apiVersion: apps.kruise.io/v1beta1
kind: StatefulSet
spec:
…
persistentVolumeClaimRetentionPolicy:
whenDeleted: Retain | Delete
whenScaled: Retain | Delete3. Advanced DaemonSet Refactor & Lifecycle Hook
The Advanced DaemonSet in v1.1 is aligned with upstream DaemonSet behavior. Users can convert a native DaemonSet to Advanced DaemonSet by changing the apiVersion. A new preDelete lifecycle hook allows custom logic before a pod is removed. If the hook is defined, the pod enters a PreparingDelete state until the controller clears the label/finalizer.
apiVersion: apps.kruise.io/v1alpha1
kind: DaemonSet
spec:
…
lifecycle:
preDelete:
labelsHandler:
example.io/block-deleting: "true"4. DisableDeepCopy Performance Optimization
Controller‑runtime normally deep‑copies objects retrieved from informers to protect the cache. In large clusters this can cause high CPU and memory usage. The upstream DisableDeepCopy option (available from controller‑runtime v0.10) lets developers skip deep copies for specific resource types.
mgr, err := ctrl.NewManager(cfg, ctrl.Options{
NewCache: cache.BuilderWithOptions(cache.Options{
UnsafeDisableDeepCopyByObject: map[client.Object]bool{
&v1.Pod{}: true,
},
}),
})OpenKruise v1.1 wraps this functionality in a Delegating Client, exposing a DisableDeepCopy ListOption that can be applied per‑list call:
if err := r.List(context.TODO(), &podList, client.InNamespace("default"), utilclient.DisableDeepCopy); err != nil {
return nil, nil, err
}5. Other Minor Changes
Additional tweaks include documentation updates, bug fixes, and minor API adjustments. Full change logs are available on the GitHub release page.
For more details, see the official OpenKruise website, the referenced documentation links, and the GitHub release notes.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Alibaba Cloud Native
We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
