Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receive the API server endpoint URLs via kube-control #84

Merged
merged 8 commits into from
May 19, 2021

Conversation

johnsca
Copy link
Contributor

@johnsca johnsca commented Apr 6, 2021

This simplifies how the workers receive the API endpoint URLs by making them always come from the master via the kube-control relation. It also improves how status is reported when the endpoint address is not available.

Part of lp:1921776
Depends on juju-solutions/interface-kube-control#33

johnsca added a commit to charmed-kubernetes/charm-kubernetes-control-plane that referenced this pull request Apr 6, 2021
This adds support for the `loadbalancer` interface so that cloud-native
LBs can be provided by the integrator charms. Additionally, it
simplifies the confusing way the relations between the masters and
workers change depending on whether kubeapi-load-balancer is being used
or not by making that use the same `lb-provider` endpoint and always
forwarding the API endpoint URLs via the `kube-control` relation.

Part of [lp:1897818][]
Depends on:
  * juju-solutions/loadbalancer-interface#13
  * juju-solutions/interface-kube-control#33
  * charmed-kubernetes/charm-kubernetes-worker#84
  * charmed-kubernetes/charm-kubeapi-load-balancer#11

[lp:1897818]: https://bugs.launchpad.net/charmed-kubernetes-testing/+bug/1897818
johnsca added a commit to charmed-kubernetes/bundle that referenced this pull request Apr 6, 2021
Copy link
Contributor

@Cynerva Cynerva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but needs integration test coverage.

]
if hasattr(kube_control, "get_api_endpoints"):
return kube_control.get_api_endpoints()
return []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one of those "should never happen" cases, and if encountered, will lead to hook errors since callers assume that at least 1 valid endpoint is returned. I would think it would be more fitting to raise an exception here, or at the very least, log a warning.

@johnsca johnsca requested a review from Cynerva April 22, 2021 14:44
Copy link
Contributor

@Cynerva Cynerva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good, but this still needs integration tests.

johnsca added a commit to charmed-kubernetes/charm-kubernetes-control-plane that referenced this pull request May 4, 2021
This adds support for the `loadbalancer` interface so that cloud-native
LBs can be provided by the integrator charms. Additionally, it
simplifies the confusing way the relations between the masters and
workers change depending on whether kubeapi-load-balancer is being used
or not by making that use the same `lb-provider` endpoint and always
forwarding the API endpoint URLs via the `kube-control` relation.

Part of [lp:1897818][]
Depends on:
  * juju-solutions/loadbalancer-interface#13
  * juju-solutions/interface-kube-control#33
  * charmed-kubernetes/charm-kubernetes-worker#84
  * charmed-kubernetes/charm-kubeapi-load-balancer#11

[lp:1897818]: https://bugs.launchpad.net/charmed-kubernetes-testing/+bug/1897818
@johnsca johnsca marked this pull request as draft May 7, 2021 21:27
johnsca added a commit to charmed-kubernetes/charm-kubernetes-control-plane that referenced this pull request May 10, 2021
This adds support for the `loadbalancer` interface so that cloud-native
LBs can be provided by the integrator charms. Additionally, it
simplifies the confusing way the relations between the masters and
workers change depending on whether kubeapi-load-balancer is being used
or not by making that use the same `lb-provider` endpoint and always
forwarding the API endpoint URLs via the `kube-control` relation.

Part of [lp:1897818][]
Depends on:
  * juju-solutions/loadbalancer-interface#13
  * juju-solutions/interface-kube-control#33
  * charmed-kubernetes/charm-kubernetes-worker#84
  * charmed-kubernetes/charm-kubeapi-load-balancer#11

[lp:1897818]: https://bugs.launchpad.net/charmed-kubernetes-testing/+bug/1897818
This simplifies how the workers receive the API endpoint URLs by making
them always come from the master via the `kube-control` relation. It
also improves how status is reported when the endpoint address is not
available.

Part of [lp:1897818][]

[lp:1897818]: https://bugs.launchpad.net/charmed-kubernetes-testing/+bug/1897818
@johnsca johnsca force-pushed the johnsca/lp/1921776/support-loadbalancer-interface branch from d4c27ee to 20ffa9d Compare May 10, 2021 20:46
@johnsca
Copy link
Contributor Author

johnsca commented May 11, 2021

Here's a manual test run with this plus charmed-kubernetes/charm-kubernetes-control-plane#153, charmed-kubernetes/charm-kubernetes-control-plane#156, and charmed-kubernetes/layer-kubernetes-common#17, using a master pre-deployed into the model. Note that to get the test to work with the pre-deployed worker, you have to use the master branch of python-libjuju (for juju/python-libjuju#488) until the next version is released to PyPI:

tox -re integration --notest
.tox/integration/bin/pip uninstall juju
.tox/integration/bin/pip install --no-cache https://github.com/juju/python-libjuju/archive/refs/heads/master.zip#egg=juju

@johnsca johnsca marked this pull request as ready for review May 11, 2021 20:41
johnsca added a commit to charmed-kubernetes/charm-kubernetes-control-plane that referenced this pull request May 12, 2021
This adds support for the `loadbalancer` interface so that cloud-native
LBs can be provided by the integrator charms. Additionally, it
simplifies the confusing way the relations between the masters and
workers change depending on whether kubeapi-load-balancer is being used
or not by making that use the same `lb-provider` endpoint and always
forwarding the API endpoint URLs via the `kube-control` relation.

Part of [lp:1897818][]
Depends on:
  * juju-solutions/loadbalancer-interface#13
  * juju-solutions/interface-kube-control#33
  * charmed-kubernetes/charm-kubernetes-worker#84
  * charmed-kubernetes/charm-kubeapi-load-balancer#11

[lp:1897818]: https://bugs.launchpad.net/charmed-kubernetes-testing/+bug/1897818
johnsca added a commit to charmed-kubernetes/charm-kubernetes-control-plane that referenced this pull request May 13, 2021
This adds support for the `loadbalancer` interface so that cloud-native
LBs can be provided by the integrator charms. Additionally, it
simplifies the confusing way the relations between the masters and
workers change depending on whether kubeapi-load-balancer is being used
or not by making that use the same `lb-provider` endpoint and always
forwarding the API endpoint URLs via the `kube-control` relation.

Part of [lp:1897818][]
Depends on:
  * juju-solutions/loadbalancer-interface#13
  * juju-solutions/interface-kube-control#33
  * charmed-kubernetes/charm-kubernetes-worker#84
  * charmed-kubernetes/charm-kubeapi-load-balancer#11

[lp:1897818]: https://bugs.launchpad.net/charmed-kubernetes-testing/+bug/1897818
johnsca added a commit to charmed-kubernetes/charm-kubernetes-control-plane that referenced this pull request May 18, 2021
This adds support for the `loadbalancer` interface so that cloud-native
LBs can be provided by the integrator charms. Additionally, it
simplifies the confusing way the relations between the masters and
workers change depending on whether kubeapi-load-balancer is being used
or not by making that use the same `lb-provider` endpoint and always
forwarding the API endpoint URLs via the `kube-control` relation.

Part of [lp:1897818][]
Depends on:
  * juju-solutions/loadbalancer-interface#13
  * juju-solutions/interface-kube-control#33
  * charmed-kubernetes/charm-kubernetes-worker#84
  * charmed-kubernetes/charm-kubeapi-load-balancer#11

[lp:1897818]: https://bugs.launchpad.net/charmed-kubernetes-testing/+bug/1897818
Copy link
Contributor

@Cynerva Cynerva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions but LGTM

channel: edge
num_units: 1
resources:
easyrsa: 5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove resource revisions from the bundle. No point specifying them when we don't specify charm revisions.

expose: true
num_units: 1
options:
channel: 1.20/stable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.21/stable or 1.22/edge?

expose: true
num_units: 1
options:
channel: 1.20/stable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.21/stable or 1.22/edge?

@pytest.mark.abort_on_fail
async def test_build_and_deploy(ops_test):
cni_amd64 = ops_test.tmp_path / "cni-amd64.tgz"
urlretrieve(CNI_AMD64_URL, cni_amd64)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of the hard-coded CNI resource. What if someone changes the build script? The test wouldn't cover those changes.

I would consider building the resource here, just like we build the charm.

)

await ops_test.model.wait_for_idle(wait_for_active=True, timeout=10 * 60)
_check_status_messages(ops_test)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider removing the kube-api-endpoint relation at the end of the test, so future tests aren't running with weird relations in play.

Cynerva pushed a commit to charmed-kubernetes/charm-kubernetes-control-plane that referenced this pull request May 19, 2021
* Add support for loadbalancer interface

This adds support for the `loadbalancer` interface so that cloud-native
LBs can be provided by the integrator charms. Additionally, it
simplifies the confusing way the relations between the masters and
workers change depending on whether kubeapi-load-balancer is being used
or not by making that use the same `lb-provider` endpoint and always
forwarding the API endpoint URLs via the `kube-control` relation.

Part of [lp:1897818][]
Depends on:
  * juju-solutions/loadbalancer-interface#13
  * juju-solutions/interface-kube-control#33
  * charmed-kubernetes/charm-kubernetes-worker#84
  * charmed-kubernetes/charm-kubeapi-load-balancer#11

[lp:1897818]: https://bugs.launchpad.net/charmed-kubernetes-testing/+bug/1897818

* Fix lint error

* Add test for status reporting of incomplete LB relation

* Fix lint errors in test

* Fix hook error when built with old version of kube-control interface

* Split lb-provider endpoint into separate, more explicit ones for internal / external

* Fix handling of internal LB response and missing endpoints

* Move test to new LB relation pattern and use edge charms

* Improve status reporting around the auth-webhook and skip trying to create secrets before apiserver is available

* Create a ~/.kube/config for the ubuntu user

* Fix NoneType error for old-style relation

* Fix unit test

* Revert drive-by related to auth setup status reporting; splitting to separate bug
@Cynerva Cynerva merged commit 2ad6fb6 into master May 19, 2021
@Cynerva Cynerva deleted the johnsca/lp/1921776/support-loadbalancer-interface branch May 19, 2021 18:24
Cynerva pushed a commit to charmed-kubernetes/bundle that referenced this pull request May 24, 2021
* Support loadbalancer interface between master and API LB

Simplify the relations between the master, worker, and API LB charms in
favor of the newer `loadbalancer` interface relation.

Part of [lp:1897818][]
Depends on:
  * juju-solutions/loadbalancer-interface#13
  * juju-solutions/interface-kube-control#33
  * charmed-kubernetes/charm-kubernetes-control-plane#153
  * charmed-kubernetes/charm-kubernetes-worker#84
  * charmed-kubernetes/charm-kubeapi-load-balancer#11

[lp:1897818]: https://bugs.launchpad.net/charmed-kubernetes-testing/+bug/1897818

* Split k8s-master:lb-provider relation into external / internal

* Update core and converged bundle fragments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants