Skip to content

Files

Latest commit

author
xishengcai
Sep 13, 2023
2167d4b · Sep 13, 2023

History

History

k8s

client

function

  • create
  • delete
  • apply
  • patch
    • application/merge-patch+json

spurt input type

  • file
  • []byte
  • url
  • ListKind

spurt cache

usage example

package main

import (
  . "github.com/xishengcai/ganni-tool/k8s"
)

func main() {
  app, err := NewDefaultKubApp()
  //app, err := NewKubApp(Conf{
  //	KubeConfig: "",
  //	ProxyURL:   "http://127.0.0.1:1087",
  //})
  if err != nil {
    panic(err)
  }
  // todo: modify you yaml path
  objs, err := GetObjList("../yaml/patch")
  if err != nil {
    panic(err)
  }
  err = app.SetObjectList(objs).Do(ApplyObjectList)
  if err != nil {
    panic(err)
  }
}