Allow referencing the NLB and the target nodepool by name, and allow changing target instance-pool #102
+6
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
There are no breaking changes.
Implemented:
Support for referencing nlb by name (for external ones) and sks nodepool by name
When using the API or IaaS its quite difficult to handle or specify ids.
As explained here: #96
Referencing the load balancer by name
For referencing the load balancer, no new annotation was implemented. It just uses the existing annotation
Will be used when it is specified AND
exoscale-loadbalancer-external
is set to true.If name is not specified
exoscale-loadbalancer-id
can still be used to achieve the same thing like beforeReferencing the sks node pool by name instead of instancepool-id
Implemented
when that is specified it will fill out the instancepool id automatically which matches the provided sks-nodepool name.
for that the user has also to specify
which is only required when using this new name-annotation.
Ofc the old/existing annotation
exoscale-loadbalancer-service-instancepool-id
can still be used as before.Implementation
Implementation is quite simple. If names are specified it will do an additional API call at the beginning of
EnsureLoadBalancer
. It will then use the result to patch the ids which the user would otherwise have to provide.Allow changing the target instance pool without destroying load balancer
When updating a service, changing the instance pool id did nothing: #95
It was also documented in the readme:
That is especially bad when using a non-external load balancer as it would force one to delete it - loosing its IP.
That is because the implementation just calls the operation update-load-balancer which does not take a new instance pool as parameter, so it was silently ignored: https://openapi-v2.exoscale.com/operation/operation-update-load-balancer-service
To fix it, in the end of
updateLoadBalancer
I check if the old InstancePoolID and new one differ. If yes it will delete and recreate the NLB service.Other changes
Updated some comments in the functions I changed for more clarity. In the docs/example I also marked using "external" as recommended, so that unexperienced users do not loose a NLB on accident.
Checklist
(For exoscale contributors)
Testing
Runned both
pytest
andgmake test
pytest
Runs through. Just the usual error because of Kubernetes Version mismatch (the one from Exoscale too new) and cleanup does not run through (nginx ingress) as in tests before. However NLB tests are all working.
gmake test
Runs through