kvaps / kube-linstor

Containerized LINSTOR SDS for Kubernetes, ready for production use.
Apache License 2.0
130 stars 25 forks source link

Automatically join nodes #23

Closed jbanety closed 3 years ago

jbanety commented 3 years ago

Hi @kvaps, Is there a way to use LinstorSatelliteSet custom resource with your charts ? My goal is to create pools automatically.

kvaps commented 3 years ago

Hi. I had a plans to integrate it with piraeus project, but I had no much time to investigate this feature yet.

For now I'm trying to stick mostly independent solutions which do not require any specific CRD's to their work. Thus my idea was to add additional init-container to the linstor-satellite which will join node automatically to the linstor-controller.

And then additional container which will invoke linstor physical-storage create-device-pool commnads to prepare the storage-pools according your configuration.

Any design ideas are welcome.

jbanety commented 3 years ago

Thus my idea was to add additional init-container to the linstor-satellite which will join node automatically to the linstor-controller. And then additional container which will invoke linstor physical-storage create-device-pool commnads to prepare the storage-pools according your configuration.

This is the easier solution at the moment. I'll try to implement this on my own.

jbanety commented 3 years ago

Any idea to discover satellites to automatically add them to the cluster ? Accessing the K8s API ?

kvaps commented 3 years ago

I think we need to add a specific option for that. There should be an additional init-container for linstor-satellite, which will invoke the following command:

curl --cacert /tls/ca.crt --cert /tls/tls.crt --key /tls/tls.key -X POST -H "Content-Type: application/json" -d '{"name": "m1c8", "type": "satellite", "net_interfaces": [{"name": "default", "address": "10.28.36.168", "satellite_port": 3367, "satellite_encryption_type": "ssl"}]}' https://linstor-controller:3371/v1/nodes

of course client certificate should be mounted into /tls

jbanety commented 3 years ago

Hum. I was looking for a solution from controller with linstor client but yours is better because it came from satellite. If we add an other node, it will be automatically added to the cluster. Nice 👍

jbanety commented 3 years ago

10.28.36.168

Is this a K8s internal IP ? Is it better to use host IP ?

kvaps commented 3 years ago

This is node ip, since it uses hostNetwork, you can pass via enviroment variables like:

      env:
        - name: NODE_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP

be aware original satellite container has no curl installed yet

jbanety commented 3 years ago

Thanks for the hints. I created a PR 🎉

kvaps commented 3 years ago

Implemented in v1.11.1-1, thanks!