Skip to content

Commit

Permalink
Merge pull request #363 from application-stacks/pathtype-default
Browse files Browse the repository at this point in the history
Set ImplementationSpecific as default for Ingress path type
  • Loading branch information
halim-lee committed Apr 5, 2022
2 parents 8e29709 + d2fba5b commit 00ecc1f
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 2 deletions.
13 changes: 13 additions & 0 deletions bundle/tests/scorecard/minikube-kuttl/ingress/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,16 @@ status:
replicas: 1
readyReplicas: 1
updatedReplicas: 1
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress
spec:
rules:
- host: myapp.mycompany.com
http:
paths:
- path: /
pathType: ImplementationSpecific

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: rc.app.stacks/v1beta2
kind: RuntimeComponent
metadata:
name: ingress
spec:
# Add fields here
route:
host: myapp.mycompany.com
path: "/"
pathType:
8 changes: 8 additions & 0 deletions bundle/tests/scorecard/minikube-kuttl/ingress/02-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ingress
status:
replicas: 1
readyReplicas: 1
updatedReplicas: 1
2 changes: 1 addition & 1 deletion doc/user-guide-v1beta2.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ spec:

===== Advanced Ingress configuration:

Most of the Ingress configuraiton is achieved through annotations. Annotations such as Nginx, HAProxy, Traefik, and others are specific to the ingress controller implementation.
Most of the Ingress configuration is achieved through annotations. Annotations such as Nginx, HAProxy, Traefik, and others are specific to the ingress controller implementation.

You can provide an existing TLS secret and set a custom hostname.

Expand Down
7 changes: 6 additions & 1 deletion utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,8 @@ func CustomizeIngress(ing *networkingv1.Ingress, ba common.BaseComponent) {
servicePort := strconv.Itoa(int(ba.GetService().GetPort())) + "-tcp"
host := ""
path := ""
var pathType networkingv1.PathType
pathType := networkingv1.PathType("")

rt := ba.GetRoute()
if rt != nil {
host = rt.GetHost()
Expand All @@ -924,6 +925,10 @@ func CustomizeIngress(ing *networkingv1.Ingress, ba common.BaseComponent) {
l.Info("No Ingress hostname is provided. Ingress might not function correctly without hostname. It is recommended to set Ingress host or to provide default value through operator's config map.")
}

if pathType == "" {
pathType = networkingv1.PathTypeImplementationSpecific
}

ing.Spec.Rules = []networkingv1.IngressRule{
{
Host: host,
Expand Down

0 comments on commit 00ecc1f

Please sign in to comment.