Skip to content

Use default K8S ingress annotations #13

@jonatasbaldin

Description

@jonatasbaldin

Expected Behaviour

Instead of using spec.ingressType to select an Ingress class, we should use the default annotation kubernetes.io/ingress.class, since #7 was implemented.

Current Behaviour

In the version 0.4.0, by the docs, we need to define the Ingress class using the spec.ingressType configuration.

BUT

After merging #7 we actually don't need that. I tested two cases:

Empty annotation and spec.ingressType

Deploying the following FunctionIngress without spec.ingressType and without kubernetes.io/ingress.class annotation defaults the Ingress class to nginx and works. I believe this should be considered a bug and specifying an Ingress class should be mandatory.

apiVersion: openfaas.com/v1alpha2
kind: FunctionIngress
metadata:
  name: nodeinfo
  namespace: openfaas
spec:
  domain: "nodeinfo.deployeveryday.com"
  function: "nodeinfo"
  # ingressType: "nginx"  # disable ingressType

Use kubernetes.io/ingress.class annotation

Deploying the following FunctionIngress without spec.ingressType but using the kubernetes.io/ingress.class works like a charm. I believe this should be the default way of doing things.

apiVersion: openfaas.com/v1alpha2
kind: FunctionIngress
metadata:
  name: nodeinfo
  namespace: openfaas
  annotations:
    # Uses default K8S annotation
    kubernetes.io/ingress.class: "nginx"
spec:
  domain: "nodeinfo.deployeveryday.com"
  function: "nodeinfo"
  # ingressType: "nginx"  # disable ingressType

Possible Solution

  1. getClass should yield an error if not class is defined.
  2. makeAnnotations should get the Class from annotations and not from function.Spec.IngressType.

Context

Using the default K8S annotation to select an Ingress class requires lower learning curve and it's more a standard across other K8S controllers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions