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

Set ImplementationSpecific as default for Ingress path type #363

Merged
merged 3 commits into from
Apr 5, 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
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