linkerd2/pkg
Matei David a0e51fdfb5
Change injector proxy version annotation (#5338) (#5469)
### What

When overriding the proxy version using annotations, the respective annotation displays the wrong information (`linkerd.io/proxy-version`). This is a simple fix to display the correct version for the annotation; instead of using the proxy image from the config for the annotation's value, we take it from the overriden values instead.

Based on the discussion from #5338 I understood that when the image is updated it is reflected in the container image version but not the annotation. Alex's proposed fix seems to work like a charm so I can't really take credit for anything. I have attached below some before/after snippets of the deployments & pods. If there any additional changes required (or if I misunderstood anything) let me know and I'll gladly get it sorted :) 

#### Tests
---

Didn't add any new tests, I built the images and just tested the annotation displays the correct version. 

To test:
* I first injected an emojivoto-web deployment, its respective pod had the proxy version set to `dev-...`;
* I then re-injected the same deployment using a different proxy version and restarted the pods, its respective pod displayed the expected annotation value `stable-2.9.0` (whereas before it would have still been `dev-...`)

`Before`
```
# Deployment
apiVersion: apps/v1
kind: Deployment
...
   template:
    metadata:
      annotations:
        kubectl.kubernetes.io/restartedAt: "2021-01-04T12:41:47Z"
        linkerd.io/inject: enabled

# Pod
apiVersion: v1
kind: Pod
metadata:
  annotations:
    kubectl.kubernetes.io/restartedAt: "2021-01-04T12:41:47Z"
    linkerd.io/created-by: linkerd/proxy-injector dev-8d506317-madavid
    linkerd.io/identity-mode: default
    linkerd.io/inject: enabled
    linkerd.io/proxy-version: dev-8d506317-madavid
```
 
`After`
```sh
$ linkerd inject --proxy-version stable-2.9.0 - | kubectl apply -f -  

# Deployment
apiVersion: apps/v1
kind: Deployment
...
  template:
    metadata:
      annotations:
        config.linkerd.io/proxy-version: stable-2.9.0
        
# Pod
apiVersion: v1
kind: Pod
metadata:
  annotations:
    config.linkerd.io/proxy-version: stable-2.9.0
    kubectl.kubernetes.io/restartedAt: "2021-01-04T12:41:47Z"
    linkerd.io/created-by: linkerd/proxy-injector dev-8d506317-madavid
    linkerd.io/identity-mode: default
    linkerd.io/inject: enabled
    linkerd.io/proxy-version: stable-2.9.0

# linkerd.io/proxy-version changed after injection and now matches the config (and the proxy img)
```

Fixes #5338

Signed-off-by: Matei David <matei.david.35@gmail.com>
2021-01-06 11:13:11 -05:00
..
addr Add some unit test (#4853) 2020-08-18 16:10:13 -07:00
admin remove admin server timeouts (#4350) 2020-05-08 12:59:43 -07:00
charts viz: move some components into linkerd-viz (#5340) 2020-12-23 20:17:31 +05:30
config Add safe accessor for Global in linkerd-config (#5269) 2020-11-23 12:45:58 -08:00
filesonly Enable lint check for comments (#2023) 2019-01-02 14:03:59 -08:00
flags jaeger: Add support for override flags (#5304) 2020-12-04 16:35:39 -08:00
healthcheck Fix typo in healthcheck error message (#5445) 2021-01-06 09:44:07 +05:30
identity cli: Don't check for SAN in root and intermediate certs (#5237) 2020-11-18 15:30:39 -08:00
inject Change injector proxy version annotation (#5338) (#5469) 2021-01-06 11:13:11 -05:00
issuercerts cli: Don't check for SAN in root and intermediate certs (#5237) 2020-11-18 15:30:39 -08:00
k8s Add mulitcluster check command (#5410) 2020-12-21 15:50:17 -05:00
multicluster Bump k8s client-go to v0.19.2 (#5002) 2020-09-28 12:45:18 -05:00
profiles Use errors.Is instead of checking underlying err messages (#5140) 2020-10-28 21:33:17 +05:30
prometheus Trace Control plane Components with OC (#3495) 2019-10-18 12:19:13 -07:00
protohttp Use errors.Is instead of checking underlying err messages (#5140) 2020-10-28 21:33:17 +05:30
servicemirror Add support for service-mirror selectors (#4795) 2020-07-30 10:07:14 -07:00
tap Use errors.Is instead of checking underlying err messages (#5140) 2020-10-28 21:33:17 +05:30
tls Have the tap APIServer refresh its cert automatically (#5388) 2020-12-16 17:46:14 -05:00
trace Trace Control plane Components with OC (#3495) 2019-10-18 12:19:13 -07:00
tree Expose namespaceSelector for admission webhooks in helm chart (#5074) 2020-10-13 16:08:56 -07:00
util Add opaque ports to destination service updates (#5294) 2020-12-18 12:38:59 -05:00
version Bump proxy-init to v1.3.8 (#5283) 2020-11-27 09:07:34 -05:00