Skip to content

Instantly share code, notes, and snippets.

@seeker815
Last active January 16, 2023 16:40
Show Gist options
  • Save seeker815/1abb0f94adfbf342a39c3534b350b4c8 to your computer and use it in GitHub Desktop.
Save seeker815/1abb0f94adfbf342a39c3534b350b4c8 to your computer and use it in GitHub Desktop.
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