From c30e7ad61578a18982aff58b67157fbe8b9d860e Mon Sep 17 00:00:00 2001 From: Eugenio Marzo Date: Sat, 27 Mar 2021 17:54:58 +0100 Subject: [PATCH] some fixes --- Dockerfile | 4 --- Vagrantfile | 1 + .../kubeinvaders/templates/deployment.yaml | 6 ---- .../kubeinvaders/templates/ingress.yaml | 2 +- helm-charts/kubeinvaders/values.yaml | 30 ++++--------------- nginx/node.lua | 11 +++---- 6 files changed, 14 insertions(+), 40 deletions(-) diff --git a/Dockerfile b/Dockerfile index ca26bb0..538af20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,10 +29,6 @@ RUN chmod +x /opt/kube-linter-parser.sh # Install game part COPY ./html5 /var/www/html -# Install chaos-node -COPY chaos-node/chaos-node.sh /opt/ -RUN chmod +x /opt/chaos-node.sh - # Install Redis RUN apt-get install redis -y COPY redis/redis.conf /etc/redis/redis.conf diff --git a/Vagrantfile b/Vagrantfile index c151d97..77a0d53 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -34,6 +34,7 @@ Vagrant.configure('2') do |config| config.vm.define 'kubeinvaders01' do |rke| rke.vm.box = 'ubuntu/focal64' rke.vm.hostname = 'kubeinvaders01' + rke.vm.network "private_network", ip: "192.168.58.99" rke.vm.provider :virtualbox do |vb| vb.memory = 4096 vb.cpus = 2 diff --git a/helm-charts/kubeinvaders/templates/deployment.yaml b/helm-charts/kubeinvaders/templates/deployment.yaml index af76f07..a6b020c 100644 --- a/helm-charts/kubeinvaders/templates/deployment.yaml +++ b/helm-charts/kubeinvaders/templates/deployment.yaml @@ -32,12 +32,6 @@ spec: secretKeyRef: key: token name: kubeinvaders-token - - name: HITSLIMIT - value: "{{ .Values.hitslimit }}" - - name: ALIENPROXIMITY - value: "{{ .Values.alienproximity }}" - - name: UPDATETIME - value: "{{ .Values.updatetime }}" name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} diff --git a/helm-charts/kubeinvaders/templates/ingress.yaml b/helm-charts/kubeinvaders/templates/ingress.yaml index fb7358f..1a94376 100644 --- a/helm-charts/kubeinvaders/templates/ingress.yaml +++ b/helm-charts/kubeinvaders/templates/ingress.yaml @@ -1,5 +1,4 @@ {{- if .Values.ingress.enabled -}} - apiVersion: extensions/v1beta1 kind: Ingress metadata: @@ -27,3 +26,4 @@ spec: serviceName: kubeinvaders servicePort: 8080 {{- end }} + diff --git a/helm-charts/kubeinvaders/values.yaml b/helm-charts/kubeinvaders/values.yaml index da34517..517b107 100644 --- a/helm-charts/kubeinvaders/values.yaml +++ b/helm-charts/kubeinvaders/values.yaml @@ -1,3 +1,6 @@ +# Default namespace target +target_namespace: "default" + # Default values for kubeinvaders. # This is a YAML-formatted file. # Declare variables to be passed into your templates. @@ -10,23 +13,19 @@ serviceAccount: create: true # The name of the service account to use. # If not set and create is true, a name is generated using the fullname template - name: + name: kubeinvaders clusterRole: create: true # The name of a cluster role to bind to; if not set and create is # true, a name based on fullname is generated - name: - -# If clusterRole "false" specifies which namespaces -# kubeinvaders should have access to -allowedNamespaces: [] + name: kubeinvaders replicaCount: 1 image: repository: luckysideburn/kubeinvaders - tag: latest + tag: v1.0 pullPolicy: Always nameOverride: "" @@ -45,22 +44,5 @@ ingress: # secretName: kubeinvaders.local resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - nodeSelector: {} tolerations: [] - -route_host: kubernetes.default.svc -target_namespace: "foobar" -hitslimit: 1 -alienproximity: 15 -updatetime: 1 diff --git a/nginx/node.lua b/nginx/node.lua index 0fb3ef0..2ab8d90 100644 --- a/nginx/node.lua +++ b/nginx/node.lua @@ -85,11 +85,12 @@ for k,v in ipairs(resp) do decoded = json.decode(v) if decoded["kind"] == "NodeList" then for k2,v2 in ipairs(decoded["items"]) do - if not v2["metadata"]["labels"]["node-role.kubernetes.io/master"] then - ngx.log(ngx.ERR, "found node " .. v2["metadata"]["name"]) - nodes["items"][i] = v2["metadata"]["name"] - i = i + 1 - end + -- TODO: masters should be included? + -- if not v2["metadata"]["labels"]["node-role.kubernetes.io/master"] then + ngx.log(ngx.ERR, "found node " .. v2["metadata"]["name"]) + nodes["items"][i] = v2["metadata"]["name"] + i = i + 1 + --end end end end