Repository: kumahq/kuma
Pull request #11745 (2024-10-09 16:58:26)

feat(kumactl): update embedded demo resources
## Motivation

Haven't been updated. Unfortunately the `make dev/sync-demo` target overwrites the `MeshGateway`/`MeshHTTPRoute` `labels`. They need to added to the demo upstream after this PR.

> Changelog: skip

For example https://github.com/kumahq/kuma-counter-demo/pull/54



Patch:
diff --git a/app/kumactl/data/install/k8s/demo/demo.yaml b/app/kumactl/data/install/k8s/demo/demo.yaml
index 4853d821c..a19231c2b 100644
--- a/app/kumactl/data/install/k8s/demo/demo.yaml
+++ b/app/kumactl/data/install/k8s/demo/demo.yaml
@@ -39,6 +39,8 @@ kind: Service
 metadata:
   name: redis
   namespace: {{ .Namespace }}
+  labels:
+    app: redis
 spec:
   selector:
     app: redis
@@ -82,6 +84,8 @@ kind: Service
 metadata:
   name: demo-app
   namespace: {{ .Namespace }}
+  labels:
+    app: demo-app
 spec:
   selector:
     app: demo-app
diff --git a/app/kumactl/data/install/k8s/demo/gateway.yaml b/app/kumactl/data/install/k8s/demo/gateway.yaml
index 1950ffa74..816f0c4b0 100644
--- a/app/kumactl/data/install/k8s/demo/gateway.yaml
+++ b/app/kumactl/data/install/k8s/demo/gateway.yaml
@@ -13,7 +13,7 @@ spec:
       protocol: HTTP
   selectors:
   - match:
-      kuma.io/service: demo-app-gateway_kuma-demo_svc
+      kuma.io/service: demo-app-gateway_{{ .Namespace }}_svc
 ---
 apiVersion: kuma.io/v1alpha1
 kind: MeshHTTPRoute
@@ -28,17 +28,17 @@ spec:
     kind: MeshGateway
     name: demo-app
   to:
-    - targetRef:
-        kind: Mesh
-      rules:
-        - matches:
-            - path:
-                type: PathPrefix
-                value: "/"
-          default:
-            backendRefs:
-              - kind: MeshService
-                name: demo-app_{{ .Namespace }}_svc_5000
+  - targetRef:
+      kind: Mesh
+    rules:
+    - default:
+        backendRefs:
+        - kind: MeshService
+          name: demo-app_{{ .Namespace }}_svc_5000
+      matches:
+      - path:
+          type: PathPrefix
+          value: /
 ---
 apiVersion: kuma.io/v1alpha1
 kind: MeshGatewayInstance
diff --git a/mk/dependencies/deps.lock b/mk/dependencies/deps.lock
index 031e9e497..41dec2053 100644
--- a/mk/dependencies/deps.lock
+++ b/mk/dependencies/deps.lock
@@ -1,1 +1,1 @@
-67e5a6e147d569852851535e91196922ade8162d
+85edd35bf66665ac4e9f4fd54fdd06d202a510c3
diff --git a/mk/dev.mk b/mk/dev.mk
index 80debd183..6c078b442 100644
--- a/mk/dev.mk
+++ b/mk/dev.mk
@@ -130,10 +130,12 @@ dev/sync-demo:
 	rm app/kumactl/data/install/k8s/demo/*.yaml
 	curl -s --fail https://raw.githubusercontent.com/kumahq/kuma-counter-demo/master/demo.yaml | \
 		sed 's/"local"/"{{ .Zone }}"/g' | \
-		sed 's/\([^/]\)kuma-demo/\1{{ .Namespace }}/g' \
+		sed 's/\([^/]\)kuma-demo/\1{{ .Namespace }}/g' | \
+		sed 's/\([^/]\)kuma-system/\1{{ .SystemNamespace }}/g' \
 		> app/kumactl/data/install/k8s/demo/demo.yaml
 	curl -s --fail https://raw.githubusercontent.com/kumahq/kuma-counter-demo/master/gateway.yaml | \
-		sed 's/\([^/]\)kuma-demo/\1{{ .Namespace }}/g' \
+		sed 's/\([^/]\)kuma-demo/\1{{ .Namespace }}/g' | \
+		sed 's/\([^/]\)kuma-system/\1{{ .SystemNamespace }}/g' \
 		> app/kumactl/data/install/k8s/demo/gateway.yaml
 
 .PHONY: dev/set-kuma-helm-repo


Test patch:
diff --git a/app/kumactl/cmd/install/testdata/install-demo.defaults.golden.yaml b/app/kumactl/cmd/install/testdata/install-demo.defaults.golden.yaml
index 348b6006f..af059d4f6 100644
--- a/app/kumactl/cmd/install/testdata/install-demo.defaults.golden.yaml
+++ b/app/kumactl/cmd/install/testdata/install-demo.defaults.golden.yaml
@@ -12,6 +12,8 @@ kind: Service
 metadata:
   name: redis
   namespace: kuma-demo
+  labels:
+    app: redis
 spec:
   selector:
     app: redis
@@ -24,6 +26,8 @@ kind: Service
 metadata:
   name: demo-app
   namespace: kuma-demo
+  labels:
+    app: demo-app
 spec:
   selector:
     app: demo-app
@@ -130,14 +134,14 @@ spec:
     kind: MeshGateway
     name: demo-app
   to:
-    - targetRef:
-        kind: Mesh
-      rules:
-        - matches:
-            - path:
-                type: PathPrefix
-                value: "/"
-          default:
-            backendRefs:
-              - kind: MeshService
-                name: demo-app_kuma-demo_svc_5000
+  - targetRef:
+      kind: Mesh
+    rules:
+    - default:
+        backendRefs:
+        - kind: MeshService
+          name: demo-app_kuma-demo_svc_5000
+      matches:
+      - path:
+          type: PathPrefix
+          value: /
diff --git a/app/kumactl/cmd/install/testdata/install-demo.overrides.golden.yaml b/app/kumactl/cmd/install/testdata/install-demo.overrides.golden.yaml
index 8bcc6872f..9ec91ebf3 100644
--- a/app/kumactl/cmd/install/testdata/install-demo.overrides.golden.yaml
+++ b/app/kumactl/cmd/install/testdata/install-demo.overrides.golden.yaml
@@ -12,6 +12,8 @@ kind: Service
 metadata:
   name: redis
   namespace: not-kuma-demo
+  labels:
+    app: redis
 spec:
   selector:
     app: redis
@@ -24,6 +26,8 @@ kind: Service
 metadata:
   name: demo-app
   namespace: not-kuma-demo
+  labels:
+    app: demo-app
 spec:
   selector:
     app: demo-app
@@ -106,7 +110,7 @@ spec:
       protocol: HTTP
   selectors:
   - match:
-      kuma.io/service: demo-app-gateway_kuma-demo_svc
+      kuma.io/service: demo-app-gateway_not-kuma-demo_svc
 ---
 apiVersion: kuma.io/v1alpha1
 kind: MeshGatewayInstance
@@ -130,14 +134,14 @@ spec:
     kind: MeshGateway
     name: demo-app
   to:
-    - targetRef:
-        kind: Mesh
-      rules:
-        - matches:
-            - path:
-                type: PathPrefix
-                value: "/"
-          default:
-            backendRefs:
-              - kind: MeshService
-                name: demo-app_not-kuma-demo_svc_5000
+  - targetRef:
+      kind: Mesh
+    rules:
+    - default:
+        backendRefs:
+        - kind: MeshService
+          name: demo-app_not-kuma-demo_svc_5000
+      matches:
+      - path:
+          type: PathPrefix
+          value: /
diff --git a/app/kumactl/cmd/install/testdata/install-demo.without-gateway.golden.yaml b/app/kumactl/cmd/install/testdata/install-demo.without-gateway.golden.yaml
index 1a5b7d6c7..f89ca0a68 100644
--- a/app/kumactl/cmd/install/testdata/install-demo.without-gateway.golden.yaml
+++ b/app/kumactl/cmd/install/testdata/install-demo.without-gateway.golden.yaml
@@ -12,6 +12,8 @@ kind: Service
 metadata:
   name: redis
   namespace: kuma-demo
+  labels:
+    app: redis
 spec:
   selector:
     app: redis
@@ -24,6 +26,8 @@ kind: Service
 metadata:
   name: demo-app
   namespace: kuma-demo
+  labels:
+    app: demo-app
 spec:
   selector:
     app: demo-app