Last active
January 16, 2023 16:40
-
-
Save seeker815/1abb0f94adfbf342a39c3534b350b4c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ingress = new k8s.networking.v1.Ingress(`api-ingress-${projectEnv}`, { | |
metadata: { | |
namespace: appNs.metadata.name, | |
annotations: { | |
"kubernetes.io/ingress.class": "gce", | |
"kubernetes.io/ingress.allow-http": "true", | |
"kubernetes.io/ingress.global-static-ip-name": webIP.name, | |
"cert-manager.io/issuer": "letsencrypt-dev-api", | |
}, | |
name: `api-ingress-${projectEnv}`, | |
}, | |
spec: { | |
tls: [ | |
{ | |
hosts: [domainHost], | |
secretName: issuerSecret.metadata.name, | |
}, | |
], | |
rules: [ | |
{ | |
host: domainHost, | |
http: { | |
paths: [ | |
{ | |
path: "/*", | |
pathType: "ImplementationSpecific", | |
backend: { | |
service: { | |
name: app_api_serviceService.metadata.name, | |
port:{ | |
number: 80, | |
}, | |
}, | |
}, | |
}, | |
], | |
}, | |
}, | |
], | |
}, | |
}, { dependsOn: [appNs, webIP]}) | |
const issuer = new k8s.apiextensions.CustomResource(issuerName, { | |
apiVersion: "cert-manager.io/v1", | |
kind: "Issuer", | |
metadata: { | |
namespace: appNS.metadata.name, | |
name: issuerName, | |
}, | |
spec: { | |
acme: { | |
server: "https://acme-v02.api.letsencrypt.org/directory", | |
email: "@.co", | |
privateKeySecretRef: { | |
name: issuerSecret.metadata.name, | |
}, | |
solvers: [{ | |
http01: { | |
ingress: { | |
name: ingress.metadata.name, | |
}, | |
}, | |
}], | |
}, | |
}, | |
},{provider: clusterProvider}, | |
{ dependsOn: [ingress, webIP]}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment