canonical / canonical/charm-integration-testing

nginx-ingress-integrator has no charm-overrides file: solver connects mutually-exclusive ingress/nginx-route relations and omits required service-hostname config

Open Beginner friendly
#958 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6
Forks
1
Avg merge
1d 20h
Merged PRs (30d)
96

Description

Summary

nginx-ingress-integrator has no static/charm-overrides/nginx-ingress-integrator.yaml file. As a result the bundle solver treats ingress and nginx-route (both provides) as independently optional/required with no relationship between them, and never sets the service-hostname config the charm requires when ingress is connected. This produces bundles the charm cannot actually run.

Reproduction

Test plan: integration/nginx-ingress-integrator:ingress/ingress/traefik-k8s:upstream-ingress (SQT-1178 traefik-k8s QA, revision 378, latest/stable).

./scripts/run-tests.sh \
  --target-cloud "local-k8s" \
  --target-charm "traefik-k8s" --target-endpoint "upstream-ingress" \
  --target-channel "latest/stable" --target-revision "378" \
  --target-platform "kubernetes" --target-application "target" \
  --neighbor-charm "nginx-ingress-integrator" --neighbor-endpoint "ingress" \
  --neighbor-platform "kubernetes" --neighbor-application "neighbor" \
  --current-state "no_bundle" \
  --charm-overrides "./static/charm-overrides/"

(Requires the platform-detection fix in #956 / PR for nginx-ingress-integrator to be treated as kubernetes-only first; otherwise the run fails earlier with a platform mismatch.)

Observed failure 1: both mutually-exclusive endpoints connected

With no override, the solver additionally pulled in wordpress-k8s (needs nginx-route) alongside traefik-k8s (needs ingress), connecting neighbor to both endpoints simultaneously. juju status showed:

neighbor/0*  blocked   idle   ...  Both nginx-route and ingress relations found, please remove either one.

Confirmed in nginx-ingress-integrator-operator source, src/charm.py::_check_precondition:

if nginx_route_relation is not None and ingress_relation is not None:
    raise InvalidIngressError(
        "Both nginx-route and ingress relations found, please remove either one."
    )

Also _update_ingress sets WaitingStatus("waiting for relation") forever if neither is connected (src/charm.py) - so exactly one of the two must be connected, never zero, never both.

Observed failure 2: missing service-hostname config

After constraining to exactly one endpoint, neighbor still blocked when only ingress was connected:

neighbor/0*  blocked   idle   ...  service-hostname is not set for the ingress relation, configure it using `juju config`

Confirmed in src/ingress_definition.py::IngressDefinitionEssence.service_hostname:

service_hostname = cast(str, self._get_config_or_relation_data("service-hostname", ""))
if not service_hostname:
    if self.is_ingress_relation:
        raise InvalidIngressError(
            "service-hostname is not set for the ingress relation, "
            "configure it using `juju config`"
        )

For the ingress (ingress-per-app) interface there is no relation-data fallback for hostname (unlike nginx-route, whose requirer passes it via relation data), so service-hostname config must be set whenever ingress is connected.

Fix

Add static/charm-overrides/nginx-ingress-integrator.yaml:

  • provides.ingress / provides.nginx-route: both optional: true, constrained by len(endpoint[ingress]) + len(endpoint[nginx-route]) == 1 (exactly one).
  • requires.certificates: optional: true (_get_tls_relation() returns early without it).
  • configs.service-hostname: ['nginx-ingress-integrator.test', null] with constraint bool(endpoint[ingress]) => set(config[service-hostname]).

Validated: solver now produces a single-endpoint bundle with service-hostname set; deployed end-to-end on a k8s model (traefik-k8s rev378 latest/stable + nginx-ingress-integrator), both units reach active.

Fixed on branch SQT-1178/nginx-ingress-integrator-exclusive-relations (stacked on the platform-detection fix, since this charm was previously misdetected as machine-only).

Related: SQT-1178, depends on #956 (nginx-ingress-integrator platform detection).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with scripts/run-tests.sh and the reproduction command, then inspect the existing files under static/charm-overrides/ for the expected YAML structure. Add static/charm-overrides/nginx-ingress-integrator.yaml with the stated endpoint, certificates, and service-hostname constraints. Done means the solver selects exactly one ingress endpoint, sets service-hostname when ingress is used, and the k8s deployment reaches active.

Written by the indexing model from the issue text.

Assessment

Tech stack
kubernetes, python, yaml
Domain
devops, testing
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.