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

replace plain yaml manifest with helm chart #870

Merged
merged 6 commits into from
Apr 18, 2024

Conversation

huww98
Copy link
Contributor

@huww98 huww98 commented Sep 25, 2023

What type of PR is this?

/kind cleanup
/kind documentation

What this PR does / why we need it:

this should cover the current ECS/non-ECS, and also ACK/ACK-edge cases

I would like to build a single source of truth to cover all the manifest spread over everywhere.

net changes from previous yaml:

  • all image registry is set to registry-cn-hangzhou.ack.aliyuncs.com

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/documentation Categorizes issue or PR as related to documentation. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 25, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @huww98. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 25, 2023
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 26, 2023
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 7, 2023
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 17, 2023
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 2, 2023
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 2, 2023
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 22, 2023
deploy/chart/templates/controller.yaml Outdated Show resolved Hide resolved
deploy/chart/templates/storage-class.yaml Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 10, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 14, 2024
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 24, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 1, 2024
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Mar 21, 2024
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 24, 2024
@huww98 huww98 force-pushed the helm branch 2 times, most recently from 688faf5 to 71be64c Compare March 24, 2024 09:26
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 9, 2024
this should cover the current ECS/non-ECS, and also ACK/ACK-edge cases
.Values.controller.replicas
.Release.Namespce
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Apr 9, 2024
@huww98
Copy link
Contributor Author

huww98 commented Apr 9, 2024

to help review, I generate a diff with live ACK cluster with: cd deploy; helm template csi-plugin chart -n kube-system --values chart/values-diff.yaml | kubectl diff -n kube-system -f -

diff -u -N /var/folders/kc/jv1f0gpx6671wxsfd_0hzbbm0000gp/T/LIVE-1568119544/apps.v1.DaemonSet.kube-system.csi-plugin /var/folders/kc/jv1f0gpx6671wxsfd_0hzbbm0000gp/T/MERGED-1853621355/apps.v1.DaemonSet.kube-system.csi-plugin
--- /var/folders/kc/jv1f0gpx6671wxsfd_0hzbbm0000gp/T/LIVE-1568119544/apps.v1.DaemonSet.kube-system.csi-plugin	2024-04-09 17:52:56
+++ /var/folders/kc/jv1f0gpx6671wxsfd_0hzbbm0000gp/T/MERGED-1853621355/apps.v1.DaemonSet.kube-system.csi-plugin	2024-04-09 17:52:56
@@ -2,9 +2,9 @@
 kind: DaemonSet
 metadata:
   annotations:
-    deprecated.daemonset.template.generation: "1"
+    deprecated.daemonset.template.generation: "2"
   creationTimestamp: "2024-04-01T06:14:41Z"
-  generation: 1
+  generation: 2
   name: csi-plugin
   namespace: kube-system
   resourceVersion: "21730396"
@@ -33,7 +33,7 @@
       - args:
         - --endpoint=$(CSI_ENDPOINT)
         - --v=2
-        - --driver=oss,nas,disk
+        - --driver=disk,nas,oss
         env:
         - name: CSI_ENDPOINT
           value: unix://var/lib/kubelet/csi-plugins/driverplugin.csi.alibabacloud.com-replace/csi.sock
@@ -97,8 +97,6 @@
           name: run-csi
         - mountPath: /host/sys/fs/cgroup/blkio/kubepods.slice
           name: cgroupv1-blkio
-        - mountPath: /host/usr/
-          name: ossconnectordir
         - mountPath: /host/var/run/efc
           name: efc-metrics-dir
         - mountPath: /host/var/run/ossfs
@@ -188,14 +186,14 @@
       hostPID: true
       initContainers:
       - args:
-        - --driver=oss,nas,disk
+        - --driver=disk,nas,oss
         image: registry-cn-beijing-vpc.ack.aliyuncs.com/acs/csi-plugin:v1.28.6-01f3845-aliyun-init
         imagePullPolicy: IfNotPresent
         name: init
         resources:
           limits:
             cpu: 200m
-            memory: 200Mi
+            memory: 256Mi
           requests:
             cpu: 100m
             memory: 128Mi
diff -u -N /var/folders/kc/jv1f0gpx6671wxsfd_0hzbbm0000gp/T/LIVE-1568119544/apps.v1.Deployment.kube-system.csi-provisioner /var/folders/kc/jv1f0gpx6671wxsfd_0hzbbm0000gp/T/MERGED-1853621355/apps.v1.Deployment.kube-system.csi-provisioner
--- /var/folders/kc/jv1f0gpx6671wxsfd_0hzbbm0000gp/T/LIVE-1568119544/apps.v1.Deployment.kube-system.csi-provisioner	2024-04-09 17:52:56
+++ /var/folders/kc/jv1f0gpx6671wxsfd_0hzbbm0000gp/T/MERGED-1853621355/apps.v1.Deployment.kube-system.csi-provisioner	2024-04-09 17:52:56
@@ -4,7 +4,7 @@
   annotations:
     deployment.kubernetes.io/revision: "1"
   creationTimestamp: "2024-04-01T06:14:20Z"
-  generation: 1
+  generation: 2
   name: csi-provisioner
   namespace: kube-system
   resourceVersion: "21730216"
@@ -47,6 +47,10 @@
                 operator: NotIn
                 values:
                 - virtual-kubelet
+              - key: alibabacloud.com/is-edge-worker
+                operator: NotIn
+                values:
+                - "true"
         podAntiAffinity:
           preferredDuringSchedulingIgnoredDuringExecution:
           - podAffinityTerm:
@@ -62,7 +66,7 @@
       - args:
         - --endpoint=$(CSI_ENDPOINT)
         - --v=2
-        - --driver=nas,disk,oss
+        - --driver=disk,nas,oss
         env:
         - name: CLUSTER_ID
           value: cf08b25a9078c4bb6ae876776450d1324
@@ -118,8 +122,6 @@
         volumeMounts:
         - mountPath: /host/etc
           name: etc
-        - mountPath: /host/run/csi-tool
-          name: run-csi
         - mountPath: /mnt
           mountPropagation: Bidirectional
           name: host-mnt
@@ -222,7 +224,7 @@
         resources:
           limits:
             cpu: 500m
-            memory: 8Gi
+            memory: 1Gi
           requests:
             cpu: 10m
             memory: 16Mi
@@ -271,7 +273,7 @@
         resources:
           limits:
             cpu: 500m
-            memory: 8Gi
+            memory: 1Gi
           requests:
             cpu: 10m
             memory: 16Mi
@@ -367,10 +369,6 @@
         name: nas-provisioner-dir
       - emptyDir: {}
         name: oss-provisioner-dir
-      - hostPath:
-          path: /run/csi-tool
-          type: DirectoryOrCreate
-        name: run-csi
 status:
   availableReplicas: 2
   conditions:

values-diff.yaml:

images:
  registry: registry-cn-beijing-vpc.ack.aliyuncs.com
  controller:
    tag: "v1.28.6-01f3845-aliyun"
  plugin:
    tag: "v1.28.6-01f3845-aliyun"
  pluginInit:
    tag: "v1.28.6-01f3845-aliyun-init"
deploy:
  clusterID: cxxxxxxxx

where kubectl is patched to suppress order changes:

diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/diff/diff.go b/staging/src/k8s.io/kubectl/pkg/cmd/diff/diff.go
index 2afa6b17e9b..517e3c7708a 100644
--- a/staging/src/k8s.io/kubectl/pkg/cmd/diff/diff.go
+++ b/staging/src/k8s.io/kubectl/pkg/cmd/diff/diff.go
@@ -22,6 +22,7 @@ import (
 	"os"
 	"path/filepath"
 	"regexp"
+	"slices"
 	"strings"
 
 	"github.com/jonboulle/clockwork"
@@ -562,6 +563,53 @@ func NewDiffer(from, to string) (*Differ, error) {
 	return &differ, nil
 }
 
+func canonicalize(obj runtime.Object) {
+	a, err := meta.Accessor(obj)
+	if err != nil {
+		return
+	}
+	anno := a.GetAnnotations()
+	delete(anno, "kubectl.kubernetes.io/last-applied-configuration")
+	a.SetAnnotations(anno)
+
+	var templ map[string]interface{}
+	gvk := obj.GetObjectKind().GroupVersionKind()
+	switch gvk.Kind {
+	case "Deployment", "StatefulSet", "DaemonSet":
+		obj := obj.(*unstructured.Unstructured)
+		t, found, err := unstructured.NestedMap(obj.Object, "spec", "template", "spec")
+		if !found {
+			return
+		}
+		if err != nil {
+			panic(err)
+		}
+		templ = t
+	default:
+		return
+	}
+	slices.SortFunc(templ["volumes"].([]any), func(i, j any) int {
+		return strings.Compare(i.(map[string]any)["name"].(string), j.(map[string]any)["name"].(string))
+	})
+	slices.SortFunc(templ["containers"].([]any), func(i, j any) int {
+		return strings.Compare(i.(map[string]any)["name"].(string), j.(map[string]any)["name"].(string))
+	})
+	for _, container := range templ["containers"].([]any) {
+		c := container.(map[string]any)
+		if c["env"] != nil {
+			slices.SortFunc(c["env"].([]any), func(i, j any) int {
+				return strings.Compare(i.(map[string]any)["name"].(string), j.(map[string]any)["name"].(string))
+			})
+		}
+		if c["volumeMounts"] != nil {
+			slices.SortFunc(c["volumeMounts"].([]any), func(i, j any) int {
+				return strings.Compare(i.(map[string]any)["mountPath"].(string), j.(map[string]any)["mountPath"].(string))
+			})
+		}
+	}
+	unstructured.SetNestedMap(obj.(*unstructured.Unstructured).Object, templ, "spec", "template", "spec")
+}
+
 // Diff diffs to versions of a specific object, and print both versions to directories.
 func (d *Differ) Diff(obj Object, printer Printer, showManagedFields bool) error {
 	from, err := d.From.getObject(obj)
@@ -586,6 +634,8 @@ func (d *Differ) Diff(obj Object, printer Printer, showManagedFields bool) error
 		}
 		from, to = m.From(), m.To()
 	}
+	canonicalize(from)
+	canonicalize(to)
 
 	if err := d.From.Print(obj.Name(), from, printer); err != nil {
 		return err

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 9, 2024
@mowangdk
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 18, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: huww98, mowangdk

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 18, 2024
@k8s-ci-robot k8s-ci-robot merged commit 528e139 into kubernetes-sigs:master Apr 18, 2024
6 checks passed
@huww98 huww98 deleted the helm branch April 18, 2024 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/documentation Categorizes issue or PR as related to documentation. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants