From 6640f29e4457554660f527c744b1a3ced9cc905a Mon Sep 17 00:00:00 2001 From: wenxinlee2015 Date: Tue, 8 Jun 2021 18:01:52 +0800 Subject: [PATCH] add downwardapi --- core/cm.yaml | 17 +++++++++++++++++ core/dp.yaml | 13 +++++++++++++ core/ingress.yaml | 16 ++++++++++++++++ core/pod.yaml | 19 ++++--------------- core/sts.yaml | 2 +- dockerfile/Dockerfile | 1 + game/hook-inplace-template.yaml | 8 ++++---- 7 files changed, 56 insertions(+), 20 deletions(-) create mode 100644 core/cm.yaml create mode 100644 core/ingress.yaml diff --git a/core/cm.yaml b/core/cm.yaml new file mode 100644 index 0000000..ba9d6ec --- /dev/null +++ b/core/cm.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: game-demo +data: + # property-like keys; each key maps to a simple value + player_initial_lives: "3" + ui_properties_file_name: "user-interface.properties" + + # file-like keys + game.properties: | + enemy.types=aliens,monsters + player.maximum-lives=3 + user-interface.properties: | + color.good=purple + color.bad=yellow + allow.textmode=true diff --git a/core/dp.yaml b/core/dp.yaml index 0251cfd..90c41c7 100644 --- a/core/dp.yaml +++ b/core/dp.yaml @@ -36,5 +36,18 @@ spec: periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 + resources: + limits: + memory: "128Mi" + cpu: "500m" + env: + - name: MY_spec.Nodename + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: BCS_HOST_IP + valueFrom: + fieldRef: + fieldPath: status.hostIP # nodeSelector: # kubernetes.io/hostname: 9.219.90.10 diff --git a/core/ingress.yaml b/core/ingress.yaml new file mode 100644 index 0000000..4d3a86d --- /dev/null +++ b/core/ingress.yaml @@ -0,0 +1,16 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: ingress-test + namespace: wessonli-test + annotations: + nginx.ingress.kubernetes.io/rewrite-target: /todos/$2 +spec: + rules: + - host: test.ingress.com + http: + paths: + - path: /t(/|$)(.*) + backend: + serviceName: svc-goserver + servicePort: 8080 diff --git a/core/pod.yaml b/core/pod.yaml index 447277a..cc13d04 100644 --- a/core/pod.yaml +++ b/core/pod.yaml @@ -3,22 +3,11 @@ kind: Pod metadata: name: my-pod spec: - initContainers: - - name: prep-symlink - image: busybox - ## command: ["bin/sh", "-ec", "ls"] - command: ["bin/sh", "-ec", "ln -s / /mnt/data/symlink-door"] - volumeMounts: - - name: my-volume - mountPath: /mnt/data containers: - name: my-container image: busybox command: ["/bin/sh", "-ec", "ls /mnt/data; sleep 999999"] - volumeMounts: - - mountPath: /mnt/data - name: my-volume - subPath: symlink-door - volumes: - - name: my-volume - emptyDir: {} + resources: + limits: + memory: "128Mi" + cpu: "500m" diff --git a/core/sts.yaml b/core/sts.yaml index 6259a97..ba9a666 100644 --- a/core/sts.yaml +++ b/core/sts.yaml @@ -12,7 +12,7 @@ spec: template: metadata: labels: - app: nginx + app: nginx-tmp spec: containers: - name: nginx diff --git a/dockerfile/Dockerfile b/dockerfile/Dockerfile index cd85cb7..693bdd7 100644 --- a/dockerfile/Dockerfile +++ b/dockerfile/Dockerfile @@ -3,5 +3,6 @@ FROM centos:7 ADD ./goserver-todo /root/ RUN chmod +x /root/goserver-todo RUN yum install -y net-tools +RUN yum install -y bind-utils WORKDIR /root/ CMD [ "/root/goserver-todo" ] diff --git a/game/hook-inplace-template.yaml b/game/hook-inplace-template.yaml index fa876c5..5d04211 100644 --- a/game/hook-inplace-template.yaml +++ b/game/hook-inplace-template.yaml @@ -4,10 +4,10 @@ metadata: name: test-inplace namespace: wessonli-test spec: -# args: -# - name: PodIP -# - name: PodName -# - name: PodNamespace + args: + - name: PodIP + - name: PodName + - name: PodNamespace metrics: - name: webtest count: 30