charm-k8s-ingress:master

Last commit made on 2022-02-25
Get this branch:
git clone -b master https://git.launchpad.net/charm-k8s-ingress
Members of ingress-charmers can upload to this branch. Log in for directions.

Branch merges

Branch information

Name:
master
Repository:
lp:charm-k8s-ingress

Recent commits

392cc4e... by Claudiu Belu

Fixes Resource creation on missing relation data

At the moment, the charm will attempt to create Kubernetes Resources for relations which do not have relation data set yet in the multiple relations scenario. This will result in errors trying to create Services with invalid fields (e.g.: Service Port: Invalid value: 0: must be between 1 and 65535)

Skip adding resources for relations we don't have valid data from.

Reviewed-on: https://code.launchpad.net/~cbelu/charm-k8s-ingress/+git/charm-k8s-ingress/+merge/416021
Reviewed-by: Tom Haddon <email address hidden>

778f83c... by Claudiu Belu

Fixes adding unwanted routes from additional-hostnames

On multiple ingress relations for different service-hostnames (foo, bar), if the first relation has "bar" as an additional-hostname, it will wrongfully have the routes from the second relation.

This is happening because the same list of ingress paths are being used for all host-names and additional-hostnames.

When creating the Ingress Objects, a separate path list list is created for each hostname.

Reviewed-on: https://code.launchpad.net/~cbelu/charm-k8s-ingress/+git/charm-k8s-ingress/+merge/416022
Reviewed-by: Tom Haddon <email address hidden>

c7f215c... by Claudiu Belu

Improves the test code coverage

There are a few cases in which the test coverage could be improved.

Reviewed-on: https://code.launchpad.net/~cbelu/charm-k8s-ingress/+git/charm-k8s-ingress/+merge/416023
Reviewed-by: Tom Haddon <email address hidden>

c7fd43c... by Claudiu Belu

Improves the test code coverage

There are a few cases in which the test coverage could be improved.

9da2871... by Claudiu Belu

Fixes adding unwanted routes from additional-hostnames

On multiple ingress relations for different service-hostnames (foo, bar),
if the first relation has "bar" as an additional-hostname, it will wrongfully
have the routes from the second relation.

This is happening because the same list of ingress paths are being used
for all host-names and additional-hostnames.

When creating the Ingress Objects, a separate path list list is created for
each hostname.

32ead21... by Claudiu Belu

Fixes Resource creation on missing relation data

At the moment, the charm will attempt to create Kubernetes Resources for
relations which do not have relation data set yet in the multiple relations
scenario. This will result in errors trying to create Services with invalid
fields (e.g.: Service Port: Invalid value: 0: must be between 1 and 65535)

Skip adding resources for relations we don't have valid data from.

03f3bab... by Tom Haddon

Add docstrings and remove note referring to an individual in unit tests

Reviewed-on: https://code.launchpad.net/~mthaddon/charm-k8s-ingress/+git/charm-k8s-ingress/+merge/415662
Reviewed-by: Jon Seager <email address hidden>
Reviewed-by: 🤖 prod-jenkaas-is <email address hidden>

e7f7b40... by Tom Haddon

Add docstrings and remove note referring to an individual in unit tests

59f1ca1... by Claudiu Belu

Adds multiple ingress relations support

Removes the 1 limit from metadata.yaml

Currently, the Ingress Name is based on the service-name. However, that
name can be a bit inconsistent when it comes to having multiple relations.
Changes the Ingress Name used to app.name-ingress.

The nginx/nginx-ingress Controller typically used in EKS doesn't handle
multiple Kubernetes Ingress Resources having the same hostname in the same
way as the k8s.gcr.io/ingress-nginx/controller:v1.1.0 Controller used in
microk8s. The former doesn't handle them at all, unless you specify certain
annotations, and an additional Kubernetes Ingress Resource [1]. But both
Controllers can handle one Kubernetes Ingress Resource containing multiple
hosts / routes.

This charm will now group all the Ingress rules by the required hostnames
from all the relations (with config option overrides) and create Kubernetes
Ingress Resources per required hostname. When a relation is broken, its
ingress-related data will be removed from the Ingress Resources. If no
relation will require a particular Ingress Resource anymore, it will be
removed.

Creates a single Kubernetes Ingress Resource containing all the hosts and
path rules from all the relations (with config option overrides). When
a relation is broken, its ingress-related data will be removed from the
Ingress Resource. If there are no relations left, the Resource will be removed.

Adds TLS information for each additional-hostname defined (each new hostname
has its own Kubernetes Ingress Resource).

On multiple relations, if we're required to have different annotations
on the same Ingress Resource (same hostname), we cannot satisfy that
request. In this case, we enter BlockedStatus.

On multiple relations, if there are multiple matching route paths on the
same hostname, we enter BlockedStatus.

Adds unit tests to validate the cases in which multiple relations are being
used.

On multiple relations, we should use the service-name, service-port,
and route-paths from the relation data fist, instead of reading them
from the config options first. This will prevent us from having
Service name conflicts and route path conflicts.

If there is only one relation, the config option will still override
the relation data (to maintain backwards compatibility).

[1] https://github.com/nginxinc/kubernetes-ingress/tree/master/examples/mergeable-ingress-types

370de28... by Claudiu Belu

Refactors charm for adding multiple relations support

Updates IngressBrokenEvent to be based on RelationEvent, and
include the relation in the event data, which will help us
determine which relation has been broken.

Separates the config / relation data into the _ConfigOrRelation object,
which receives the config and a relation in its constructor. This will allow
us to get necessary data from a specific relation (which is overriden by the
config options).