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

[appmesh-gateway] Support passing in custom namespaceSelector for VirtualGateway #428

Open
hscheib opened this issue Jan 18, 2021 · 0 comments · May be fixed by #1154
Open

[appmesh-gateway] Support passing in custom namespaceSelector for VirtualGateway #428

hscheib opened this issue Jan 18, 2021 · 0 comments · May be fixed by #1154
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@hscheib
Copy link

hscheib commented Jan 18, 2021

Is your feature request related to a problem?
Yes, two versions of the same chart cant be used in two namespaces on the same cluster.

I created two namespaces (apps and service) and have the appmesh.k8s.aws/sidecarInjectorWebhook: enabled annotation on both of them for app mesh side car injection. I have installed appmesh-controller : 1.2.1. I then helm install the appmesh-gateway : 0.1.5 helm chart to both namespaces. The problem happens now when I try to apply a Kind: GatewayRoute to the cluster. I get:

admission webhook "mgatewayroute.appmesh.k8s.aws" denied the request: found multiple matching virtualGateways for namespace: service, expecting 1 but found 2: appmesh-gateway,service-gateway-appmesh-gateway

Is your feature request related to a specific Helm chart, if yes mention name of the chart?
Yes, appmesh-gateway

Describe the solution you'd like
I would like to be able to pass in my own namespace selector value instead of always relying on the hardcoded namespaceSelector that exists today. The annotation appmesh.k8s.aws/sidecarInjectorWebhook: enabled is required for the sidecar injects and is not unique across namespaces.

ie:

values:
    appmesh:
        gateway:
            namespaceSelector:
                gateway: apps-gateway

Describe alternatives you've considered
I was able to get around this by updating my values of the charts to

values:
    appmesh:
        gateway: false

and then manually creating my own Kind: VirtualGateway with a namespaceSelector I pick that is unique per namespace

ie:

---
apiVersion: appmesh.k8s.aws/v1beta2
kind: Mesh
metadata:
  name: stage
spec:
  namespaceSelector:
    matchLabels:
      mesh: stage
---
apiVersion: v1
kind: Namespace
metadata:
  labels:
    mesh: stage
    gateway: apps-gateway
    appmesh.k8s.aws/sidecarInjectorWebhook: enabled
  name: apps
---
apiVersion: v1
kind: Namespace
metadata:
  labels:
    mesh: stage
    gateway: service-gateway
    appmesh.k8s.aws/sidecarInjectorWebhook: enabled
  name: service
---
apiVersion: appmesh.k8s.aws/v1beta2
kind: VirtualGateway
metadata:
  name: service-gateway
  namespace: service
spec:
  namespaceSelector:
    matchLabels:
      gateway: service-gateway
  podSelector:
    matchLabels:
      app.kubernetes.io/name: service-gateway-appmesh-gateway
  listeners:
    - portMapping:
        port: 8088
        protocol: http
  logging:
    accessLog:
      file:
        path: "/dev/stdout"
---
apiVersion: appmesh.k8s.aws/v1beta2
kind: VirtualGateway
metadata:
  name: apps-gateway
  namespace: apps
spec:
  namespaceSelector:
    matchLabels:
      gateway: apps-gateway
  podSelector:
    matchLabels:
      app.kubernetes.io/name: appmesh-gateway
  listeners:
    - portMapping:
        port: 8088
        protocol: http
  logging:
    accessLog:
      file:
        path: "/dev/stdout"

Creating GatewayRoutes were then successful. This request will simplify creating multiple VirtualGateways across namespaces when using appmesh-gateway helm chart.

@hscheib hscheib added the enhancement New feature or request label Jan 18, 2021
@fawadkhaliq fawadkhaliq added the help wanted Extra attention is needed label Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
2 participants