Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Helmv3 migration of the chart #1260

Merged
merged 67 commits into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
f936e4c
Helmv3 migration of the chart
eumel8 Jul 29, 2020
4c5dabb
Helm3 adjustments for Travis
eumel8 Jul 29, 2020
795da6d
Fix download url Helmv3
eumel8 Jul 29, 2020
d27dae7
Remove empty annotations
eumel8 Jul 30, 2020
9229f45
Still fix Travis
eumel8 Jul 30, 2020
7706913
Create namespace before helm deploy
eumel8 Jul 30, 2020
bc092a5
Remove helm purge
eumel8 Jul 30, 2020
dcc72a6
No extra resource handling is required in Helmv3
eumel8 Jul 30, 2020
65100cc
Set explicit exit code for Travis
eumel8 Jul 30, 2020
42c3e5b
Add a comment for finishing helm uninstalling
eumel8 Jul 31, 2020
bfa683f
Debug namespace delete
eumel8 Jul 31, 2020
15f16c9
Nowait for namespace deletion
eumel8 Jul 31, 2020
32a4380
No wait
eumel8 Jul 31, 2020
85ac2b6
Create namespace in Helm/review docs
eumel8 Aug 5, 2020
6625ae5
rebase
eumel8 Aug 5, 2020
35d4cac
rebase
eumel8 Aug 5, 2020
80cd321
Fix name tag
eumel8 Aug 5, 2020
9e22725
Helmv3 migration of the chart
eumel8 Jul 29, 2020
ca09c79
Helm3 adjustments for Travis
eumel8 Jul 29, 2020
28f74ad
Fix download url Helmv3
eumel8 Jul 29, 2020
22bfa96
Remove empty annotations
eumel8 Jul 30, 2020
f3e8d6e
Still fix Travis
eumel8 Jul 30, 2020
4707f02
Create namespace before helm deploy
eumel8 Jul 30, 2020
40318e9
Remove helm purge
eumel8 Jul 30, 2020
c2758bc
No extra resource handling is required in Helmv3
eumel8 Jul 30, 2020
9306b26
Set explicit exit code for Travis
eumel8 Jul 30, 2020
4f82998
Add a comment for finishing helm uninstalling
eumel8 Jul 31, 2020
db330a3
Debug namespace delete
eumel8 Jul 31, 2020
20dd172
Nowait for namespace deletion
eumel8 Jul 31, 2020
8fd5d5c
No wait
eumel8 Jul 31, 2020
209cd83
Create namespace in Helm/review docs
eumel8 Aug 5, 2020
89c6ec5
Update doc
eumel8 Aug 5, 2020
d4a7552
Fix merge conflict
eumel8 Aug 5, 2020
a289cad
Bump helm 3.2.4
eumel8 Aug 5, 2020
b423915
Helmv3 travis (#1)
eumel8 Aug 6, 2020
b86f65e
Helmv3 migration of the chart
eumel8 Jul 29, 2020
366351c
Helm3 adjustments for Travis
eumel8 Jul 29, 2020
16cf1c4
Fix download url Helmv3
eumel8 Jul 29, 2020
f124fc5
Remove empty annotations
eumel8 Jul 30, 2020
8ee98a4
Still fix Travis
eumel8 Jul 30, 2020
df71ebc
Create namespace before helm deploy
eumel8 Jul 30, 2020
478b703
Remove helm purge
eumel8 Jul 30, 2020
8a87464
No extra resource handling is required in Helmv3
eumel8 Jul 30, 2020
946e7e5
Set explicit exit code for Travis
eumel8 Jul 30, 2020
00ec58c
Add a comment for finishing helm uninstalling
eumel8 Jul 31, 2020
3ada8a5
Debug namespace delete
eumel8 Jul 31, 2020
ba642ef
Nowait for namespace deletion
eumel8 Jul 31, 2020
6b47b7d
No wait
eumel8 Jul 31, 2020
61f4889
Create namespace in Helm/review docs
eumel8 Aug 5, 2020
bcb6b36
Create namespace before helm deploy
eumel8 Jul 30, 2020
cce741d
Set explicit exit code for Travis
eumel8 Jul 30, 2020
74ae447
Add a comment for finishing helm uninstalling
eumel8 Jul 31, 2020
1c9fd75
Create namespace in Helm/review docs
eumel8 Aug 5, 2020
cf341a0
Update doc
eumel8 Aug 5, 2020
608057d
Bump helm 3.2.4
eumel8 Aug 5, 2020
f6da623
Fix name in helm deploy
eumel8 Aug 6, 2020
bc90002
Fix merge conflicts
eumel8 Aug 6, 2020
dd82b52
Add Helm v3 migration notes
eumel8 Aug 6, 2020
a891471
Bump chart api version
eumel8 Aug 6, 2020
4dc186d
Delete debug output
eumel8 Aug 12, 2020
ccfeeb8
Delete debug output
eumel8 Aug 12, 2020
5a2225b
Cleanup crd deletion in Travis
eumel8 Aug 12, 2020
e9a9cd2
Update Helm to 3.3.0
eumel8 Aug 12, 2020
db9f99b
Remove debug settings
eumel8 Aug 12, 2020
e35243a
Remove CRD_DIR
eumel8 Aug 12, 2020
70a18f1
Merge remote-tracking branch 'upstream/master' into helmv3
jimmidyson Aug 13, 2020
e755db9
docs: Move helm install output
jimmidyson Aug 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions charts/kubefed/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requirements.lock
49 changes: 5 additions & 44 deletions charts/kubefed/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,8 @@ group](https://groups.google.com/forum/#!forum/kubernetes-sig-multicluster).
## Prerequisites

- Kubernetes 1.13+
- Helm 2.10+
- Helm 3.1.2+
eumel8 marked this conversation as resolved.
Show resolved Hide resolved

## Configuring RBAC for Helm (Optional)

If your Kubernetes cluster has RBAC enabled, it will be necessary to
ensure that helm is deployed with a service account with the
permissions necessary to deploy KubeFed:

```bash
$ cat << EOF | kubectl apply -f -
apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: tiller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: tiller
namespace: kube-system
EOF

$ helm init --service-account tiller
```

## Installing the Chart

Expand All @@ -71,13 +41,14 @@ kubefed-charts https://raw.githubusercontent.com/kubernetes-sigs/kubefed/maste

With the repo added, available charts and versions can be viewed.
```bash
$ helm search kubefed --devel
$ helm search repo kubefed
```

Install the chart and specify the version to install with the
`--version` argument. Replace `<x.x.x>` with your desired version.
```bash
$ helm install kubefed-charts/kubefed --name kubefed --version=<x.x.x> --namespace kube-federation-system --devel
$ kubectl create namespace kube-federation-system
$ helm --namespace kube-federation-system install kubefed kubefed-charts/kubefed --version=<x.x.x>
```

**NOTE:** For **namespace-scoped deployments** (configured with the `--set
Expand All @@ -95,26 +66,16 @@ namespace with this label by default.

## Uninstalling the Chart

Due to this helm [issue](https://github.com/helm/helm/issues/4440), the CRDs cannot be deleted
when delete helm release, so before delete the helm release, we need first delete all
of the CR and CRDs for KubeFed release.

Delete all KubeFed `FederatedTypeConfig`:

```bash
$ kubectl -n kube-federation-system delete FederatedTypeConfig --all
```

Delete all KubeFed CRDs:

```bash
$ kubectl delete crd $(kubectl get crd | grep -E 'kubefed.io' | awk '{print $1}')
```

Then you can uninstall/delete the `kubefed` release:

```bash
$ helm delete --purge kubefed
$ helm --namespace kube-federation-system uninstall kubefed
```

The command above removes all the Kubernetes components associated with the chart
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{{ if (or (or (not .Values.global.scope) (eq .Values.global.scope "Cluster")) (not (.Capabilities.APIVersions.Has "core.kubefed.io/v1beta1"))) }}
eumel8 marked this conversation as resolved.
Show resolved Hide resolved
---

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
creationTimestamp: null
name: clusterpropagatedversions.core.kubefed.io
spec:
Expand Down Expand Up @@ -89,8 +84,6 @@ status:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
creationTimestamp: null
name: federatedservicestatuses.core.kubefed.io
spec:
Expand Down Expand Up @@ -174,8 +167,6 @@ status:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
creationTimestamp: null
name: federatedtypeconfigs.core.kubefed.io
spec:
Expand Down Expand Up @@ -350,8 +341,6 @@ status:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
creationTimestamp: null
name: kubefedclusters.core.kubefed.io
spec:
Expand Down Expand Up @@ -492,8 +481,6 @@ status:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
creationTimestamp: null
name: kubefedconfigs.core.kubefed.io
spec:
Expand Down Expand Up @@ -625,8 +612,6 @@ status:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
creationTimestamp: null
name: propagatedversions.core.kubefed.io
spec:
Expand Down Expand Up @@ -709,8 +694,6 @@ status:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
creationTimestamp: null
name: dnsendpoints.multiclusterdns.kubefed.io
spec:
Expand Down Expand Up @@ -799,8 +782,6 @@ status:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
creationTimestamp: null
name: domains.multiclusterdns.kubefed.io
spec:
Expand Down Expand Up @@ -854,8 +835,6 @@ status:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
creationTimestamp: null
name: ingressdnsrecords.multiclusterdns.kubefed.io
spec:
Expand Down Expand Up @@ -953,8 +932,6 @@ status:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
creationTimestamp: null
name: servicednsrecords.multiclusterdns.kubefed.io
spec:
Expand Down Expand Up @@ -1090,8 +1067,6 @@ status:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
creationTimestamp: null
name: replicaschedulingpreferences.scheduling.kubefed.io
spec:
Expand Down Expand Up @@ -1195,4 +1170,3 @@ status:
conditions: []
storedVersions: []
---
{{ end }}
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{{ if (or (or (not .Values.global.scope) (eq .Values.global.scope "Cluster")) (not (.Capabilities.APIVersions.Has "types.kubefed.io/v1beta1"))) }}
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
name: federatedclusterroles.types.kubefed.io
spec:
group: types.kubefed.io
Expand Down Expand Up @@ -133,8 +130,6 @@ spec:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
name: federatedconfigmaps.types.kubefed.io
spec:
group: types.kubefed.io
Expand Down Expand Up @@ -265,8 +260,6 @@ spec:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
name: federateddeployments.types.kubefed.io
spec:
group: types.kubefed.io
Expand Down Expand Up @@ -399,8 +392,6 @@ spec:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
name: federatedingresses.types.kubefed.io
spec:
group: types.kubefed.io
Expand Down Expand Up @@ -531,8 +522,6 @@ spec:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
name: federatedjobs.types.kubefed.io
spec:
group: types.kubefed.io
Expand Down Expand Up @@ -661,8 +650,6 @@ spec:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
name: federatednamespaces.types.kubefed.io
spec:
group: types.kubefed.io
Expand Down Expand Up @@ -793,8 +780,6 @@ spec:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
name: federatedreplicasets.types.kubefed.io
spec:
group: types.kubefed.io
Expand Down Expand Up @@ -927,8 +912,6 @@ spec:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
name: federatedsecrets.types.kubefed.io
spec:
group: types.kubefed.io
Expand Down Expand Up @@ -1057,8 +1040,6 @@ spec:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
name: federatedserviceaccounts.types.kubefed.io
spec:
group: types.kubefed.io
Expand Down Expand Up @@ -1189,8 +1170,6 @@ spec:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/hook": crd-install
name: federatedservices.types.kubefed.io
spec:
group: types.kubefed.io
Expand Down Expand Up @@ -1317,4 +1296,3 @@ spec:
required:
- spec
version: v1beta1
{{ end }}
17 changes: 10 additions & 7 deletions scripts/delete-kubefed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ source "$(dirname "${BASH_SOURCE}")/util.sh"

function delete-helm-deployment() {
# Clean kubefed resources
${KCD} -n "${NS}" FederatedTypeConfig --all
if [[ ! "${NAMESPACED}" || "${DELETE_CLUSTER_RESOURCE}" ]]; then
${KCD} crd $(kubectl get crd | grep -E 'kubefed.io' | awk '{print $1}')
fi
# ${KCD} -n "${NS}" FederatedTypeConfig --all
eumel8 marked this conversation as resolved.
Show resolved Hide resolved
# if [[ ! "${NAMESPACED}" || "${DELETE_CLUSTER_RESOURCE}" ]]; then
# ${KCD} crd $(kubectl get crd | grep -E 'kubefed.io' | awk '{print $1}')
# fi
eumel8 marked this conversation as resolved.
Show resolved Hide resolved

if [[ "${NAMESPACED}" ]]; then
helm delete --purge kubefed-${NS}
helm -n ${NS} uninstall kubefed-${NS}
else
helm delete --purge kubefed
helm -n ${NS} uninstall kubefed
fi
}

Expand Down Expand Up @@ -62,7 +62,10 @@ done
# Deploy kubefed resources
delete-helm-deployment

${KCD} ns "${NS}"
${KCD} ns "${NS}" -v8
eumel8 marked this conversation as resolved.
Show resolved Hide resolved

echo "Helm uninstall finished"
exit 0

# Wait for the namespaces to be removed
function ns-deleted() {
Expand Down
40 changes: 11 additions & 29 deletions scripts/deploy-kubefed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,34 +38,6 @@ set -o pipefail
source "$(dirname "${BASH_SOURCE}")/util.sh"

function deploy-with-helm() {
# Don't install tiller if we already have a working install.
if ! helm version --server 2>/dev/null; then
# RBAC should be enabled to avoid CI fail because CI K8s uses RBAC for Tiller
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: tiller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: tiller
namespace: kube-system
EOF

helm init --service-account tiller
util::wait-for-condition "Tiller to become ready" "helm version --server &> /dev/null" 120
fi

local repository=${IMAGE_NAME%/*}
local image_tag=${IMAGE_NAME##*/}
local image=${image_tag%:*}
Expand All @@ -86,6 +58,13 @@ EOF
${cmd}
}

function create-namespace {
eumel8 marked this conversation as resolved.
Show resolved Hide resolved
# Required arguments
local ns="${1}"
echo "kubectl create namespace ${ns}"
kubectl create namespace ${ns}
}

function helm-deploy-cmd {
# Required arguments
local name="${1}"
Expand All @@ -94,7 +73,7 @@ function helm-deploy-cmd {
local image="${4}"
local tag="${5}"

echo "helm install charts/kubefed --name ${name} --namespace ${ns} \
echo "helm --namespace ${ns} install ${name} charts/kubefed \
--set controllermanager.repository=${repo} --set controllermanager.image=${image} \
--set controllermanager.tag=${tag}"
}
Expand Down Expand Up @@ -173,6 +152,9 @@ cd "$(dirname "$0")/.."
make kubefedctl
cd -

# Create namespace first before deploy with helm
create-namespace ${NS}

# Deploy KubeFed resources
deploy-with-helm

Expand Down
Loading