-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(utils/k8s_scripts): Add ApplyKubernetesApiIngress method
- Loading branch information
1 parent
e739aa4
commit 5017e86
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package k8s_scripts | ||
|
||
func ApplyKubernetesApiIngress(domain string, dry bool) { | ||
sh(`cat <<EOF | kubectl apply -f - | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: kubernetes-api | ||
namespace: default | ||
annotations: | ||
cert-manager.io/cluster-issuer: letsencrypt | ||
nginx.ingress.kubernetes.io/backend-protocol: HTTPS | ||
spec: | ||
ingressClassName: nginx | ||
tls: | ||
- hosts: | ||
- `+domain+` | ||
secretName: `+domain+`-tls | ||
rules: | ||
- host: `+domain+` | ||
http: | ||
paths: | ||
- backend: | ||
service: | ||
name: kubernetes | ||
port: | ||
number: 443 | ||
path: / | ||
pathType: Prefix | ||
EOF`, dry) | ||
} |