cdk8s-team/cdk8s-plus

Provide support for Ingress Annotation Actions

julian91 opened this issue · 1 comments

Support Ingress Annotation Actions seems to have disappeared by moving from cdk8s to cdk8s-plus.

Ingress Rules can only be added fromService or fromResource, which do not allow to define the action in any way.

The use case is for example to hide API-Docs from the public ingress and only expose them privately.

in cdk8s, the whole thing looked like this:
i have an ingress with the annotation

'alb.ingress.kubernetes.io/actions.blackhole': '{"type":"fixed-response","fixedResponseConfig":{"contentType":"text/plain","statusCode":"404","messageBody":"I   P R O T E C C   B R U V !"}}'

and the rules:

rules: {
  host,
  http: {
    paths: [
      // we disable swagger on PUBLIC prod services and deliver a 404
      {
        path: `/v1`,
        backend: {
          serviceName: 'blackhole',
          servicePort: 'use-annotation'
        }
      },
      {
        path: '/*',
        backend: {
          serviceName,
          servicePort
        }
      }
    ]
  }
}

In CDK8S-Plus i create my ingress, and then add the rules to it:

a suggestions of how this could look like based on annotations:

ingress.addRule('/v1', IngressBackend.fromAnnotationAction('blackhole'))

This issue has not received any attention in 1 year and will be closed soon. If you want to keep it open, please leave a comment below @mentioning a maintainer.