-
Notifications
You must be signed in to change notification settings - Fork 5
feat(minikube): add minikube delete and debug commands #40
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
312a3b7
2010235
cb471ed
95a955f
ea98ef8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,26 @@ | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: base | ||
| labels: | ||
| app: base | ||
| spec: | ||
| containers: | ||
| - name: base | ||
| image: serverless-registry.cn-shanghai.cr.aliyuncs.com/opensource/test/base-web:1.3.3 # 已经打包好的镜像,源码在 https://github.com/koupleless/samples/blob/main/springboot-samples/web/tomcat/Dockerfile | ||
| imagePullPolicy: Always | ||
| ports: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: base | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: base | ||
| spec: | ||
| containers: | ||
| - name: base | ||
| containerPort: 8080 | ||
| - name: arklet | ||
| containerPort: 1238 | ||
| env: | ||
| - name: MODULE_CONTROLLER_ADDRESS | ||
| value: { YOUR_MODULE_CONTROLLER_IP } | ||
| image: serverless-registry.cn-shanghai.cr.aliyuncs.com/opensource/test/base-web:1.4.0 # 已经打包好的镜像, 镜像来源 https://github.com/koupleless/samples/blob/main/springboot-samples/web/tomcat/Dockerfile | ||
| imagePullPolicy: Always | ||
| ports: | ||
| - name: base | ||
| containerPort: 8080 | ||
| - name: arklet | ||
| containerPort: 1238 | ||
| env: | ||
| - name: MODULE_CONTROLLER_ADDRESS # 在 base-web 的 koupleless runtime 里是 `koupleless.arklet.http.heartbeat.endpoint` | ||
| value: {YOUR_MODULE_CONTROLLER_IP_AND_PORT} # 127.0.0.1:7777 |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,24 +1,31 @@ | ||||||||||||||||||||||||
| apiVersion: v1 | ||||||||||||||||||||||||
| kind: Pod | ||||||||||||||||||||||||
| apiVersion: apps/v1 | ||||||||||||||||||||||||
| kind: Deployment | ||||||||||||||||||||||||
| metadata: | ||||||||||||||||||||||||
| name: module-controller | ||||||||||||||||||||||||
| labels: | ||||||||||||||||||||||||
| app: module-controller | ||||||||||||||||||||||||
| spec: | ||||||||||||||||||||||||
| serviceAccountName: virtual-kubelet # 上一步中配置好的 Service Account | ||||||||||||||||||||||||
| containers: | ||||||||||||||||||||||||
| - name: module-controller | ||||||||||||||||||||||||
| image: serverless-registry.cn-shanghai.cr.aliyuncs.com/opensource/test/module-controller-v2:v2.1.2 # 已经打包好的镜像 | ||||||||||||||||||||||||
| imagePullPolicy: Always | ||||||||||||||||||||||||
| resources: | ||||||||||||||||||||||||
| limits: | ||||||||||||||||||||||||
| cpu: "1000m" | ||||||||||||||||||||||||
| memory: "400Mi" | ||||||||||||||||||||||||
| ports: | ||||||||||||||||||||||||
| - name: httptunnel | ||||||||||||||||||||||||
| containerPort: 7777 | ||||||||||||||||||||||||
| - name: debug | ||||||||||||||||||||||||
| containerPort: 2345 | ||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||
| - name: ENABLE_HTTP_TUNNEL | ||||||||||||||||||||||||
| value: "true" | ||||||||||||||||||||||||
| replicas: 1 | ||||||||||||||||||||||||
| selector: | ||||||||||||||||||||||||
| matchLabels: | ||||||||||||||||||||||||
| app: module-controller | ||||||||||||||||||||||||
| template: | ||||||||||||||||||||||||
| metadata: | ||||||||||||||||||||||||
| labels: | ||||||||||||||||||||||||
| app: module-controller | ||||||||||||||||||||||||
| spec: | ||||||||||||||||||||||||
| serviceAccountName: virtual-kubelet # 上一步中配置好的 Service Account | ||||||||||||||||||||||||
| containers: | ||||||||||||||||||||||||
| - name: module-controller | ||||||||||||||||||||||||
|
Comment on lines
+16
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add By default the container will run as UID 0 with - name: module-controller
+ securityContext:
+ runAsNonRoot: true
+ allowPrivilegeEscalation: false
+ capabilities:
+ drop: [ "ALL" ]This single change neutralises both Checkov findings and narrows the blast-radius if the process is compromised. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
| image: serverless-registry.cn-shanghai.cr.aliyuncs.com/opensource/test/module-controller-v2:latest # 自己构建打包好的镜像 | ||||||||||||||||||||||||
| imagePullPolicy: Never | ||||||||||||||||||||||||
| resources: | ||||||||||||||||||||||||
| limits: | ||||||||||||||||||||||||
| cpu: "1000m" | ||||||||||||||||||||||||
| memory: "400Mi" | ||||||||||||||||||||||||
|
Comment on lines
+21
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add resource requests alongside limits for reliable scheduling Only limits are specified; without requests the scheduler will assume 0 CPU / 0 Mi, leading to noisy-neighbor issues and unpredictable QoS. resources:
- limits:
- cpu: "1000m"
- memory: "400Mi"
+ requests:
+ cpu: "200m"
+ memory: "200Mi"
+ limits:
+ cpu: "1000m"
+ memory: "400Mi"Tune the numbers to your actual baseline consumption. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
| ports: | ||||||||||||||||||||||||
| - name: httptunnel | ||||||||||||||||||||||||
| containerPort: 7777 | ||||||||||||||||||||||||
| - name: debug | ||||||||||||||||||||||||
| containerPort: 2345 | ||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||
| - name: ENABLE_HTTP_TUNNEL | ||||||||||||||||||||||||
| value: "true" | ||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,22 +1,29 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| apiVersion: v1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| kind: Pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| apiVersion: apps/v1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| kind: Deployment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| metadata: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: module-controller | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| labels: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| app: module-controller | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| spec: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| serviceAccountName: virtual-kubelet # 上一步中配置好的 Service Account | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| containers: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: module-controller | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| image: serverless-registry.cn-shanghai.cr.aliyuncs.com/opensource/release/module-controller-v2:v2.1.2 # 已经打包好的镜像 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| imagePullPolicy: Always | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| resources: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| limits: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cpu: "1000m" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| memory: "400Mi" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ports: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: httptunnel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| containerPort: 7777 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: ENABLE_HTTP_TUNNEL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| value: "true" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| replicas: 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| selector: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| matchLabels: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| app: module-controller | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| template: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| metadata: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| labels: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| app: module-controller | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| spec: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| serviceAccountName: virtual-kubelet # 上一步中配置好的 Service Account | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| containers: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: module-controller | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| image: serverless-registry.cn-shanghai.cr.aliyuncs.com/opensource/release/module-controller-v2:v2.1.4 # 已经打包好的镜像 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| imagePullPolicy: Always | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| resources: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| limits: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cpu: "1000m" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| memory: "400Mi" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+20
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Specify Only limits are declared; requests default to resources:
+ requests:
+ cpu: 200m
+ memory: 200Mi
limits:
cpu: "1000m"
memory: "400Mi"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Comment on lines
+16
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add Checkov flags ( - name: module-controller
image: serverless-registry.cn-shanghai.cr.aliyuncs.com/opensource/release/module-controller-v2:v2.1.4 # 已经打包好的镜像
imagePullPolicy: Always
+ securityContext:
+ allowPrivilegeEscalation: false
+ runAsNonRoot: true
+ capabilities:
+ drop:
+ - "ALL"
resources:
limits:
cpu: "1000m"
memory: "400Mi"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ports: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: httptunnel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| containerPort: 7777 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: ENABLE_HTTP_TUNNEL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| value: "true" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,23 +1,26 @@ | ||||||||||||||
| apiVersion: apps/v1 | ||||||||||||||
| kind: Deployment | ||||||||||||||
| metadata: | ||||||||||||||
| name: biz1 | ||||||||||||||
| name: biz1-web-single-host | ||||||||||||||
| labels: | ||||||||||||||
| virtual-kubelet.koupleless.io/component: module-deployment | ||||||||||||||
| spec: | ||||||||||||||
| replicas: 1 | ||||||||||||||
| selector: | ||||||||||||||
| matchLabels: | ||||||||||||||
| module: biz1 | ||||||||||||||
| virtual-kubelet.koupleless.io/component: module | ||||||||||||||
| module.koupleless.io/name: biz1-web-single-host | ||||||||||||||
| module.koupleless.io/version: 0.0.1-SNAPSHOT | ||||||||||||||
| template: | ||||||||||||||
| metadata: | ||||||||||||||
| labels: | ||||||||||||||
| module: biz1 | ||||||||||||||
| virtual-kubelet.koupleless.io/component: module | ||||||||||||||
| module.koupleless.io/name: biz1-web-single-host | ||||||||||||||
| module.koupleless.io/version: 0.0.1-SNAPSHOT | ||||||||||||||
| spec: | ||||||||||||||
| containers: | ||||||||||||||
| - name: biz1 | ||||||||||||||
| image: https://serverless-opensource.oss-cn-shanghai.aliyuncs.com/module-packages/stable/biz1-web-single-host-0.0.1-SNAPSHOT-ark-biz.jar | ||||||||||||||
| - name: biz1-web-single-host # this name must same with the biz name defined in the jar | ||||||||||||||
| image: https://koupleless-dosc.oss-cn-hongkong.aliyuncs.com/biz1-web-single-host-0.0.1-SNAPSHOT-ark-biz.jar | ||||||||||||||
| env: | ||||||||||||||
|
Comment on lines
+22
to
24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Kubernetes expects an image reference like - image: https://koupleless-dosc.oss-cn-hongkong.aliyuncs.com/biz1-web-single-host-0.0.1-SNAPSHOT-ark-biz.jar
+ image: serverless-registry.cn-shanghai.cr.aliyuncs.com/opensource/test/biz1-web-single-host:0.0.1-SNAPSHOT📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| - name: BIZ_VERSION | ||||||||||||||
| value: 0.0.1-SNAPSHOT | ||||||||||||||
|
|
@@ -26,18 +29,24 @@ spec: | |||||||||||||
| requiredDuringSchedulingIgnoredDuringExecution: | ||||||||||||||
| nodeSelectorTerms: | ||||||||||||||
| - matchExpressions: | ||||||||||||||
| # these labels in vnode generated in base `https://github.com/koupleless/runtime/blob/main/arklet-core/src/main/java/com/alipay/sofa/koupleless/arklet/core/hook/base/BaseMetadataHookImpl.java` | ||||||||||||||
| # you can define your own labels by implementing your own BaseMetadataHookImpl | ||||||||||||||
| - key: base.koupleless.io/name | ||||||||||||||
| operator: In | ||||||||||||||
| values: | ||||||||||||||
| - base | ||||||||||||||
| - key: base.koupleless.io/version | ||||||||||||||
| operator: In | ||||||||||||||
| values: | ||||||||||||||
| - 1.0.0 | ||||||||||||||
| - TO_BE_IMPLEMENTED | ||||||||||||||
| - key: base.koupleless.io/cluster-name | ||||||||||||||
| operator: In | ||||||||||||||
| values: | ||||||||||||||
| - default | ||||||||||||||
| podAntiAffinity: # 打散调度核心配置 | ||||||||||||||
| requiredDuringSchedulingIgnoredDuringExecution: | ||||||||||||||
| - labelSelector: | ||||||||||||||
| matchLabels: | ||||||||||||||
| virtual-kubelet.koupleless.io/component: module | ||||||||||||||
| module.koupleless.io/name: biz1-web-single-host | ||||||||||||||
| module.koupleless.io/version: 0.0.1-SNAPSHOT | ||||||||||||||
| topologyKey: topology.kubernetes.io/zone | ||||||||||||||
| tolerations: | ||||||||||||||
| - key: "schedule.koupleless.io/virtual-node" | ||||||||||||||
| operator: "Equal" | ||||||||||||||
|
|
@@ -46,4 +55,4 @@ spec: | |||||||||||||
| - key: "schedule.koupleless.io/node-env" | ||||||||||||||
| operator: "Equal" | ||||||||||||||
| value: "dev" | ||||||||||||||
| effect: "NoExecute" | ||||||||||||||
| effect: "NoExecute" | ||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
kubectl waitwill error when no pods remainIf
kubectl deletefinds nothing, the subsequentkubectl wait --for=deleteaborts withNotFound, breaking the target. Swallow the error or use--ignore-not-found.🤖 Prompt for AI Agents