linkerd2/pkg
Matei David 0ce9e84a94
Introduce V1 to CRDs and Mutating Hooks (#5603)
*Closes #5484*
 ### Changes
---
*Overview*:
 * Update golden files and make necessary spec changes
 * Update test files for viz
 * Add v1 to healthcheck and uninstall
 * Fix link-crd clusterDomain field validation

- To update to v1, I had to change crd schemas to be version-based (i.e each version has to declare its own schema). I noticed an error in the link-crd (`targetClusterDomain` was `targetDomainName`). Also, additionalPrinterColumns are also version-dependent as a field now.

- For `admissionregistration` resources I had to add an additional `admissionReviewVersions` field -- I included `v1` and `v1beta1`.

- In `healthcheck.go` and `resources.go` (used by `uninstall`) I had to make some changes to the client-go versions (i.e from `v1beta1` to `v1` for admissionreg and apiextension) so that we don't see any warning messages when uninstalling or when we do any install checks. 

I tested again different cli and k8s versions to have a bit more confidence in the changes (in addition to automated tests), hope the cases below will be enough, if not let me know and I can test further.

### Tests

Linkerd local build CLI + k8s 1.19+
`install/check/mc-check/mc-install/mc-link/viz-install/viz-check/uninstall/`
```
$ kubectl version
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.2+k3s1", GitCommit:"1d4adb0301b9a63ceec8cabb11b309e061f43d5f", GitTreeState:"clean", BuildDate:"2021-01-14T23:52:37Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}

$ bin/linkerd version
Client version: git-b0fd2ec8
Server version: unavailable

$ bin/linkerd install | kubectl apply -f -
- no errors, no version warnings - 

$ bin/linkerd check --expected-version git-b0fd2ec8
Status check results are :tick:

# MC

$ bin/linkerd mc install | k apply -f - 
- no erros, no version warnings - 

$ bin/linkerd mc check
Status check results are :tick:

$ bin/linkerd mc link foo | k apply -f -   # test crd creation
# had a validation error here because the schema had targetDomainName instead of targetClusterDomain
# changed, rebuilt cli, re-installed mc, tried command again
secret/cluster-credentials-foo created
link.multicluster.linkerd.io/foo created
...

# VIZ
$ bin/linkerd viz install | k apply -f - 
- no errors, no version warnings - 

$ bin/linkerd viz check 
- no errors, no version warnings - 
Status check results are :tick:

$ bin/linkerd uninstall | k delete -f -
- no errors, no version warnings - 
```

Linkerd local build CLI + k8s 1.17
`check-pre/install/mc-check/mc-install/mc-link/viz-install/viz-check`
```
$ kubectl version
Server Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.17-rc1+k3s1", GitCommit:"e8c9484078bc59f2cd04f4018b095407758073f5", GitTreeState:"clean", BuildDate:"2021-01-14T06:20:56Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}

$ bin/linkerd version
Client version: git-3d2d4df1 # made changes to link-crd after prev test case
Server version: unavailable

$ bin/linkerd check --pre --expected-version git-3d2d4df1
- no errors, no version warnings -
Status check results are :tick:

$ bin/linkerd install | k apply -f -
- no errors, no version warnings -

$ bin/linkerd check --expected-version git-3d2d4df1
- no errors, no version warnings - 
Status check results are :tick:

$ bin/linkerd mc install | k apply -f -
- no errors, no version warnings - 

$ bin/linkerd mc check 
- no errors, no version warnings - 
Status check results are :tick:

$ bin/linkerd mc link --cluster-name foo | k apply -f -
bin/linkerd mc link --cluster-name foo | k apply -f -
secret/cluster-credentials-foo created
link.multicluster.linkerd.io/foo created

# VIZ

$ bin/linkerd viz install | k apply -f - 
- no errors, no version warnings - 

$ bin/linkerd viz check
- no errors, no version warnings -
- hangs up indefinitely after linkerd-viz can talk to Kubernetes
```

Linkerd edge (21.1.3) CLI + k8s 1.17 (already installed)
`check`
```
$ linkerd version
Client version: edge-21.1.3
Server version: git-3d2d4df1

$ linkerd check
- no errors -
- warnings: mismatch between cli & control plane, control plane not up to date (both expected) -
Status check results are :tick:
```

Linkerd stable (2.9.2) CLI + k8s 1.17 (already installed)
`check/uninstall`
```
$ linkerd version
Client version: stable-2.9.2
Server version: git-3d2d4df1

$ linkerd check
× control plane ClusterRoles exist
    missing ClusterRoles: linkerd-linkerd-tap
    see https://linkerd.io/checks/#l5d-existence-cr for hints

Status check results are ×

# viz wasn't installed, hence the error, installing viz didn't help since
# the res is named `viz-tap` now
# moving to uninstall

$ linkerd uninstall | k delete -f -
- no warnings, no errors - 
```

_Note_: I used `go test ./cli/cmd/... --generate` which is why there are so many changes 😨 

Signed-off-by: Matei David <matei.david.35@gmail.com>
2021-02-01 09:18:13 -05:00
..
addr Extract from public-api all the Prometheus dependencies, and moves things into a new viz component 'linkerd-metrics-api' (#5560) 2021-01-21 18:26:38 -05:00
admin remove admin server timeouts (#4350) 2020-05-08 12:59:43 -07:00
charts Add unit test for pkg/charts/charts.go (#5565) 2021-01-20 09:55:01 -05:00
cmd viz: move sub-cmds using viz extension under viz cmd (#5485) 2021-01-13 12:11:25 +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 Add log-format flag to control plane components (#5537) 2021-01-15 10:51:32 -05:00
healthcheck Introduce V1 to CRDs and Mutating Hooks (#5603) 2021-02-01 09:18:13 -05:00
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 Introduce V1 to CRDs and Mutating Hooks (#5603) 2021-02-01 09:18:13 -05:00
multicluster Bump k8s client-go to v0.19.2 (#5002) 2020-09-28 12:45:18 -05:00
profiles Separate observability API (#5510) 2021-01-13 14:34:54 -05:00
prometheus Trace Control plane Components with OC (#3495) 2019-10-18 12:19:13 -07:00
protohttp Separate observability API (#5510) 2021-01-13 14:34:54 -05:00
public Extract from public-api all the Prometheus dependencies, and moves things into a new viz component 'linkerd-metrics-api' (#5560) 2021-01-21 18:26:38 -05:00
servicemirror Add support for service-mirror selectors (#4795) 2020-07-30 10:07:14 -07:00
tap Separate observability API (#5510) 2021-01-13 14:34:54 -05:00
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