1"use strict";(self.webpackChunkhelm_www=self.webpackChunkhelm_www||[]).push([["28390"],{30748(e,n,t){t.r(n),t.d(n,{metadata:()=>s,default:()=>d,frontMatter:()=>l,contentTitle:()=>a,toc:()=>h,assets:()=>r});var s=JSON.parse('{"id":"sdk/gosdk","title":"Introduction","description":"Introduces the Helm Go SDK","source":"@site/versioned_docs/version-3/sdk/gosdk.md","sourceDirName":"sdk","slug":"/sdk/gosdk","permalink":"/docs/v3/sdk/gosdk","draft":false,"unlisted":false,"editUrl":"https://github.com/helm/helm-www/blob/main/versioned_docs/version-3/sdk/gosdk.md","tags":[],"version":"3","sidebarPosition":1,"frontMatter":{"title":"Introduction","description":"Introduces the Helm Go SDK","sidebar_position":1},"sidebar":"tutorialSidebar","previous":{"title":"Go SDK","permalink":"/docs/v3/sdk/"},"next":{"title":"Examples","permalink":"/docs/v3/sdk/examples"}}'),i=t(74848),o=t(28453);let l={title:"Introduction",description:"Introduces the Helm Go SDK",sidebar_position:1},a,r={},h=[{value:"Main package overview",id:"main-package-overview",level:2},{value:"Simple example",id:"simple-example",level:3},{value:"Compatibility",id:"compatibility",level:2}];function c(e){let n={a:"a",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.p,{children:"Helm's Go SDK enables custom software to leverage Helm charts and Helm's functionality for managing Kubernetes software deployment\n(In fact, the Helm CLI is effectively just one such tool!)"}),"\n",(0,i.jsx)(n.p,{children:"Currently, the SDK has been functionally separated from the Helm CLI.\nAnd the SDK can (and is) used by standalone tooling.\nThe Helm project has committed to API stability for the SDK.\nAs a warning, the SDK has some rough edges remaining from the initial work to separate the CLI and the SDK. Which the Helm project aims to improve and over time."}),"\n",(0,i.jsxs)(n.p,{children:["Full API documentation can be found at ",(0,i.jsx)(n.a,{href:"https://pkg.go.dev/helm.sh/helm/v3",children:"https://pkg.go.dev/helm.sh/helm/v3"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["A brief overview of some of the main types of packages and a simple example follows below.\nSee the ",(0,i.jsx)(n.a,{href:"/docs/v3/sdk/examples",children:"Examples"})," section for more examples and a more full featured 'driver'."]}),"\n",(0,i.jsx)(n.h2,{id:"main-package-overview",children:"Main package overview"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://pkg.go.dev/helm.sh/helm/v3/pkg/action",children:"pkg/action"}),":\nContains the main \u201Cclient\u201D for performing Helm actions.\nThis is the same package that the CLI is using underneath the hood.\nIf you just need to perform basic Helm commands from another Go program, this package is for you"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://pkg.go.dev/helm.sh/helm/v3/pkg/chart",children:"pkg/chart"}),", ",(0,i.jsx)(n.a,{href:"https://pkg.go.dev/helm.sh/helm/v3/pkg/chartutil",children:"pkg/chartutil"}),":\nMethods and helpers used for loading and manipulating charts"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://pkg.go.dev/helm.sh/helm/v3/pkg/cli",children:"pkg/cli"})," and its subpackages:\nContains all the handlers for the standard Helm environment variables and its subpackages contain output and values file handling"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://pkg.go.dev/helm.sh/helm/v3/pkg/release",children:"pkg/release"}),":\nDefines the ",(0,i.jsx)(n.code,{children:"Release"})," object and statuses"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"There are many more packages besides these, so go check out the documentation for more information!"}),"\n",(0,i.jsx)(n.h3,{id:"simple-example",children:"Simple example"}),"\n",(0,i.jsxs)(n.p,{children:["This is a simple example of doing a ",(0,i.jsx)(n.code,{children:"helm list"})," using the Go SDK.\nSee the ",(0,i.jsx)(n.a,{href:"/docs/v3/sdk/examples",children:"Examples"})," section for more full featured examples."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-go",children:'package main\n\nimport (\n "log"\n "os"\n\n "helm.sh/helm/v3/pkg/action"\n "helm.sh/helm/v3/pkg/cli"\n)\n\nfunc main() {\n settings := cli.New()\n\n actionConfig := new(action.Configuration)\n // You can pass an empty string instead of settings.Namespace() to list\n // all namespaces\n if err := actionConfig.Init(settings.RESTClientGetter(), settings.Namespace(), os.Getenv("HELM_DRIVER"), log.Printf); err != nil {\n log.Printf("%+v", err)\n os.Exit(1)\n }\n\n client := action.NewList(actionConfig)\n // Only list deployed\n client.Deployed = true\n results, err := client.Run()\n if err != nil {\n log.Printf("%+v", err)\n os.Exit(1)\n }\n\n for _, rel := range results {\n log.Printf("%+v", rel)\n }\n}\n\n'})}),"\n",(0,i.jsx)(n.h2,{id:"compatibility",children:"Compatibility"}),"\n",(0,i.jsx)(n.p,{children:"The Helm SDK explicitly follows the Helm backwards compatibility guarantees:"}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.a,{href:"https://github.com/helm/community/blob/main/hips/hip-0004.md",children:"https://github.com/helm/community/blob/main/hips/hip-0004.md"})}),"\n",(0,i.jsx)(n.p,{children:"That is, break changes will only be made over major versions."})]})}function d(e={}){let{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(c,{...e})}):c(e)}},28453(e,n,t){t.d(n,{R:()=>l,x:()=>a});var s=t(96540);let i={},o=s.createContext(i);function l(e){let n=s.useContext(o);return s.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:l(e.components),s.createElement(o.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.