Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add helm chart for kubeadmiral #325

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ coverage:
if_ci_failed: error
# https://docs.codecov.com/docs/ignoring-paths
ignore:
- "charts"
- "config"
- "docs"
- "examples"
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ zz_generated* linguist-generated=true
pkg/client linguist-generated=true
config/crds/bases/core_kubeadmiral_io/*.yaml linguist-generated=true
config/crds/bases/multicluster_x-k8s_io/*.yaml linguist-generated=true
charts/kubeadmiral/_admiral_control_plane/crds/core_kubeadmiral_io/*.yaml linguist-generated=true
23 changes: 23 additions & 0 deletions charts/kubeadmiral/.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/
24 changes: 24 additions & 0 deletions charts/kubeadmiral/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: kubeadmiral
description: A Helm chart for kubeadmiral

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.0.0"
106 changes: 106 additions & 0 deletions charts/kubeadmiral/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
## Installation KubeAdmiral by Helm Chart

### Prerequisites

Make sure the following tools are installed in the environment before installing KubeAdmiral:

- Kubernetes cluster version v1.20.15+
- [Helm](https://helm.sh/) version v3+
- [Kubectl](https://github.com/kubernetes/kubectl) version v0.20.15+

### Installation steps

If you already have a Kubernetes cluster, you can install the KubeAdmiral control plane on your cluster using the helm chart. To install KubeAdmiral, follow these steps:

1.Get the Chart package for KubeAdmiral and install it:

Get the Chart package locally and install it.

```Bash
$ git clone https://github.com/kubewharf/kubeadmiral

$ cd kubeadmiral

$ helm install kubeadmiral -n kubeadmiral-system --create-namespace --dependency-update ./charts/kubeadmiral
```

2.Wait and check if the package has been installed successfully

Use your Kubernetes cluster kubeconfig to see if the following components of KubeAdmiral have been successfully running:

```Bash
$ kubectl get pods -n kubeadmiral-system

NAME READY STATUS RESTARTS AGE
etcd-0 1/1 Running 0 13h
kubeadmiral-apiserver-5767cd4f56-gvnqq 1/1 Running 0 13h
kubeadmiral-controller-manager-5f598574c9-zjmf9 1/1 Running 0 13h
kubeadmiral-hpa-aggregator-59ccd7b484-phbr6 2/2 Running 0 13h
kubeadmiral-kube-controller-manager-6bd7dcf67-2zpqw 1/1 Running 2 (13h ago) 13h
```

3.Export the kubeconfig of KubeAdmiral

After executing the following command, the kubeconfig for connecting to KubeAdmiral will be exported to the kubeadmiral-kubeconfig file.

> Note that the address in the kubeconfig is set to the internal service address of KubeAdmiral-apiserver:

```Bash
$ kubectl get secret -n kubeadmiral-system kubeadmiral-kubeconfig-secret -o jsonpath={.data.kubeconfig} | base64 -d > kubeadmiral-kubeconfig
```

If you specified an external address when installing KubeAdmiral, we will automatically generate a kubeconfig using the external address. You can export it to the external-kubeadmiral-kubeconfig file by running the following command:

```Bash
$ kubectl get secret -n kubeadmiral-system kubeadmiral-kubeconfig-secret -o jsonpath={.data.external-kubeconfig} | base64 -d > external-kubeadmiral-kubeconfig
```

### Uninstallation steps

Uninstall the KubeAdmiral Helm chart in the kubeadmiral-system namespace:

```Bash
$ helm uninstall -n kubeadmiral-system kubeadmiral
```

This command will delete all Kubernetes resources associated with the Chart:

> Note: The following permissions and namespace resources are relied on when installing and uninstalling helmchart, so they cannot be deleted automatically and require you to clean them up manually.

```Bash
$ kubectl delete clusterrole kubeadmiral-pre-install-job

$ kubectl delete clusterrolebinding kubeadmiral-pre-install-job

$ kubectl delete ns kubeadmiral-system
```

### Configuration parameters

| Name | Description | Default Value |
| --------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| clusterDomain | Default cluster domain of Kubernetes cluster | "cluster.local" |
| etcd.image.name | Image name used by KubeAdmiral etcd | "registry.k8s.io/etcd:3.4.13-0" |
| etcd.image.pullPolicy | Pull mode of etcd image | "IfNotPresent" |
| etcd.certHosts | Hosts accessible with etcd certificate | ["kubernetes.default.svc", ".etcd.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}", "*.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}", "*.{{ .Release.Namespace }}.svc", "localhost", "127.0.0.1"] |
| apiServer.image.name | Image name of kubeadmiral-apiserver | "registry.k8s.io/kube-apiserver:v1.20.15" |
| apiServer.image.pullPolicy | Pull mode of kubeadmiral-apiserver image | "IfNotPresent" |
| apiServer.certHosts | Hosts supported by kubeadmiral-apiserver certificate | ["kubernetes.default.svc", ".etcd.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}", "*.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}", "*.{{ .Release.Namespace }}.svc", "localhost", "127.0.0.1"] |
| apiServer.hostNetwork | Deploy kubeadmiral-apiserver with hostNetwork. If there are multiple kubeadmirals in one cluster, you'd better set it to "false" | "false" |
| apiServer.serviceType | Service type of kubeadmiral-apiserver | "ClusterIP" |
| apiServer.externalIP | Exposed IP of kubeadmiral-apiserver. If you want to expose the apiserver to the outside, you can set this field, which will write the external IP into the certificate and generate a kubeconfig with the external IP. | "" |
| apiServer.nodePort | Node port used for the 'apiserver'. This will take effect when 'apiServer.serviceType' is set to 'NodePort'. If no port is specified, a node port will be automatically assigned. | 0 |
| apiServer.certHosts | Hosts supported by the kubeadmiral-apiserver certificate | ["kubernetes.default.svc", ".etcd.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}", "*.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}", "*.{{ .Release.Namespace }}.svc", "localhost", "127.0.0.1", "{{ .Values.apiServer.externalIP }}"] |
| kubeControllerManager.image.name | Image name of kube-controller-manager | "registry.k8s.io/kube-controller-manager:v1.20.15" |
| kubeControllerManager.image.pullPolicy | Pull mode of kube-controller-manager image | "IfNotPresent" |
| kubeControllerManager.controllers | Controllers that kube-controller-manager component needs to start | "namespace,garbagecollector" |
| kubeadmiralControllerManager.image.name | Image name of kubeadmiral-controller-manager | "docker.io/kubewharf/kubeadmiral-controller-manager:v1.0.0" |
| kubeadmiralControllerManager.image.pullPolicy | Pull mode of kubeadmiral-controller-manager image | "IfNotPresent" |
| kubeadmiralControllerManager.extraCommandArgs | Additional startup parameters of kubeadmiral-controller-manager | {} |
| kubeadmiralHpaAggregator.image.name | Image name of kubeadmiral-hpa-aggregator | "docker.io/kubewharf/kubeadmiral-hpa-aggregator:v1.0.0" |
| kubeadmiralHpaAggregator.image.pullPolicy | Pull mode of kubeadmiral-hpa-aggregator image | "IfNotPresent" |
| kubeadmiralHpaAggregator.extraCommandArgs | Additional startup parameters of kubeadmiral-hpa-aggregator | {} |
| installTools.cfssl.image.name | cfssl image name for KubeAdmiral installer | "docker.io/cfssl/cfssl:latest" |
| installTools.cfssl.image.pullPolicy | cfssl image pull policy | "IfNotPresent" |
| installTools.kubectl.image.name | kubectl image name for KubeAdmiral installer | "docker.io/bitnami/kubectl:1.22.10" |
| installTools.kubectl.image.pullPolicy | kubectl image pull policy | "IfNotPresent" |

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading