Skip to content

Commit

Permalink
Merge pull request #58 from flanksource/rm-ingress-defaulting
Browse files Browse the repository at this point in the history
feat: remove ingress default processing
  • Loading branch information
moshloop authored Jun 28, 2021
2 parents be0a623 + a0df2c1 commit 7dac6b4
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
networking "k8s.io/api/networking/v1"
rbac "k8s.io/api/rbac/v1"
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
Expand All @@ -15,27 +14,6 @@ import (

var defaulter = runtime.NewScheme()

func DefaultsIngress(ing *networking.Ingress) *networking.Ingress {
defaulter.Default(ing)
implementationSpecific := networking.PathTypeImplementationSpecific
_rules := []networking.IngressRule{}
for _, rule := range ing.Spec.Rules {
if rule.HTTP != nil {
_paths := []networking.HTTPIngressPath{}
for _, path := range rule.HTTP.Paths {
if path.PathType == nil {
path.PathType = &implementationSpecific
}
_paths = append(_paths, path)
}
rule.HTTP.Paths = _paths
}
_rules = append(_rules, rule)
}
ing.Spec.Rules = _rules
return ing
}

func DefaultsService(svc *v1.Service) *v1.Service {
defaulter.Default(svc)
_ports := []v1.ServicePort{}
Expand Down Expand Up @@ -355,13 +333,6 @@ func Defaults(obj *unstructured.Unstructured) (*unstructured.Unstructured, error
return nil, err
}
return ToUnstructured(obj, DefaultsClusterRoleBinding(rb))
} else if IsIngress(obj) {
ing, err := AsIngress(obj)
if err != nil {
return nil, err
}
return ToUnstructured(obj, DefaultsIngress(ing))

}

return obj, nil
Expand Down

0 comments on commit 7dac6b4

Please sign in to comment.