Skip to content

Commit

Permalink
Add instructions for providers to upgrade to CRD v1
Browse files Browse the repository at this point in the history
  • Loading branch information
nader-ziada committed Mar 5, 2020
1 parent bd12857 commit 1a0fd80
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions docs/book/src/developer/providers/v1alpha2-to-v1alpha3.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,83 @@ commonLabels:
cluster.x-k8s.io/v1beta1: v1alphaX,v1beta1
```

# Upgrade to CRD v1

- Providers should upgrade their CRDs to v1
- Minimum Kubernetes version supporting CRDv1 is `v1.16`
- In `Makefile` target `generate-manifests:`, add the following property to the crd `crdVersions=v1`

```yaml
generate-manifests: $(CONTROLLER_GEN) ## Generate manifests e.g. CRD, RBAC etc.
$(CONTROLLER_GEN) \
paths=./api/... \
crd:crdVersions=v1 \
output:crd:dir=$(CRD_ROOT) \
output:webhook:dir=$(WEBHOOK_ROOT) \
webhook
$(CONTROLLER_GEN) \
paths=./controllers/... \
output:rbac:dir=$(RBAC_ROOT) \
rbac:roleName=manager-role
```

- For all the CRDs in the `config/crd/bases` change the version of `CustomResourceDefinetioin` to `v1`

```yaml
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
```

to

```yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
```

- In the `config/crd/kustomizeconfig.yaml` file, change the path of the webhook

```yaml
path: spec/conversion/webhookClientConfig/service/name
```

to

```yaml
spec/conversion/webhook/clientConfig/service/name
```

- Make the same change of changing `v1beta` to `v1` verison in the `config/crd/patches`
- In the `config/crd/patches/webhook_in_******.yaml` file, add the `conversionReviewVersions` property to the CRD

```yaml
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
...
spec:
conversion:
strategy: Webhook
webhookClientConfig:
...
```

to

```yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
...
spec:
strategy: Webhook
webhook:
conversionReviewVersions: ["v1", "v1beta1"]
clientConfig:
...
```


# Add `matchPolicy=Equivalent` kubebuilder marker in webhooks
- All providers should set "matchPolicy=Equivalent" kubebuilder marker for webhooks on all Custom Resource Definitions related to Cluster API starting with v1alpha3.
- Specifying `Equivalent` ensures that webhooks continue to intercept the resources they expect when upgrades enable new versions of the resource in the API server.
Expand Down

0 comments on commit 1a0fd80

Please sign in to comment.