aws / aws/eks-charts

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

Open
#428 0 comments 2 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
Mustache
Stars
1.3k
Forks
1.1k
Avg merge
22m
Merged PRs (30d)
5

Description

**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.

Contributor guide

Open the contributing guide

Research direction

Start by inspecting the appmesh-gateway Helm chart's values and the template that creates the VirtualGateway. Trace how the current namespaceSelector is rendered, then verify that a supplied appmesh.gateway.namespaceSelector is used in the rendered manifest and that the chart still installs successfully for multiple namespaces.

Written by the indexing model from the issue text.

Assessment

Tech stack
helm, kubernetes
Domain
devops, infrastructure
Issue type
Feature
Difficulty
2/5
Estimated time
Half a day
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.