Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates k8s ingress resource to generate the current non-deprecated format #19215

Merged
merged 4 commits into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion generators/generator-constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const KUBERNETES_CORE_API_VERSION = 'v1';
const KUBERNETES_BATCH_API_VERSION = 'batch/v1';
const KUBERNETES_DEPLOYMENT_API_VERSION = 'apps/v1';
const KUBERNETES_STATEFULSET_API_VERSION = 'apps/v1';
const KUBERNETES_INGRESS_API_VERSION = 'networking.k8s.io/v1beta1';
const KUBERNETES_INGRESS_API_VERSION = 'networking.k8s.io/v1';
const KUBERNETES_ISTIO_NETWORKING_API_VERSION = 'networking.istio.io/v1beta1';
const KUBERNETES_RBAC_API_VERSION = 'rbac.authorization.k8s.io/v1';

Expand Down
15 changes: 11 additions & 4 deletions generators/kubernetes/templates/ingress.yml.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ metadata:
name: <%= app.baseName.toLowerCase() %>
namespace: <%= kubernetesNamespace %>
spec:
ingressClassName: <%= ingressType || "nginx" %>
rules:
<%_ if (ingressDomain) { _%>
- host: <%= app.baseName.toLowerCase() %>.<%= kubernetesNamespace %>.<%= ingressDomain %>
Expand All @@ -31,14 +32,20 @@ spec:
<%_ } _%>
paths:
- path: /<%= ingressTypeNginx ? "" : "*" %>
pathType: Prefix
backend:
serviceName: <%= app.baseName.toLowerCase() %>
servicePort: <%= app.serverPort %>
service:
name: <%= app.baseName.toLowerCase() %>
port:
name: http
<%_ if (!app.serviceDiscoveryType) { _%>
<%_ appConfigs.filter(config => config.baseName !== app.baseName).forEach(config => { _%>
- path: /services/<%= config.baseName.toLowerCase() %>/<%= ingressTypeNginx ? "" : "*" %>
pathType: Prefix
backend:
serviceName: <%= config.baseName.toLowerCase() %>
servicePort: <%= config.serverPort %>
service:
name: <%= config.baseName.toLowerCase() %>
port:
name: http
<%_ }); _%>
<%_ } _%>
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,16 @@ metadata:
name: jhipster-grafana
namespace: <%= kubernetesNamespace %>
spec:
ingressClassName: nginx
rules:
- host: jhipster-grafana.<%= kubernetesNamespace %>.<%= ingressDomain %>
http:
paths:
- path: /
pathType: Prefix
backend:
serviceName: jhipster-grafana
servicePort: 3000
service:
name: jhipster-grafana
port:
number: 3000
<%_ } _%>
10 changes: 7 additions & 3 deletions test/__snapshots__/kubernetes.helm.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1609,20 +1609,24 @@ spec:
"stateCleared": "modified",
},
"jhgate-helm/templates/jhgate-ingress.yml": Object {
"contents": "apiVersion: networking.k8s.io/v1beta1
"contents": "apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: jhgate
namespace: default
spec:
ingressClassName: gke
rules:
- host: jhgate.default.example.com
http:
paths:
- path: /*
pathType: Prefix
backend:
serviceName: jhgate
servicePort: 8080
service:
name: jhgate
port:
name: http
",
"stateCleared": "modified",
},
Expand Down
10 changes: 7 additions & 3 deletions test/__snapshots__/kubernetes.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1553,20 +1553,24 @@ spec:
"stateCleared": "modified",
},
"jhgate-k8s/jhgate-ingress.yml": Object {
"contents": "apiVersion: networking.k8s.io/v1beta1
"contents": "apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: jhgate
namespace: default
spec:
ingressClassName: nginx
rules:
- host: jhgate.default.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
serviceName: jhgate
servicePort: 8080
service:
name: jhgate
port:
name: http
",
"stateCleared": "modified",
},
Expand Down