From 58afa53b6abcc084d10e0ec7217004c9386cb31e Mon Sep 17 00:00:00 2001 From: Yi Wei <984178308@qq.com> Date: Thu, 5 Dec 2024 20:54:03 +0800 Subject: [PATCH] chore: update helm install (#193) Co-authored-by: evelynwei --- deploy/README-zh.md | 65 +++++++++++++++++++ deploy/README.md | 53 +++++++++++++++ deploy/init_helm.sh | 27 ++++++++ .../templates/controller-statefulset.yaml | 2 +- .../templates/controller-statefulset.yaml | 2 +- version | 2 +- 6 files changed, 148 insertions(+), 3 deletions(-) create mode 100644 deploy/README-zh.md create mode 100644 deploy/README.md create mode 100644 deploy/init_helm.sh diff --git a/deploy/README-zh.md b/deploy/README-zh.md new file mode 100644 index 00000000..0c0df8a5 --- /dev/null +++ b/deploy/README-zh.md @@ -0,0 +1,65 @@ +# Polaris Controller helm安装文档 + +简体中文 | [English](./README.md) + +本文档介绍如何使用 helm chart 安装 polaris-controller 服务。 + +## 准备工作 + +确保已经安装 k8s 集群,且安装了 helm。 +在polaris-system命名空间下已经成功部署polaris server服务 +(参考文档见: [helm部署北极星](https://github.com/polarismesh/polaris/tree/main/release/cluster/helm)) + +## 安装 +### 初始化helm配置 +确认`deploy/variables.txt`文件中的变量赋值符合预期,示例如下 +```shell +cd deploy +$ cat variables.txt deploy -> main ? ! |• +POLARIS_HOST:polaris.polaris-system +CONTROLLER_VERSION:v1.7.1 +SIDECAR_VERSION:v1.5.1 +POLARIS_TOKEN:nu/0WRA4EqSR1FagrjRj0fZwPXuGlMpX+zCuWu4uMqy8xr1vRjisSbA25aAC3mtU8MeeRsKhQiDAynUR09I= +ENVOY_VERSION:v1.26.2 +CLUSTER_NAME:default +JAVA_AGENT_INIT:v0.0.1% +``` +初始化helm项目的`values.yaml`文件 +```shell +sh init_helm.sh +``` + +### 部署 +使用`helm install ${release_name} .`命令安装,将 `${release_name}` 替换为您需要的 release 名。示例如下 +```shell +cd helm +helm install polaris-controller . +``` + +### 更新 +使用`helm upgrade -i ${release_name} .`命令更新,将 `${release_name}` 替换为您需要的 release 名。示例如下 +```shell +helm upgrade -i polaris-controller . +``` + +### 卸载 +使用`helm uninstall `${release_name}``命令更新,将 `${release_name}` 替换为您需要的 release 名。示例如下 +```shell +$ helm uninstall polaris-controller +``` + +## 配置 +支持的配置可查看helm项目的`values.yaml`文件 + + + + + + + + + + + + + diff --git a/deploy/README.md b/deploy/README.md new file mode 100644 index 00000000..748e0aee --- /dev/null +++ b/deploy/README.md @@ -0,0 +1,53 @@ +# Polaris Controller helm + +English | [简体中文](./README-zh.md) + +This page show how to get polaris-controller service started by helm chart。 + +## Prerequisites +Make sure k8s cluster is installed and helm is installed. And the polaris-server is running in the polaris-system namespaces of k8s. +(Guidance:[polaris installation by using helm](https://github.com/polarismesh/polaris/tree/main/release/cluster/helm)) + +## Installation +### helm init +Confirm that the variable assignments in the `deploy/variables.txt` file are as expected, the example is as follows +```shell +cd deploy +$ cat variables.txt deploy -> main ? ! |• +POLARIS_HOST:polaris.polaris-system +CONTROLLER_VERSION:v1.7.1 +SIDECAR_VERSION:v1.5.1 +POLARIS_TOKEN:token +ENVOY_VERSION:v1.26.2 +CLUSTER_NAME:default +JAVA_AGENT_INIT:v0.0.1% +``` +Initialize the `values.yaml` file of the helm project +```shell +sh init_helm.sh +``` + +### install +Use the `helm install ${release_name}.` command to install, replacing `${release_name}` with the release name you need. +Examples are as follows +```shell +cd helm +helm install polaris-controller . +``` + +### update +Use the `helm upgrade -i ${release_name} .` command to update and replace `${release_name}` with the release name you need. +Examples are as follows +```shell +helm upgrade -i polaris-controller . +``` + +### uninstall +Use the `helm uninstall `${release_name}` command to update, replacing `${release_name}` with the release name you need. +Examples are as follows +```shell +$ helm uninstall polaris-controller +``` + +## Configuration +Configs in `values.yaml` of helm will explain how to configure the service. diff --git a/deploy/init_helm.sh b/deploy/init_helm.sh new file mode 100644 index 00000000..b7cfd27d --- /dev/null +++ b/deploy/init_helm.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +set -e + +# preprocess the variables + +function replaceVar() { + for file in $(ls */helm/values.yaml); do + key="#$1#" + echo "process replace file $file, key $key, value $2" + if [ "$(uname)" == "Darwin" ]; then + sed -i "" "s?$key?$2?g" $file + else + sed -i "s?$key?$2?g" $file + fi + done +} + +varFile="variables.txt" +if [ ! -f "$varFile" ]; then + echo "variables.txt not exists" + exit 1 +fi + +export -f replaceVar + +cat $varFile | awk -F ':' '{print "replaceVar", $1, $2}' | "/bin/bash" \ No newline at end of file diff --git a/deploy/kubernetes_v1.21/helm/templates/controller-statefulset.yaml b/deploy/kubernetes_v1.21/helm/templates/controller-statefulset.yaml index 140def0a..4f8e1705 100644 --- a/deploy/kubernetes_v1.21/helm/templates/controller-statefulset.yaml +++ b/deploy/kubernetes_v1.21/helm/templates/controller-statefulset.yaml @@ -41,7 +41,7 @@ spec: memory: {{ .Values.controller.limit.memory }} volumeMounts: - mountPath: /polaris-controller/log - name: log + name: logs - name: certs mountPath: /etc/polaris-inject/certs readOnly: true diff --git a/deploy/kubernetes_v1.22/helm/templates/controller-statefulset.yaml b/deploy/kubernetes_v1.22/helm/templates/controller-statefulset.yaml index 140def0a..4f8e1705 100644 --- a/deploy/kubernetes_v1.22/helm/templates/controller-statefulset.yaml +++ b/deploy/kubernetes_v1.22/helm/templates/controller-statefulset.yaml @@ -41,7 +41,7 @@ spec: memory: {{ .Values.controller.limit.memory }} volumeMounts: - mountPath: /polaris-controller/log - name: log + name: logs - name: certs mountPath: /etc/polaris-inject/certs readOnly: true diff --git a/version b/version index 03ce661d..75e47606 100644 --- a/version +++ b/version @@ -1 +1 @@ -v1.6.0-alpha.1 \ No newline at end of file +v1.7.2 \ No newline at end of file