Ministack: Free, open-source local AWS emulator - 60+ services, Terraform compatible, real databases. Free forever. MIT licensed.
Python awsaws-emulatoraws-localaws-sdkdevtoolsdockerdynamodbec2emulatorlambdalocalstacklocalstack-alternativeministackmock-awsopen-sourcepythons3sqsterraform
fix(eks): https support in use_ssl (#1047)
Nahuel Nucera60eaa218edf2
diff --git a/ministack/services/eks.py b/ministack/services/eks.pyindex 9bac0d4f..02a2f346 100644--- a/ministack/services/eks.py+++ b/ministack/services/eks.py@@ -67,8 +67,20 @@ _oidc_keypair = None # (private_key, jwk_dict, kid)def _ministack_issuer_base():+ """Base URL ministack advertises as the cluster's OIDC issuer.++ The scheme tracks the gateway's actual protocol: the discovery/JWKS+ documents are served by ministack's own gateway, so the issuer must say+ https only when the gateway is serving TLS (``USE_SSL=1``) and http+ otherwise. Advertising https on a plain-http gateway would make any client+ that fetches the discovery document fail. Real EKS issuers are always+ https, so run with ``USE_SSL=1`` for IRSA terraform, whose+ ``aws_iam_openid_connect_provider`` client-side rejects non-https urls.+ """+ from ministack.core import tls as _tls+ scheme = "https" if _tls.use_ssl_enabled() else "http"port = os.environ.get("GATEWAY_PORT", "4566")- return f"http://{_MINISTACK_HOST}:{port}/oidc"+ return f"{scheme}://{_MINISTACK_HOST}:{port}/oidc"def _new_oidc_id():diff --git a/tests/test_eks.py b/tests/test_eks.pyindex 25aae8a2..f5a47fdb 100644--- a/tests/test_eks.py+++ b/tests/test_eks.py@@ -487,6 +487,33 @@ def test_eks_oidc_discovery_document(eks):pass+def test_eks_oidc_issuer_scheme_https_when_tls(monkeypatch):+ """With USE_SSL=1 the gateway serves TLS, so the advertised OIDC issuer and+ the discovery document both report https (terraform's+ aws_iam_openid_connect_provider rejects non-https urls). Called in-process."""+ from ministack.services import eks as eks_svc++ monkeypatch.setenv("USE_SSL", "1")+ oidc_id = eks_svc._new_oidc_id()+ issuer = eks_svc._issuer_url(oidc_id)+ assert issuer.startswith("https://"), issuer+ assert "/oidc/id/" in issuer, issuer++ status, _headers, body = eks_svc._oidc_discovery(oidc_id)+ assert status == 200+ doc = json.loads(body)+ assert doc["issuer"] == issuer+ assert doc["jwks_uri"] == f"{issuer}/keys"+++def test_eks_oidc_issuer_scheme_http_without_tls(monkeypatch):+ """Default (no TLS) keeps http, matching what the plain-http gateway serves."""+ from ministack.services import eks as eks_svc++ monkeypatch.delenv("USE_SSL", raising=False)+ assert eks_svc._ministack_issuer_base().startswith("http://")++# ---------------------------------------------------------------------------# Access Entries — modern EKS IAM bindings (replace aws-auth ConfigMap).# Crossplane / Terraform `aws_eks_access_entry` + `aws_eks_access_policy_association`