Why can't I attach an external IP through my jelastic installation manifest?

3/16/2020

I have a very simple jelastic installation manifest which installs a kubernetes cluster:

jpsVersion: 1.3
jpsType: install
application:
  id: shopozor-k8s-cluster
  name: Shopozor k8s cluster
  version: 0.0

  settings:
    fields:
    - name: envName
      caption: Env Name
      type: string
      default: shopozor
    - name: topo
      type: radio-fieldset
      values:
        0-dev: '<b>Development:</b> one master (1) and one scalable worker (1+)'
        1-prod: '<b>Production:</b> multi master (3) with API balancers (2+) and scalable workers (2+)'
      default: 0-dev
    - name: k8s-version
      type: string
      caption: k8s manifest version
      default: v1.16.3

  onInstall:
  - installKubernetes
  - attachIpToWorkerNodes

  actions:
    installKubernetes:
      install:
        jps: https://github.com/jelastic-jps/kubernetes/blob/${settings.k8s-version}/manifest.jps
        envName: ${settings.envName}
        displayName: ${settings.envName}
        settings:
          deploy: cc
          topo: ${settings.topo}
          dashboard: version2
          ingress-controller: Nginx
          storage: true
          api: true
          monitoring: true
          version: ${settings.k8s-version}
          jaeger: false
    attachIpToWorkerNodes:
    - forEach(node:nodes.cp):
      - jelastic.env.binder.AttachExtIp:
          envName: ${settings.envName}
          nodeId: ${@node.id}

If I install that manifest, then I get my cluster up and running, but the worker nodes do not get an IPv4 attached. After installing that manifest, if I additionally install the following update manifest, then it works:

jpsVersion: 1.3
jpsType: update
application:
  id: attach-ext-ip
  name: Attach external IP
  version: 0.0

  onInstall:
  - attachIpToWorkerNodes

  actions:
    attachIpToWorkerNodes:
    - forEach(node:nodes.cp):
      - jelastic.env.binder.AttachExtIp:
          nodeId: ${@node.id}

What is it I am doing wrong in the install manifest? why aren't the ip attached to my worker nodes, while there are if I perform that action after installation with an update manifest?

-- Laurent Michel
jelastic
kubernetes

1 Answer

3/18/2020

Please note, that the "public IP binding" feature is not available in the production yet. It's under active development and will be officially announced in one of our next releases. In the current stable version, some of the functionality related to it may not work properly. Right now, it's not recommended for production use, but you can try it for test purposes only. As for the "attachIpToWorkerNodes" action in the original manifest, the issue was that "nodes.cp" of the environment created wasn't declared in scope where "forEach" was invoked. The correct version of the action is:

attachIpToWorkerNodes:
  install:
    envName: ${settings.envName}
    jps:
      type: update
      name: Attach IP To Worker Nodes
      onInstall: jelastic.env.binder.AttachExtIp [nodes.cp.join(id,)]

Please let us know if you have any further questions.

-- Jelastic
Source: StackOverflow