Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Upgrade to v1 CRD
Browse files Browse the repository at this point in the history
Signed-off-by: Philip Laine <philip.laine@gmail.com>
Signed-off-by: Kingdon Barrett <yebyen@gmail.com>
  • Loading branch information
phillebaba authored and yebyen committed Jun 21, 2021
1 parent 3f1d87a commit 9a4e753
Show file tree
Hide file tree
Showing 24 changed files with 1,778 additions and 1,280 deletions.
766 changes: 385 additions & 381 deletions chart/helm-operator/crds/helmrelease.yaml

Large diffs are not rendered by default.

91 changes: 91 additions & 0 deletions crd-v1-testing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Verification in new cluster

Steps to verify CRD V1 functionality in a 1.20 cluster.

Create new kind cluster with crd/v1beta1 disabled.
```
kind create cluster --config ./kind-config.yaml
```

Apply local CRDs.
```
kubectl apply -f chart/helm-operator/crds/helmrelease.yaml
```

Install Helm Operator without the charts CRDs.
```
helm repo add fluxcd https://charts.fluxcd.io
kubectl create ns flux
helm upgrade --skip-crds -i helm-operator fluxcd/helm-operator --namespace flux --set helm.versions=v3
```

Apply podinfo helm chart, and verify it is working.
```
kubectl apply -f crd-v1-testing/podinfo-helmrelease.yaml
kubectl -n default get pods
kubectl -n default port-forward pod/<POD_NAME>
curl http://localhost:9898/
```

# Verification in upgraded cluster

Create a new cluster with v1beta1 CRD enabled.
```
kind create cluster`
```

Install Helm Operator.
```
helm repo add fluxcd https://charts.fluxcd.io
kubectl create ns flux
helm upgrade -i helm-operator fluxcd/helm-operator --namespace flux --set helm.versions=v3
```

Install chart museum.
```
helm repo add stable https://charts.helm.sh/stable
helm upgrade -i chartmuseum stable/chartmuseum -f crd-v1-testing/chart-museum-values.yaml
kubectl -n default get pods
```

Build and upload helm package.
```
kubectl -n default port-forward pod/<POD_NAME> 8080:8080
helm plugin install https://github.com/chartmuseum/helm-push.git
helm push crd-v1-testing/crd-test chartmuseum
```

Apply crd-test helm release
```
kubectl apply -f crd-v1-testing/crd-test-helmrelease.yaml
```

Exec into the docker container running the node.
```
docker ps
docker exec -i <CONTAINER_ID> bash
```

Get the kubeadm config.
```
kubeadm config view > kubeadm-config.yaml
```

Update the config with runtime config.
```
extraArgs:
authorization-mode: Node,RBAC
runtime-config: ""
```

```
extraArgs:
authorization-mode: Node,RBAC
runtime-config: "apiextensions.k8s.io/v1beta1=false"
```

Upgrade the cluster with the new settings.
```
kubeadm upgrade diff --config kubeadm-config.yaml
kubeadm upgrade apply --config kubeadm-config.yaml --ignore-preflight-errors all --force --v=5
```
3 changes: 3 additions & 0 deletions crd-v1-testing/chart-museum-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
env:
open:
DISABLE_API: false
10 changes: 10 additions & 0 deletions crd-v1-testing/crd-test-helmrelease.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: helm.fluxcd.io/v1
kind: HelmRelease
metadata:
name: crd-test
namespace: default
spec:
chart:
repository: http://chartmuseum-chartmuseum.default.svc.cluster.local:8080
name: crd-test
version: 0.1.0
23 changes: 23 additions & 0 deletions crd-v1-testing/crd-test/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions crd-v1-testing/crd-test/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: crd-test
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "1.16.0"
18 changes: 18 additions & 0 deletions crd-v1-testing/crd-test/crds/crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: crddirs.crdtest.example.com
spec:
group: crdtest.example.com
versions:
- name: v1
served: true
storage: true
version: v1
scope: Namespaced
names:
plural: crddirs
singular: crddir
kind: CrdDir
shortNames:
- t
18 changes: 18 additions & 0 deletions crd-v1-testing/crd-test/templates/crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: templatedirs.crdtest.example.com
spec:
group: crdtest.example.com
versions:
- name: v1
served: true
storage: true
version: v1
scope: Namespaced
names:
plural: templatedirs
singular: templatedir
kind: TemplateDir
shortNames:
- t
2 changes: 2 additions & 0 deletions crd-v1-testing/crd-test/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nameOverride: ""
fullnameOverride: ""
7 changes: 7 additions & 0 deletions crd-v1-testing/k3d-default.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
apiVersion: k3d.io/v1alpha2
kind: Simple
name: k3s-default
servers: 1
agents: 0
image: docker.io/rancher/k3s:v1.20.4-k3s1
12 changes: 12 additions & 0 deletions crd-v1-testing/kind-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
kubernetesVersion: v1.20.0
apiServer:
extraArgs:
#runtime-config: "apiextensions.k8s.io/v1beta1=false"
10 changes: 10 additions & 0 deletions crd-v1-testing/podinfo-helmrelease.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: helm.fluxcd.io/v1
kind: HelmRelease
metadata:
name: podinfo
namespace: default
spec:
chart:
repository: https://stefanprodan.github.io/podinfo
name: podinfo
version: 3.2.0
Loading

0 comments on commit 9a4e753

Please sign in to comment.