Linkerd2: auto-proxy support for namespaces

Created on 14 Aug 2019  ·  12Comments  ·  Source: linkerd/linkerd2

Feature Request

What problem are you trying to solve?

Now that auto-proxy works, please teach linkerd inject how to annotate a namespace like:

kubectl get ns/default -o yaml | linkerd inject -

So that anything added to said namespace magically gets linkerd mesh support!

Any alternatives you've considered?

Currently, we are running a kubectl patch, but this is not as clean.

This is as of linkerd v2.4 stable.

arecli good first issue help wanted

All 12 comments

Hi, I am a new contributor here. If no one is working on this issue, I would like to help. :)

Go for it, that would be awesome!

Just wanted to make sure that I understand this issue well.

The docs here say that :

Linkerd automatically adds the data plane proxy to pods when the linkerd.io/inject: enabled annotation is present on a namespace, deployment, or pod. This is known as “proxy injection”.

This suggest that a pod that runs on the said namespace can automatically get linkerd support if the namespace has been injected.
I think, this already solves the problem addressed in this issue.

This issue is a little different than that. When you run kubectl get deploy -o yaml | linkerd inject -, the inject command will add the annotation for you. Right now, when you do kubectl get namespace -o yaml | linkerd inject -, nothing happens. This issue is to update inject to add the annotation to namespaces as well as deployments.

Okay, on it!

Hi, I need some guidance with this issue. I cant really find a way to fetch all deployment configs given a namespace config. Is there a simpler way to tackle this issue?

The scope of this issue is to take:

apiVersion: v1
kind: Namespace
metadata:
  name: emojivoto

and produce:

apiVersion: v1
kind: Namespace
metadata:
  name: emojivoto
  annotations:
    linkerd.io/inject: enabled

Does that make more sense?

I have appended the annotations to the config variable (conf) as follows :
conf.Workload.Meta = &metav1.ObjectMeta{Annotations: map[string]string{k: v}}
I have even added Namespaces as an injectable object under getFreshWorkloadObj()

However, injectedJSON gives me an uninjected object. On further debugging, conf.GetPatch()gives me an empty array.
conf with the appended annotations is not converting to an injected JSON (and hence YAML). Am I missing something?

I'd recommend putting up a draft PR with a comment where you're looking for help. It is pretty tough to help out without seeing all the code.

I have oped a PR #3482 with all the necessary comments :)

Now that I have opened a PR with a fix for this, I was wondering if I could update the documentation for the same. Shall I open an issue for this on the website repo?

That would be great!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

klingerf picture klingerf  ·  3Comments

ihcsim picture ihcsim  ·  4Comments

briansmith picture briansmith  ·  4Comments

manimaul picture manimaul  ·  3Comments

geekmush picture geekmush  ·  4Comments