Skip to content

Commit

Permalink
Merge pull request #386 from pehala/configurable_issuer
Browse files Browse the repository at this point in the history
Configurable issuer
  • Loading branch information
pehala authored May 13, 2024
2 parents 665a629 + af272dc commit c2852f1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ This repository contains end-to-end tests for Kuadrant project. It supports runn
* Existing ManagedZone, named `aws-mz` (name defined in `control_plane.managedzone`)

### TLSPolicy tests
* Existing ClusterIssuer, named `selfsigned-cluster-issuer`

* Existing self-signed ClusterIssuer, named `selfsigned-cluster-issuer` (name defined in `control_plane.clusterissuer`)
* (Optional) Existing lets-encrypt ClusterIssuer, named `letsencrypt-staging` (name defined in `letsencrypt.clusterissuer`)

## Configuration

Expand Down
3 changes: 3 additions & 0 deletions config/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ default:
default_exposer: "openshift"
control_plane:
managedzone: "aws-mz"
clusterissuer: "selfsigned-cluster-issuer"
letsencrypt:
clusterissuer: "letsencrypt-staging"
2 changes: 2 additions & 0 deletions testsuite/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def __init__(self, name, default, **kwargs) -> None:
messages={"condition": "{value} is not valid exposer"},
),
Validator("control_plane.managedzone", must_exist=True, ne=None),
Validator("control_plane.clusterissuer", must_exist=True, ne=None),
Validator("letsencrypt.clusterissuer", must_exist=True, ne=None),
DefaultValueValidator("rhsso.url", default=fetch_route("no-ssl-sso")),
DefaultValueValidator("rhsso.password", default=fetch_secret("credential-sso", "ADMIN_PASSWORD")),
DefaultValueValidator("mockserver.url", default=fetch_route("mockserver", force_http=True)),
Expand Down
4 changes: 2 additions & 2 deletions testsuite/tests/kuadrant/gateway/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ def exposer(request, hub_openshift) -> Exposer:


@pytest.fixture(scope="session")
def cluster_issuer():
def cluster_issuer(testconfig):
"""Reference to cluster self-signed certificate issuer"""
return CustomReference(
group="cert-manager.io",
kind="ClusterIssuer",
name="selfsigned-cluster-issuer",
name=testconfig["control_plane"]["clusterissuer"],
)


Expand Down
10 changes: 6 additions & 4 deletions testsuite/tests/kuadrant/gateway/test_external_ca.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,18 @@


@pytest.fixture(scope="module")
def cluster_issuer(hub_openshift):
def cluster_issuer(testconfig, hub_openshift):
"""Reference to cluster Let's Encrypt certificate issuer"""
testconfig.validators.validate(only="letsencrypt")
name = testconfig["letsencrypt"]["clusterissuer"]
try:
selector("clusterissuer/letsencrypt-staging", static_context=hub_openshift.context).object()
selector(f"clusterissuer/{name}", static_context=hub_openshift.context).object()
except OpenShiftPythonException as exc:
pytest.skip(f"letsencrypt-staging ClusterIssuer is not present on the cluster: {exc}")
pytest.skip(f"{name} ClusterIssuer is not present on the cluster: {exc}")
return CustomReference(
group="cert-manager.io",
kind="ClusterIssuer",
name="letsencrypt-staging",
name=name,
)


Expand Down

0 comments on commit c2852f1

Please sign in to comment.