Support wildcard certs.
Some checks failed
Lint Checks / Run linter (pull_request) Successful in 39s
Deploy Test / Run deploy test suite (pull_request) Successful in 3m36s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Failing after 3m3s
Smoke Test / Run basic test suite (pull_request) Successful in 2m37s
Webapp Test / Run webapp test suite (pull_request) Successful in 5m1s
Some checks failed
Lint Checks / Run linter (pull_request) Successful in 39s
Deploy Test / Run deploy test suite (pull_request) Successful in 3m36s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Failing after 3m3s
Smoke Test / Run basic test suite (pull_request) Successful in 2m37s
Webapp Test / Run webapp test suite (pull_request) Successful in 5m1s
This commit is contained in:
parent
cc541ac20f
commit
e81c95a920
@ -110,13 +110,33 @@ class ClusterInfo:
|
||||
http_proxy_info = http_proxy_info_list[0]
|
||||
if opts.o.debug:
|
||||
print(f"http-proxy: {http_proxy_info}")
|
||||
# TODO: good enough parsing for webapp deployment for now
|
||||
|
||||
host_name = http_proxy_info["host-name"]
|
||||
|
||||
tls = None
|
||||
tls_issuer = None
|
||||
|
||||
if use_tls:
|
||||
tls_info = http_proxy_info.get("tls", {})
|
||||
tls_hosts = tls_info.get("hosts", [host_name])
|
||||
tls_issuer = tls_info.get("issuer", "letsencrypt-prod")
|
||||
tls_secret_name = f"{self.app_name}-tls"
|
||||
if "secret" in tls_info:
|
||||
# If an existing secret is specified, unset the issuer so
|
||||
# we don't try to re-request it.
|
||||
tls_secret_name = tls_info["secret"]
|
||||
tls_issuer = None
|
||||
|
||||
if opts.o.debug:
|
||||
print(f"TLS hosts/secret: {tls_hosts}/{tls_secret_name}")
|
||||
|
||||
tls = [client.V1IngressTLS(
|
||||
hosts=tls_hosts,
|
||||
secret_name=tls_secret_name
|
||||
)]
|
||||
|
||||
# TODO: good enough parsing for webapp deployment for now
|
||||
rules = []
|
||||
tls = [client.V1IngressTLS(
|
||||
hosts=[host_name],
|
||||
secret_name=f"{self.app_name}-tls"
|
||||
)] if use_tls else None
|
||||
paths = []
|
||||
for route in http_proxy_info["routes"]:
|
||||
path = route["path"]
|
||||
@ -147,13 +167,15 @@ class ClusterInfo:
|
||||
tls=tls,
|
||||
rules=rules
|
||||
)
|
||||
annotations = {
|
||||
"kubernetes.io/ingress.class": "nginx",
|
||||
}
|
||||
if tls_issuer:
|
||||
annotations["cert-manager.io/cluster-issuer"] = tls_issuer
|
||||
ingress = client.V1Ingress(
|
||||
metadata=client.V1ObjectMeta(
|
||||
name=f"{self.app_name}-ingress",
|
||||
annotations={
|
||||
"kubernetes.io/ingress.class": "nginx",
|
||||
"cert-manager.io/cluster-issuer": "letsencrypt-prod"
|
||||
}
|
||||
annotations=annotations
|
||||
),
|
||||
spec=spec
|
||||
)
|
||||
|
@ -91,49 +91,44 @@ class Spec:
|
||||
self.file_path = file_path
|
||||
|
||||
def get_image_registry(self):
|
||||
return (self.obj[constants.image_registry_key]
|
||||
if self.obj and constants.image_registry_key in self.obj
|
||||
else None)
|
||||
return self.obj.get(constants.image_registry_key)
|
||||
|
||||
def get_volumes(self):
|
||||
return (self.obj["volumes"]
|
||||
if self.obj and "volumes" in self.obj
|
||||
else {})
|
||||
return self.obj.get(constants.volumes_key, {})
|
||||
|
||||
def get_configmaps(self):
|
||||
return (self.obj["configmaps"]
|
||||
if self.obj and "configmaps" in self.obj
|
||||
else {})
|
||||
return self.obj.get(constants.configmap)
|
||||
|
||||
def get_container_resources(self):
|
||||
return Resources(self.obj.get("resources", {}).get("containers", {}))
|
||||
return Resources(self.obj.get(constants.resources_key, {})
|
||||
.get("containers", {}))
|
||||
|
||||
def get_volume_resources(self):
|
||||
return Resources(self.obj.get("resources", {}).get("volumes", {}))
|
||||
return Resources(self.obj.get(constants.resources_key, {})
|
||||
.get(constants.volumes_key, {}))
|
||||
|
||||
def get_http_proxy(self):
|
||||
return (self.obj[constants.network_key][constants.http_proxy_key]
|
||||
if self.obj and constants.network_key in self.obj
|
||||
and constants.http_proxy_key in self.obj[constants.network_key]
|
||||
else None)
|
||||
return self.obj.get(constants.network_key, {}).get(constants.http_proxy_key, [])
|
||||
|
||||
def get_annotations(self):
|
||||
return self.obj.get("annotations", {})
|
||||
return self.obj.get(constants.annotations_key, {})
|
||||
|
||||
def get_labels(self):
|
||||
return self.obj.get("labels", {})
|
||||
return self.obj.get(constants.labels_key, {})
|
||||
|
||||
def get_privileged(self):
|
||||
return "true" == str(self.obj.get("security", {}).get("privileged", "false")).lower()
|
||||
return "true" == str(self.obj.get(constants.security_key, {})
|
||||
.get("privileged", "false")).lower()
|
||||
|
||||
def get_capabilities(self):
|
||||
return self.obj.get("security", {}).get("capabilities", [])
|
||||
return self.obj.get(constants.security_key, {}).get("capabilities", [])
|
||||
|
||||
def get_deployment_type(self):
|
||||
return self.obj[constants.deploy_to_key]
|
||||
return self.obj.get(constants.deploy_to_key)
|
||||
|
||||
def is_kubernetes_deployment(self):
|
||||
return self.get_deployment_type() in [constants.k8s_kind_deploy_type, constants.k8s_deploy_type]
|
||||
return self.get_deployment_type() in [constants.k8s_kind_deploy_type,
|
||||
constants.k8s_deploy_type]
|
||||
|
||||
def is_kind_deployment(self):
|
||||
return self.get_deployment_type() in [constants.k8s_kind_deploy_type]
|
||||
|
Loading…
Reference in New Issue
Block a user