helm-api

command module
v0.0.0-...-887dc56 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

README

helm-api

通过 grpc 和 http 接口部署 helm charts (仅支持3.0.0+)

为什么要使用helm-api
  • 有时候您希望通过程序在集群上部署和管理helm release。
  • 有时候您希望通过http接口在集群上部署和管理helm release。

实现接口

Method Name Request Type Response Type Description
CreateContext HelmContextReq HelmContextRes CreateContext 创建context
DeleteContext DeleteHelmContextReq .google.protobuf.Empty DeleteContext 删除context
UpdateRepo UpdateRepoReq .google.protobuf.Empty UpdateRepo 更新context 内repo 信息
InstallRelease InstallReq Release InstallRelease 安装charts
UpgradeRelease UpgradeReq Release UpgradeRelease 更新release
UninstallRelease ReleaseReq .google.protobuf.Empty UninstallRelease 删除release
GetChart GetChartReq Chart GetChart 获取 chart 信息
GetRelease ReleaseReq Release GetRelease 获取某个release实例信息
GetReleaseValues ReleaseReq Values GetReleaseValues 某个release实例values信息
ListRelease ListReleaseReq ListReleaseRes ListRelease 列出某个context下全部release.
RollbackRelease ReleaseRollbackReq .google.protobuf.Empty RollbackRelease 回滚某个release
GetReleaseHistory ReleaseReq ListReleaseRes GetReleaseHistory 列出release 历史
Search SearchReq SearchRes Search 查找某个repo的chart
All ListChartReq SearchRes All 列出某个context所有的chart
Key 关键词
  1. Context
    • context 存储了k8s权限和helm repository。所以用户可以通过context 复用这些信息。
  2. ContextName
    • 如果用户请求中带有ContextName 请求会使用对应context 存储的k8s权限和helm repository。如果请求不带有contextName,请求会根据RepoInfo 和 KubeInfo创建一个临时的context。
Installation
  • git clone git@github.com:weapons97/helm-api.git
  • cd helm-api
  • kubectl install -f deploy
DOC

请看 doc/doc.md

HTTP

请看 swagger/helm-api.swagger.json

GRPC

请看 protos/helm-api.proto

Examples

cd ./examples 打开此目录,运行一下脚本以验证接口。

  • 确保你安装了 nodejs 环境。
  1. 指定ip和端口

    export host=<你的 helm-api host>
    export port=<你的 helm-api port>
    
  2. 创建context。

    # node createContext.js <your kubeconfig> <your context> <your namespace>
    node createContext.js ~/kube.config "" "test"
    

    创建 incluster context。 incluster context 使用service account 为操作授权。

    Create an incluster context. Incluster context uses service account to authorize operations.

    # node inclusterContext.js <your namespace>
    node inclusterContext.js default
    
  3. 更新 repo

    node repoupdate.js 
    
  4. 获得 chart 信息

    #  node getchart.js test <repo name> <chart name>
    node getchart.js test bitnami mariadb
    
  5. 创建一个mysql release

    # node install.js <release name>
    node install.js mysql
    
  6. 获取mysql release values

    # node getreleasevalues.js <context name> <release name>
    node getreleasevalues.js test mysql
    
  7. 更新mysql release

    # node upgrade <release name>
    node upgrade mysql
    
  8. 获取mysql release all

    # node getreleasevalues.js <context name> <release name>
    node getreleasevalues.js test mysql
    
  9. 获取 release history

    # node history.js <context name> <release name>
    node history.js test mysql 
    
  10. 回滚 release

    # node rollback.js <context name> <release name> <version>
    node rollback.js test mysql 1
    
  11. 删除 release

# node deleterelease.js <context name> <release name>
node deleterelease.js test mysql
  1. 删除context

    # node deleteContext.js <context name>
    node deleteContext.js test
    

Documentation

Overview

Copyright © 2020 weapons97@gmail.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis
pkg
protos
Package helmapi is a reverse proxy.
Package helmapi is a reverse proxy.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL