feat: with acceptest
This commit is contained in:
parent
ee922175c1
commit
8d514ab698
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.shuttle/
|
74
dagger.go
Normal file
74
dagger.go
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
package daggerhelm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"text/template"
|
||||||
|
|
||||||
|
"dagger.io/dagger"
|
||||||
|
)
|
||||||
|
|
||||||
|
const CONTAINER_IMAGE = "docker.io/alpine/k8s:1.26.3"
|
||||||
|
|
||||||
|
func Compile(ctx context.Context, client *dagger.Client, chartPath string, valuesFilePath string) (*dagger.Directory, error) {
|
||||||
|
|
||||||
|
chart := client.Host().Directory(chartPath)
|
||||||
|
|
||||||
|
tmpdir := os.TempDir()
|
||||||
|
err := os.MkdirAll(tmpdir, 0755)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to create tmpdir: %v", err)
|
||||||
|
}
|
||||||
|
tmpvalues, err := os.CreateTemp(tmpdir, "")
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("could not create a tempdir. err: %v", err)
|
||||||
|
}
|
||||||
|
//defer func() {
|
||||||
|
// if _, err := os.Stat(tmpdir); !errors.Is(err, os.ErrNotExist) {
|
||||||
|
// err := os.RemoveAll(tmpdir)
|
||||||
|
// if err != nil {
|
||||||
|
// panic(err)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}()
|
||||||
|
|
||||||
|
tmpl, err := template.New("helm-dagger").ParseFiles(valuesFilePath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to build template for values.yaml, err: %v", err)
|
||||||
|
}
|
||||||
|
err = tmpl.Execute(tmpvalues, struct{}{})
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to execute template. err: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = tmpvalues.Sync()
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to write to tmpfile. err: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
files, err := os.ReadDir(tmpdir)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to read tmpdir. err: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
valuesFileDirPath := path.Dir(tmpdir)
|
||||||
|
valuesFileRelativePath := files[0].Name()
|
||||||
|
valuesFile := client.Host().Directory(valuesFileDirPath).File(valuesFileRelativePath)
|
||||||
|
|
||||||
|
helmoutput := client.Container().From(CONTAINER_IMAGE).WithWorkdir("/mnt").WithDirectory("chart", chart).WithFile("values.yaml", valuesFile).WithExec([]string{"helm", "template", ".", "--output-dir", "/mnt/output"})
|
||||||
|
if exitCode, err := helmoutput.ExitCode(ctx); err != nil || exitCode != 0 {
|
||||||
|
return nil, fmt.Errorf("failed to render helm chart: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
exported, err := helmoutput.Directory("/mnt/output").Export(ctx, "dist")
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to export helm template: %v", err)
|
||||||
|
}
|
||||||
|
if !exported {
|
||||||
|
return nil, fmt.Errorf("nothing was exported")
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, nil
|
||||||
|
}
|
20
go.mod
Normal file
20
go.mod
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
module git.front.kjuulh.io/kjuulh/dagger-helm
|
||||||
|
|
||||||
|
go 1.20
|
||||||
|
|
||||||
|
require (
|
||||||
|
dagger.io/dagger v0.5.2
|
||||||
|
github.com/stretchr/testify v1.8.1
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/Khan/genqlient v0.5.0 // indirect
|
||||||
|
github.com/adrg/xdg v0.4.0 // indirect
|
||||||
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
|
github.com/iancoleman/strcase v0.2.0 // indirect
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
|
github.com/vektah/gqlparser/v2 v2.5.1 // indirect
|
||||||
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
|
||||||
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
|
)
|
121
go.sum
Normal file
121
go.sum
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
dagger.io/dagger v0.5.2 h1:xNMUnLWqcsb5UrvqOgJx4MJVfe7xDb50kBMXdC63Cjs=
|
||||||
|
dagger.io/dagger v0.5.2/go.mod h1:1nbGnLdIfoBV2ahbQjheI//SNGz+b5q1jqf0A+pJ+Oc=
|
||||||
|
github.com/99designs/gqlgen v0.17.2/go.mod h1:K5fzLKwtph+FFgh9j7nFbRUdBKvTcGnsta51fsMTn3o=
|
||||||
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
github.com/Khan/genqlient v0.5.0 h1:TMZJ+tl/BpbmGyIBiXzKzUftDhw4ZWxQZ+1ydn0gyII=
|
||||||
|
github.com/Khan/genqlient v0.5.0/go.mod h1:EpIvDVXYm01GP6AXzjA7dKriPTH6GmtpmvTAwUUqIX8=
|
||||||
|
github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls=
|
||||||
|
github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E=
|
||||||
|
github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
|
||||||
|
github.com/agnivade/levenshtein v1.1.0/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo=
|
||||||
|
github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8=
|
||||||
|
github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo=
|
||||||
|
github.com/alexflint/go-arg v1.4.2/go.mod h1:9iRbDxne7LcR/GSvEr7ma++GLpdIU1zrghf2y2768kM=
|
||||||
|
github.com/alexflint/go-scalar v1.0.0/go.mod h1:GpHzbCOZXEKMEcygYQ5n/aa4Aq84zbxjy3MxYW0gjYw=
|
||||||
|
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ=
|
||||||
|
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
|
||||||
|
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE=
|
||||||
|
github.com/bradleyjkemp/cupaloy/v2 v2.6.0/go.mod h1:bm7JXdkRd4BHJk9HpwqAI8BoAY1lps46Enkdqw6aRX0=
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA=
|
||||||
|
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
|
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
|
github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0=
|
||||||
|
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
|
||||||
|
github.com/kevinmbeaulieu/eq-go v1.0.0/go.mod h1:G3S8ajA56gKBZm4UB9AOyoOS37JO3roToPzKNM8dtdM=
|
||||||
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
|
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
||||||
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
|
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||||
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/logrusorgru/aurora/v3 v3.0.0/go.mod h1:vsR12bk5grlLvLXAYrBsb5Oc/N+LxAlxggSjiwMnCUc=
|
||||||
|
github.com/matryer/moq v0.2.3/go.mod h1:9RtPYjTnH1bSBIkpvtHkFN7nbWAnO7oRpdJkEIn6UtE=
|
||||||
|
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||||
|
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||||
|
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||||
|
github.com/mitchellh/mapstructure v1.2.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
|
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
|
||||||
|
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||||
|
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
|
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
|
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||||
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
|
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
|
||||||
|
github.com/vektah/gqlparser/v2 v2.4.0/go.mod h1:flJWIR04IMQPGz+BXLrORkrARBxv/rtyIAFvd/MceW0=
|
||||||
|
github.com/vektah/gqlparser/v2 v2.4.5/go.mod h1:flJWIR04IMQPGz+BXLrORkrARBxv/rtyIAFvd/MceW0=
|
||||||
|
github.com/vektah/gqlparser/v2 v2.5.1 h1:ZGu+bquAY23jsxDRcYpWjttRZrUz07LbiY77gUOHcr4=
|
||||||
|
github.com/vektah/gqlparser/v2 v2.5.1/go.mod h1:mPgqFBu/woKTVYWyNk8cO3kh4S/f4aRFZrvOnp3hmCs=
|
||||||
|
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
|
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
|
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
|
||||||
|
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||||
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
|
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=
|
||||||
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab h1:2QkjZIsXupsJbJIdSjjUOgWK3aEtzyuh2mPt3l/CkeU=
|
||||||
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20200815165600-90abf76919f3/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||||
|
golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
|
||||||
|
golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
|
||||||
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
26
internal/accept_test/compile_test.go
Normal file
26
internal/accept_test/compile_test.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package accepttest
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"os"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"dagger.io/dagger"
|
||||||
|
daggerhelm "git.front.kjuulh.io/kjuulh/dagger-helm"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestCompile(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
ctx := context.Background()
|
||||||
|
client, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr))
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
t.Run("can generate nginx helm chart", func(t *testing.T) {
|
||||||
|
ctx := context.Background()
|
||||||
|
|
||||||
|
_, err := daggerhelm.Compile(ctx, client, "test_data/nginx", "test_data/nginx.values.yaml")
|
||||||
|
assert.NoError(t, err)
|
||||||
|
})
|
||||||
|
}
|
895
internal/accept_test/test_data/nginx.values.yaml
Normal file
895
internal/accept_test/test_data/nginx.values.yaml
Normal file
@ -0,0 +1,895 @@
|
|||||||
|
## @section Global parameters
|
||||||
|
## Global Docker image parameters
|
||||||
|
## Please, note that this will override the image parameters, including dependencies, configured to use the global value
|
||||||
|
## Current available global Docker image parameters: imageRegistry, imagePullSecrets and storageClass
|
||||||
|
|
||||||
|
## @param global.imageRegistry Global Docker image registry
|
||||||
|
## @param global.imagePullSecrets Global Docker registry secret names as an array
|
||||||
|
##
|
||||||
|
global:
|
||||||
|
imageRegistry: ""
|
||||||
|
## E.g.
|
||||||
|
## imagePullSecrets:
|
||||||
|
## - myRegistryKeySecretName
|
||||||
|
##
|
||||||
|
imagePullSecrets: []
|
||||||
|
|
||||||
|
## @section Common parameters
|
||||||
|
|
||||||
|
## @param nameOverride String to partially override nginx.fullname template (will maintain the release name)
|
||||||
|
##
|
||||||
|
nameOverride: ""
|
||||||
|
## @param fullnameOverride String to fully override nginx.fullname template
|
||||||
|
##
|
||||||
|
fullnameOverride: ""
|
||||||
|
## @param namespaceOverride String to fully override common.names.namespace
|
||||||
|
##
|
||||||
|
namespaceOverride: ""
|
||||||
|
## @param kubeVersion Force target Kubernetes version (using Helm capabilities if not set)
|
||||||
|
##
|
||||||
|
kubeVersion: ""
|
||||||
|
## @param clusterDomain Kubernetes Cluster Domain
|
||||||
|
##
|
||||||
|
clusterDomain: cluster.local
|
||||||
|
## @param extraDeploy Extra objects to deploy (value evaluated as a template)
|
||||||
|
##
|
||||||
|
extraDeploy: []
|
||||||
|
## @param commonLabels Add labels to all the deployed resources
|
||||||
|
##
|
||||||
|
commonLabels: {}
|
||||||
|
## @param commonAnnotations Add annotations to all the deployed resources
|
||||||
|
##
|
||||||
|
commonAnnotations: {}
|
||||||
|
|
||||||
|
## Enable diagnostic mode in the deployment(s)/statefulset(s)
|
||||||
|
##
|
||||||
|
diagnosticMode:
|
||||||
|
## @param diagnosticMode.enabled Enable diagnostic mode (all probes will be disabled and the command will be overridden)
|
||||||
|
##
|
||||||
|
enabled: false
|
||||||
|
## @param diagnosticMode.command Command to override all containers in the the deployment(s)/statefulset(s)
|
||||||
|
##
|
||||||
|
command:
|
||||||
|
- sleep
|
||||||
|
## @param diagnosticMode.args Args to override all containers in the the deployment(s)/statefulset(s)
|
||||||
|
##
|
||||||
|
args:
|
||||||
|
- infinity
|
||||||
|
|
||||||
|
## @section NGINX parameters
|
||||||
|
|
||||||
|
## Bitnami NGINX image version
|
||||||
|
## ref: https://hub.docker.com/r/bitnami/nginx/tags/
|
||||||
|
## @param image.registry NGINX image registry
|
||||||
|
## @param image.repository NGINX image repository
|
||||||
|
## @param image.tag NGINX image tag (immutable tags are recommended)
|
||||||
|
## @param image.digest NGINX image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag
|
||||||
|
## @param image.pullPolicy NGINX image pull policy
|
||||||
|
## @param image.pullSecrets Specify docker-registry secret names as an array
|
||||||
|
## @param image.debug Set to true if you would like to see extra information on logs
|
||||||
|
##
|
||||||
|
image:
|
||||||
|
registry: docker.io
|
||||||
|
repository: bitnami/nginx
|
||||||
|
tag: 1.23.4-debian-11-r1
|
||||||
|
digest: ""
|
||||||
|
## Specify a imagePullPolicy
|
||||||
|
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
||||||
|
## ref: https://kubernetes.io/docs/user-guide/images/#pre-pulling-images
|
||||||
|
##
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
## Optionally specify an array of imagePullSecrets.
|
||||||
|
## Secrets must be manually created in the namespace.
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||||
|
## E.g.:
|
||||||
|
## pullSecrets:
|
||||||
|
## - myRegistryKeySecretName
|
||||||
|
##
|
||||||
|
pullSecrets: []
|
||||||
|
## Set to true if you would like to see extra information on logs
|
||||||
|
##
|
||||||
|
debug: false
|
||||||
|
## @param hostAliases Deployment pod host aliases
|
||||||
|
## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/
|
||||||
|
##
|
||||||
|
hostAliases: []
|
||||||
|
## Command and args for running the container (set to default if not set). Use array form
|
||||||
|
## @param command Override default container command (useful when using custom images)
|
||||||
|
## @param args Override default container args (useful when using custom images)
|
||||||
|
##
|
||||||
|
command: []
|
||||||
|
args: []
|
||||||
|
## @param extraEnvVars Extra environment variables to be set on NGINX containers
|
||||||
|
## E.g:
|
||||||
|
## extraEnvVars:
|
||||||
|
## - name: FOO
|
||||||
|
## value: BAR
|
||||||
|
##
|
||||||
|
extraEnvVars: []
|
||||||
|
## @param extraEnvVarsCM ConfigMap with extra environment variables
|
||||||
|
##
|
||||||
|
extraEnvVarsCM: ""
|
||||||
|
## @param extraEnvVarsSecret Secret with extra environment variables
|
||||||
|
##
|
||||||
|
extraEnvVarsSecret: ""
|
||||||
|
|
||||||
|
## @section NGINX deployment parameters
|
||||||
|
|
||||||
|
## @param replicaCount Number of NGINX replicas to deploy
|
||||||
|
##
|
||||||
|
replicaCount: 1
|
||||||
|
## @param updateStrategy.type NGINX deployment strategy type
|
||||||
|
## @param updateStrategy.rollingUpdate NGINX deployment rolling update configuration parameters
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
|
||||||
|
##
|
||||||
|
updateStrategy:
|
||||||
|
type: RollingUpdate
|
||||||
|
rollingUpdate: {}
|
||||||
|
## @param podLabels Additional labels for NGINX pods
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
|
||||||
|
##
|
||||||
|
podLabels: {}
|
||||||
|
## @param podAnnotations Annotations for NGINX pods
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
|
||||||
|
##
|
||||||
|
podAnnotations: {}
|
||||||
|
## @param podAffinityPreset Pod affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard`
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity
|
||||||
|
##
|
||||||
|
podAffinityPreset: ""
|
||||||
|
## @param podAntiAffinityPreset Pod anti-affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard`
|
||||||
|
## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity
|
||||||
|
##
|
||||||
|
podAntiAffinityPreset: soft
|
||||||
|
## Node affinity preset
|
||||||
|
## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity
|
||||||
|
##
|
||||||
|
nodeAffinityPreset:
|
||||||
|
## @param nodeAffinityPreset.type Node affinity preset type. Ignored if `affinity` is set. Allowed values: `soft` or `hard`
|
||||||
|
##
|
||||||
|
type: ""
|
||||||
|
## @param nodeAffinityPreset.key Node label key to match Ignored if `affinity` is set.
|
||||||
|
## E.g.
|
||||||
|
## key: "kubernetes.io/e2e-az-name"
|
||||||
|
##
|
||||||
|
key: ""
|
||||||
|
## @param nodeAffinityPreset.values Node label values to match. Ignored if `affinity` is set.
|
||||||
|
## E.g.
|
||||||
|
## values:
|
||||||
|
## - e2e-az1
|
||||||
|
## - e2e-az2
|
||||||
|
##
|
||||||
|
values: []
|
||||||
|
## @param affinity Affinity for pod assignment
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||||
|
## Note: podAffinityPreset, podAntiAffinityPreset, and nodeAffinityPreset will be ignored when it's set
|
||||||
|
##
|
||||||
|
affinity: {}
|
||||||
|
## @param hostNetwork Specify if host network should be enabled for NGINX pod
|
||||||
|
##
|
||||||
|
hostNetwork: false
|
||||||
|
## @param hostIPC Specify if host IPC should be enabled for NGINX pod
|
||||||
|
##
|
||||||
|
hostIPC: false
|
||||||
|
## @param nodeSelector Node labels for pod assignment. Evaluated as a template.
|
||||||
|
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
|
||||||
|
##
|
||||||
|
nodeSelector: {}
|
||||||
|
## @param tolerations Tolerations for pod assignment. Evaluated as a template.
|
||||||
|
## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
|
||||||
|
##
|
||||||
|
tolerations: []
|
||||||
|
## @param priorityClassName NGINX pods' priorityClassName
|
||||||
|
##
|
||||||
|
priorityClassName: ""
|
||||||
|
## @param schedulerName Name of the k8s scheduler (other than default)
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
|
||||||
|
##
|
||||||
|
schedulerName: ""
|
||||||
|
## @param terminationGracePeriodSeconds In seconds, time the given to the NGINX pod needs to terminate gracefully
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod/#termination-of-pods
|
||||||
|
##
|
||||||
|
terminationGracePeriodSeconds: ""
|
||||||
|
## @param topologySpreadConstraints Topology Spread Constraints for pod assignment
|
||||||
|
## https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
|
||||||
|
## The value is evaluated as a template
|
||||||
|
##
|
||||||
|
topologySpreadConstraints: []
|
||||||
|
## NGINX pods' Security Context.
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod
|
||||||
|
## @param podSecurityContext.enabled Enabled NGINX pods' Security Context
|
||||||
|
## @param podSecurityContext.fsGroup Set NGINX pod's Security Context fsGroup
|
||||||
|
## @param podSecurityContext.sysctls sysctl settings of the NGINX pods
|
||||||
|
##
|
||||||
|
podSecurityContext:
|
||||||
|
enabled: false
|
||||||
|
fsGroup: 1001
|
||||||
|
## sysctl settings
|
||||||
|
## Example:
|
||||||
|
## sysctls:
|
||||||
|
## - name: net.core.somaxconn
|
||||||
|
## value: "10000"
|
||||||
|
##
|
||||||
|
sysctls: []
|
||||||
|
## NGINX containers' Security Context.
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container
|
||||||
|
## @param containerSecurityContext.enabled Enabled NGINX containers' Security Context
|
||||||
|
## @param containerSecurityContext.runAsUser Set NGINX container's Security Context runAsUser
|
||||||
|
## @param containerSecurityContext.runAsNonRoot Set NGINX container's Security Context runAsNonRoot
|
||||||
|
##
|
||||||
|
containerSecurityContext:
|
||||||
|
enabled: false
|
||||||
|
runAsUser: 1001
|
||||||
|
runAsNonRoot: true
|
||||||
|
## Configures the ports NGINX listens on
|
||||||
|
## @param containerPorts.http Sets http port inside NGINX container
|
||||||
|
## @param containerPorts.https Sets https port inside NGINX container
|
||||||
|
##
|
||||||
|
containerPorts:
|
||||||
|
http: 8080
|
||||||
|
https: ""
|
||||||
|
## @param extraContainerPorts Array of additional container ports for the Nginx container
|
||||||
|
## e.g:
|
||||||
|
## extraContainerPorts:
|
||||||
|
## - name: grpc
|
||||||
|
## containerPort: 4317
|
||||||
|
##
|
||||||
|
extraContainerPorts: []
|
||||||
|
## NGINX containers' resource requests and limits
|
||||||
|
## ref: https://kubernetes.io/docs/user-guide/compute-resources/
|
||||||
|
## We usually recommend not to specify default resources and to leave this as a conscious
|
||||||
|
## choice for the user. This also increases chances charts run on environments with little
|
||||||
|
## resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||||
|
## lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||||
|
## @param resources.limits The resources limits for the NGINX container
|
||||||
|
## @param resources.requests The requested resources for the NGINX container
|
||||||
|
##
|
||||||
|
resources:
|
||||||
|
## Example:
|
||||||
|
## limits:
|
||||||
|
## cpu: 100m
|
||||||
|
## memory: 128Mi
|
||||||
|
limits: {}
|
||||||
|
## Examples:
|
||||||
|
## requests:
|
||||||
|
## cpu: 100m
|
||||||
|
## memory: 128Mi
|
||||||
|
requests: {}
|
||||||
|
|
||||||
|
## NGINX containers' lifecycleHooks
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/
|
||||||
|
## If you do want to specify lifecycleHooks, uncomment the following
|
||||||
|
## lines, adjust them as necessary, and remove the curly braces on 'lifecycle:{}'.
|
||||||
|
## @param lifecycleHooks Optional lifecycleHooks for the NGINX container
|
||||||
|
lifecycleHooks: {}
|
||||||
|
## Example:
|
||||||
|
## postStart:
|
||||||
|
## exec:
|
||||||
|
## command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"]
|
||||||
|
## Example:
|
||||||
|
## preStop:
|
||||||
|
## exec:
|
||||||
|
## command: ["/bin/sleep", "20"]
|
||||||
|
## command: ["/bin/sh","-c","nginx -s quit; while killall -0 nginx; do sleep 1; done"]
|
||||||
|
|
||||||
|
## NGINX containers' startup probe.
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes
|
||||||
|
## @param startupProbe.enabled Enable startupProbe
|
||||||
|
## @param startupProbe.initialDelaySeconds Initial delay seconds for startupProbe
|
||||||
|
## @param startupProbe.periodSeconds Period seconds for startupProbe
|
||||||
|
## @param startupProbe.timeoutSeconds Timeout seconds for startupProbe
|
||||||
|
## @param startupProbe.failureThreshold Failure threshold for startupProbe
|
||||||
|
## @param startupProbe.successThreshold Success threshold for startupProbe
|
||||||
|
##
|
||||||
|
startupProbe:
|
||||||
|
enabled: false
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
timeoutSeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
failureThreshold: 6
|
||||||
|
successThreshold: 1
|
||||||
|
## NGINX containers' liveness probe.
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes
|
||||||
|
## @param livenessProbe.enabled Enable livenessProbe
|
||||||
|
## @param livenessProbe.initialDelaySeconds Initial delay seconds for livenessProbe
|
||||||
|
## @param livenessProbe.periodSeconds Period seconds for livenessProbe
|
||||||
|
## @param livenessProbe.timeoutSeconds Timeout seconds for livenessProbe
|
||||||
|
## @param livenessProbe.failureThreshold Failure threshold for livenessProbe
|
||||||
|
## @param livenessProbe.successThreshold Success threshold for livenessProbe
|
||||||
|
##
|
||||||
|
livenessProbe:
|
||||||
|
enabled: true
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
timeoutSeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
failureThreshold: 6
|
||||||
|
successThreshold: 1
|
||||||
|
## NGINX containers' readiness probe.
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes
|
||||||
|
## @param readinessProbe.enabled Enable readinessProbe
|
||||||
|
## @param readinessProbe.initialDelaySeconds Initial delay seconds for readinessProbe
|
||||||
|
## @param readinessProbe.periodSeconds Period seconds for readinessProbe
|
||||||
|
## @param readinessProbe.timeoutSeconds Timeout seconds for readinessProbe
|
||||||
|
## @param readinessProbe.failureThreshold Failure threshold for readinessProbe
|
||||||
|
## @param readinessProbe.successThreshold Success threshold for readinessProbe
|
||||||
|
##
|
||||||
|
readinessProbe:
|
||||||
|
enabled: true
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
timeoutSeconds: 3
|
||||||
|
periodSeconds: 5
|
||||||
|
failureThreshold: 3
|
||||||
|
successThreshold: 1
|
||||||
|
## @param customStartupProbe Custom liveness probe for the Web component
|
||||||
|
##
|
||||||
|
customStartupProbe: {}
|
||||||
|
## @param customLivenessProbe Override default liveness probe
|
||||||
|
##
|
||||||
|
customLivenessProbe: {}
|
||||||
|
## @param customReadinessProbe Override default readiness probe
|
||||||
|
##
|
||||||
|
customReadinessProbe: {}
|
||||||
|
## Autoscaling parameters
|
||||||
|
## @param autoscaling.enabled Enable autoscaling for NGINX deployment
|
||||||
|
## @param autoscaling.minReplicas Minimum number of replicas to scale back
|
||||||
|
## @param autoscaling.maxReplicas Maximum number of replicas to scale out
|
||||||
|
## @param autoscaling.targetCPU Target CPU utilization percentage
|
||||||
|
## @param autoscaling.targetMemory Target Memory utilization percentage
|
||||||
|
##
|
||||||
|
autoscaling:
|
||||||
|
enabled: false
|
||||||
|
minReplicas: ""
|
||||||
|
maxReplicas: ""
|
||||||
|
targetCPU: ""
|
||||||
|
targetMemory: ""
|
||||||
|
## @param extraVolumes Array to add extra volumes
|
||||||
|
##
|
||||||
|
extraVolumes: []
|
||||||
|
## @param extraVolumeMounts Array to add extra mount
|
||||||
|
##
|
||||||
|
extraVolumeMounts: []
|
||||||
|
## Pods Service Account
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
|
||||||
|
##
|
||||||
|
serviceAccount:
|
||||||
|
## @param serviceAccount.create Enable creation of ServiceAccount for nginx pod
|
||||||
|
##
|
||||||
|
create: false
|
||||||
|
## @param serviceAccount.name The name of the ServiceAccount to use.
|
||||||
|
## If not set and create is true, a name is generated using the `common.names.fullname` template
|
||||||
|
name: ""
|
||||||
|
## @param serviceAccount.annotations Annotations for service account. Evaluated as a template.
|
||||||
|
## Only used if `create` is `true`.
|
||||||
|
##
|
||||||
|
annotations: {}
|
||||||
|
## @param serviceAccount.automountServiceAccountToken Auto-mount the service account token in the pod
|
||||||
|
##
|
||||||
|
automountServiceAccountToken: false
|
||||||
|
## @param sidecars Sidecar parameters
|
||||||
|
## e.g:
|
||||||
|
## sidecars:
|
||||||
|
## - name: your-image-name
|
||||||
|
## image: your-image
|
||||||
|
## imagePullPolicy: Always
|
||||||
|
## ports:
|
||||||
|
## - name: portname
|
||||||
|
## containerPort: 1234
|
||||||
|
##
|
||||||
|
sidecars: []
|
||||||
|
|
||||||
|
## @param sidecarSingleProcessNamespace Enable sharing the process namespace with sidecars
|
||||||
|
## This will switch pod.spec.shareProcessNamespace parameter
|
||||||
|
##
|
||||||
|
sidecarSingleProcessNamespace: false
|
||||||
|
|
||||||
|
## @param initContainers Extra init containers
|
||||||
|
##
|
||||||
|
initContainers: []
|
||||||
|
## Pod Disruption Budget configuration
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/
|
||||||
|
##
|
||||||
|
pdb:
|
||||||
|
## @param pdb.create Created a PodDisruptionBudget
|
||||||
|
##
|
||||||
|
create: false
|
||||||
|
## @param pdb.minAvailable Min number of pods that must still be available after the eviction
|
||||||
|
##
|
||||||
|
minAvailable: 1
|
||||||
|
## @param pdb.maxUnavailable Max number of pods that can be unavailable after the eviction
|
||||||
|
##
|
||||||
|
maxUnavailable: 0
|
||||||
|
|
||||||
|
## @section Custom NGINX application parameters
|
||||||
|
|
||||||
|
## Get the server static content from a git repository
|
||||||
|
## NOTE: This will override staticSiteConfigmap and staticSitePVC
|
||||||
|
##
|
||||||
|
cloneStaticSiteFromGit:
|
||||||
|
## @param cloneStaticSiteFromGit.enabled Get the server static content from a Git repository
|
||||||
|
##
|
||||||
|
enabled: false
|
||||||
|
## Bitnami Git image version
|
||||||
|
## ref: https://hub.docker.com/r/bitnami/git/tags/
|
||||||
|
## @param cloneStaticSiteFromGit.image.registry Git image registry
|
||||||
|
## @param cloneStaticSiteFromGit.image.repository Git image repository
|
||||||
|
## @param cloneStaticSiteFromGit.image.tag Git image tag (immutable tags are recommended)
|
||||||
|
## @param cloneStaticSiteFromGit.image.digest Git image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag
|
||||||
|
## @param cloneStaticSiteFromGit.image.pullPolicy Git image pull policy
|
||||||
|
## @param cloneStaticSiteFromGit.image.pullSecrets Specify docker-registry secret names as an array
|
||||||
|
##
|
||||||
|
image:
|
||||||
|
registry: docker.io
|
||||||
|
repository: bitnami/git
|
||||||
|
tag: 2.40.0-debian-11-r5
|
||||||
|
digest: ""
|
||||||
|
## Specify a imagePullPolicy
|
||||||
|
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
||||||
|
## ref: https://kubernetes.io/docs/user-guide/images/#pre-pulling-images
|
||||||
|
##
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
## Optionally specify an array of imagePullSecrets.
|
||||||
|
## Secrets must be manually created in the namespace.
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||||
|
## e.g:
|
||||||
|
## pullSecrets:
|
||||||
|
## - myRegistryKeySecretName
|
||||||
|
##
|
||||||
|
pullSecrets: []
|
||||||
|
## @param cloneStaticSiteFromGit.repository Git Repository to clone static content from
|
||||||
|
##
|
||||||
|
repository: ""
|
||||||
|
## @param cloneStaticSiteFromGit.branch Git branch to checkout
|
||||||
|
##
|
||||||
|
branch: ""
|
||||||
|
## @param cloneStaticSiteFromGit.interval Interval for sidecar container pull from the Git repository
|
||||||
|
##
|
||||||
|
interval: 60
|
||||||
|
## Additional configuration for git-clone-repository initContainer
|
||||||
|
##
|
||||||
|
gitClone:
|
||||||
|
## @param cloneStaticSiteFromGit.gitClone.command Override default container command for git-clone-repository
|
||||||
|
##
|
||||||
|
command: []
|
||||||
|
## @param cloneStaticSiteFromGit.gitClone.args Override default container args for git-clone-repository
|
||||||
|
##
|
||||||
|
args: []
|
||||||
|
## Additional configuration for the git-repo-syncer container
|
||||||
|
##
|
||||||
|
gitSync:
|
||||||
|
## @param cloneStaticSiteFromGit.gitSync.command Override default container command for git-repo-syncer
|
||||||
|
##
|
||||||
|
command: []
|
||||||
|
## @param cloneStaticSiteFromGit.gitSync.args Override default container args for git-repo-syncer
|
||||||
|
##
|
||||||
|
args: []
|
||||||
|
## @param cloneStaticSiteFromGit.extraEnvVars Additional environment variables to set for the in the containers that clone static site from git
|
||||||
|
## E.g:
|
||||||
|
## extraEnvVars:
|
||||||
|
## - name: FOO
|
||||||
|
## value: BAR
|
||||||
|
##
|
||||||
|
extraEnvVars: []
|
||||||
|
## @param cloneStaticSiteFromGit.extraVolumeMounts Add extra volume mounts for the Git containers
|
||||||
|
## Useful to mount keys to connect through ssh. (normally used with extraVolumes)
|
||||||
|
## E.g:
|
||||||
|
## extraVolumeMounts:
|
||||||
|
## - name: ssh-dir
|
||||||
|
## mountPath: /root/.ssh/
|
||||||
|
##
|
||||||
|
extraVolumeMounts: []
|
||||||
|
## @param serverBlock Custom server block to be added to NGINX configuration
|
||||||
|
## PHP-FPM example server block:
|
||||||
|
## serverBlock: |-
|
||||||
|
## server {
|
||||||
|
## listen 0.0.0.0:8080;
|
||||||
|
## root /app;
|
||||||
|
## location / {
|
||||||
|
## index index.html index.php;
|
||||||
|
## }
|
||||||
|
## location ~ \.php$ {
|
||||||
|
## fastcgi_pass phpfpm-server:9000;
|
||||||
|
## fastcgi_index index.php;
|
||||||
|
## include fastcgi.conf;
|
||||||
|
## }
|
||||||
|
## }
|
||||||
|
##
|
||||||
|
serverBlock: ""
|
||||||
|
## @param existingServerBlockConfigmap ConfigMap with custom server block to be added to NGINX configuration
|
||||||
|
## NOTE: This will override serverBlock
|
||||||
|
##
|
||||||
|
existingServerBlockConfigmap: ""
|
||||||
|
## @param staticSiteConfigmap Name of existing ConfigMap with the server static site content
|
||||||
|
##
|
||||||
|
staticSiteConfigmap: ""
|
||||||
|
## @param staticSitePVC Name of existing PVC with the server static site content
|
||||||
|
## NOTE: This will override staticSiteConfigmap
|
||||||
|
##
|
||||||
|
staticSitePVC: ""
|
||||||
|
|
||||||
|
## @section Traffic Exposure parameters
|
||||||
|
|
||||||
|
## NGINX Service properties
|
||||||
|
##
|
||||||
|
service:
|
||||||
|
## @param service.type Service type
|
||||||
|
##
|
||||||
|
type: LoadBalancer
|
||||||
|
## @param service.ports.http Service HTTP port
|
||||||
|
## @param service.ports.https Service HTTPS port
|
||||||
|
##
|
||||||
|
ports:
|
||||||
|
http: 80
|
||||||
|
https: 443
|
||||||
|
##
|
||||||
|
## @param service.nodePorts [object] Specify the nodePort(s) value(s) for the LoadBalancer and NodePort service types.
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
|
||||||
|
##
|
||||||
|
nodePorts:
|
||||||
|
http: ""
|
||||||
|
https: ""
|
||||||
|
## @param service.targetPort [object] Target port reference value for the Loadbalancer service types can be specified explicitly.
|
||||||
|
## Listeners for the Loadbalancer can be custom mapped to the http or https service.
|
||||||
|
## Example: Mapping the https listener to targetPort http [http: https]
|
||||||
|
##
|
||||||
|
targetPort:
|
||||||
|
http: http
|
||||||
|
https: https
|
||||||
|
## @param service.clusterIP NGINX service Cluster IP
|
||||||
|
## e.g.:
|
||||||
|
## clusterIP: None
|
||||||
|
##
|
||||||
|
clusterIP: ""
|
||||||
|
## @param service.loadBalancerIP LoadBalancer service IP address
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
|
||||||
|
##
|
||||||
|
loadBalancerIP: ""
|
||||||
|
## @param service.loadBalancerSourceRanges NGINX service Load Balancer sources
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service
|
||||||
|
## e.g:
|
||||||
|
## loadBalancerSourceRanges:
|
||||||
|
## - 10.10.10.0/24
|
||||||
|
##
|
||||||
|
loadBalancerSourceRanges: []
|
||||||
|
## @param service.extraPorts Extra ports to expose (normally used with the `sidecar` value)
|
||||||
|
##
|
||||||
|
extraPorts: []
|
||||||
|
## @param service.sessionAffinity Session Affinity for Kubernetes service, can be "None" or "ClientIP"
|
||||||
|
## If "ClientIP", consecutive client requests will be directed to the same Pod
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
|
||||||
|
##
|
||||||
|
sessionAffinity: None
|
||||||
|
## @param service.sessionAffinityConfig Additional settings for the sessionAffinity
|
||||||
|
## sessionAffinityConfig:
|
||||||
|
## clientIP:
|
||||||
|
## timeoutSeconds: 300
|
||||||
|
##
|
||||||
|
sessionAffinityConfig: {}
|
||||||
|
## @param service.annotations Service annotations
|
||||||
|
## This can be used to set the LoadBalancer service type to internal only.
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
|
||||||
|
##
|
||||||
|
annotations: {}
|
||||||
|
## @param service.externalTrafficPolicy Enable client source IP preservation
|
||||||
|
## ref https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip
|
||||||
|
##
|
||||||
|
externalTrafficPolicy: Cluster
|
||||||
|
## Configure the ingress resource that allows you to access the
|
||||||
|
## Nginx installation. Set up the URL
|
||||||
|
## ref: https://kubernetes.io/docs/user-guide/ingress/
|
||||||
|
##
|
||||||
|
ingress:
|
||||||
|
## @param ingress.enabled Set to true to enable ingress record generation
|
||||||
|
##
|
||||||
|
enabled: false
|
||||||
|
## @param ingress.selfSigned Create a TLS secret for this ingress record using self-signed certificates generated by Helm
|
||||||
|
##
|
||||||
|
selfSigned: false
|
||||||
|
## @param ingress.pathType Ingress path type
|
||||||
|
##
|
||||||
|
pathType: ImplementationSpecific
|
||||||
|
## @param ingress.apiVersion Force Ingress API version (automatically detected if not set)
|
||||||
|
##
|
||||||
|
apiVersion: ""
|
||||||
|
## @param ingress.hostname Default host for the ingress resource
|
||||||
|
##
|
||||||
|
hostname: nginx.local
|
||||||
|
## @param ingress.path The Path to Nginx. You may need to set this to '/*' in order to use this with ALB ingress controllers.
|
||||||
|
##
|
||||||
|
path: /
|
||||||
|
## @param ingress.annotations Additional annotations for the Ingress resource. To enable certificate autogeneration, place here your cert-manager annotations.
|
||||||
|
## For a full list of possible ingress annotations, please see
|
||||||
|
## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md
|
||||||
|
## Use this parameter to set the required annotations for cert-manager, see
|
||||||
|
## ref: https://cert-manager.io/docs/usage/ingress/#supported-annotations
|
||||||
|
##
|
||||||
|
## e.g:
|
||||||
|
## annotations:
|
||||||
|
## kubernetes.io/ingress.class: nginx
|
||||||
|
## cert-manager.io/cluster-issuer: cluster-issuer-name
|
||||||
|
##
|
||||||
|
annotations: {}
|
||||||
|
## @param ingress.ingressClassName Set the ingerssClassName on the ingress record for k8s 1.18+
|
||||||
|
## This is supported in Kubernetes 1.18+ and required if you have more than one IngressClass marked as the default for your cluster .
|
||||||
|
## ref: https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/
|
||||||
|
##
|
||||||
|
ingressClassName: ""
|
||||||
|
## @param ingress.tls Create TLS Secret
|
||||||
|
## TLS certificates will be retrieved from a TLS secret with name: {{- printf "%s-tls" .Values.ingress.hostname }}
|
||||||
|
## You can use the ingress.secrets parameter to create this TLS secret or relay on cert-manager to create it
|
||||||
|
##
|
||||||
|
tls: false
|
||||||
|
## @param ingress.extraHosts The list of additional hostnames to be covered with this ingress record.
|
||||||
|
## Most likely the hostname above will be enough, but in the event more hosts are needed, this is an array
|
||||||
|
## extraHosts:
|
||||||
|
## - name: nginx.local
|
||||||
|
## path: /
|
||||||
|
##
|
||||||
|
extraHosts: []
|
||||||
|
## @param ingress.extraPaths Any additional arbitrary paths that may need to be added to the ingress under the main host.
|
||||||
|
## For example: The ALB ingress controller requires a special rule for handling SSL redirection.
|
||||||
|
## extraPaths:
|
||||||
|
## - path: /*
|
||||||
|
## backend:
|
||||||
|
## serviceName: ssl-redirect
|
||||||
|
## servicePort: use-annotation
|
||||||
|
##
|
||||||
|
extraPaths: []
|
||||||
|
## @param ingress.extraTls The tls configuration for additional hostnames to be covered with this ingress record.
|
||||||
|
## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls
|
||||||
|
## extraTls:
|
||||||
|
## - hosts:
|
||||||
|
## - nginx.local
|
||||||
|
## secretName: nginx.local-tls
|
||||||
|
##
|
||||||
|
extraTls: []
|
||||||
|
## @param ingress.secrets If you're providing your own certificates, please use this to add the certificates as secrets
|
||||||
|
## key and certificate should start with -----BEGIN CERTIFICATE----- or
|
||||||
|
## -----BEGIN RSA PRIVATE KEY-----
|
||||||
|
##
|
||||||
|
## name should line up with a tlsSecret set further up
|
||||||
|
## If you're using cert-manager, this is unneeded, as it will create the secret for you if it is not set
|
||||||
|
##
|
||||||
|
## It is also possible to create and manage the certificates outside of this helm chart
|
||||||
|
## Please see README.md for more information
|
||||||
|
## e.g:
|
||||||
|
## - name: nginx.local-tls
|
||||||
|
## key:
|
||||||
|
## certificate:
|
||||||
|
##
|
||||||
|
secrets: []
|
||||||
|
## @param ingress.extraRules The list of additional rules to be added to this ingress record. Evaluated as a template
|
||||||
|
## Useful when looking for additional customization, such as using different backend
|
||||||
|
##
|
||||||
|
extraRules: []
|
||||||
|
## Health Ingress parameters
|
||||||
|
##
|
||||||
|
healthIngress:
|
||||||
|
## @param healthIngress.enabled Set to true to enable health ingress record generation
|
||||||
|
##
|
||||||
|
enabled: false
|
||||||
|
## @param healthIngress.selfSigned Create a TLS secret for this ingress record using self-signed certificates generated by Helm
|
||||||
|
##
|
||||||
|
selfSigned: false
|
||||||
|
## @param healthIngress.pathType Ingress path type
|
||||||
|
##
|
||||||
|
pathType: ImplementationSpecific
|
||||||
|
## @param healthIngress.hostname When the health ingress is enabled, a host pointing to this will be created
|
||||||
|
##
|
||||||
|
hostname: example.local
|
||||||
|
## @param healthIngress.path Default path for the ingress record
|
||||||
|
## NOTE: You may need to set this to '/*' in order to use this with ALB ingress controllers
|
||||||
|
##
|
||||||
|
path: /
|
||||||
|
## @param healthIngress.annotations Additional annotations for the Ingress resource. To enable certificate autogeneration, place here your cert-manager annotations.
|
||||||
|
## For a full list of possible ingress annotations, please see
|
||||||
|
## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md
|
||||||
|
## Use this parameter to set the required annotations for cert-manager, see
|
||||||
|
## ref: https://cert-manager.io/docs/usage/ingress/#supported-annotations
|
||||||
|
##
|
||||||
|
## e.g:
|
||||||
|
## annotations:
|
||||||
|
## kubernetes.io/ingress.class: nginx
|
||||||
|
## cert-manager.io/cluster-issuer: cluster-issuer-name
|
||||||
|
##
|
||||||
|
annotations: {}
|
||||||
|
## @param healthIngress.tls Enable TLS configuration for the hostname defined at `healthIngress.hostname` parameter
|
||||||
|
## TLS certificates will be retrieved from a TLS secret with name: {{- printf "%s-tls" .Values.healthIngress.hostname }}
|
||||||
|
## You can use the healthIngress.secrets parameter to create this TLS secret, relay on cert-manager to create it, or
|
||||||
|
## let the chart create self-signed certificates for you
|
||||||
|
##
|
||||||
|
tls: false
|
||||||
|
## @param healthIngress.extraHosts An array with additional hostname(s) to be covered with the ingress record
|
||||||
|
## e.g:
|
||||||
|
## extraHosts:
|
||||||
|
## - name: example.local
|
||||||
|
## path: /
|
||||||
|
##
|
||||||
|
extraHosts: []
|
||||||
|
## @param healthIngress.extraPaths An array with additional arbitrary paths that may need to be added to the ingress under the main host
|
||||||
|
## e.g:
|
||||||
|
## extraPaths:
|
||||||
|
## - path: /*
|
||||||
|
## backend:
|
||||||
|
## serviceName: ssl-redirect
|
||||||
|
## servicePort: use-annotation
|
||||||
|
##
|
||||||
|
extraPaths: []
|
||||||
|
## @param healthIngress.extraTls TLS configuration for additional hostnames to be covered
|
||||||
|
## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls
|
||||||
|
## E.g.
|
||||||
|
## extraTls:
|
||||||
|
## - hosts:
|
||||||
|
## - example.local
|
||||||
|
## secretName: example.local-tls
|
||||||
|
##
|
||||||
|
extraTls: []
|
||||||
|
## @param healthIngress.secrets TLS Secret configuration
|
||||||
|
## If you're providing your own certificates, please use this to add the certificates as secrets
|
||||||
|
## key and certificate should start with -----BEGIN CERTIFICATE----- or -----BEGIN RSA PRIVATE KEY-----
|
||||||
|
## name should line up with a secretName set further up
|
||||||
|
## If it is not set and you're using cert-manager, this is unneeded, as it will create the secret for you
|
||||||
|
## If it is not set and you're NOT using cert-manager either, self-signed certificates will be created
|
||||||
|
## It is also possible to create and manage the certificates outside of this helm chart
|
||||||
|
## Please see README.md for more information
|
||||||
|
##
|
||||||
|
## E.g.
|
||||||
|
## secrets:
|
||||||
|
## - name: example.local-tls
|
||||||
|
## key:
|
||||||
|
## certificate:
|
||||||
|
##
|
||||||
|
secrets: []
|
||||||
|
## @param healthIngress.ingressClassName IngressClass that will be be used to implement the Ingress (Kubernetes 1.18+)
|
||||||
|
## This is supported in Kubernetes 1.18+ and required if you have more than one IngressClass marked as the default for your cluster .
|
||||||
|
## ref: https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/
|
||||||
|
##
|
||||||
|
ingressClassName: ""
|
||||||
|
## @param healthIngress.extraRules The list of additional rules to be added to this ingress record. Evaluated as a template
|
||||||
|
## Useful when looking for additional customization, such as using different backend
|
||||||
|
##
|
||||||
|
extraRules: []
|
||||||
|
|
||||||
|
## @section Metrics parameters
|
||||||
|
|
||||||
|
## Prometheus Exporter / Metrics
|
||||||
|
##
|
||||||
|
metrics:
|
||||||
|
## @param metrics.enabled Start a Prometheus exporter sidecar container
|
||||||
|
##
|
||||||
|
enabled: false
|
||||||
|
## @param metrics.port NGINX Container Status Port scraped by Prometheus Exporter
|
||||||
|
## Defaults to specified http port
|
||||||
|
port: ""
|
||||||
|
## Bitnami NGINX Prometheus Exporter image
|
||||||
|
## ref: https://hub.docker.com/r/bitnami/nginx-exporter/tags/
|
||||||
|
## @param metrics.image.registry NGINX Prometheus exporter image registry
|
||||||
|
## @param metrics.image.repository NGINX Prometheus exporter image repository
|
||||||
|
## @param metrics.image.tag NGINX Prometheus exporter image tag (immutable tags are recommended)
|
||||||
|
## @param metrics.image.digest NGINX Prometheus exporter image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag
|
||||||
|
## @param metrics.image.pullPolicy NGINX Prometheus exporter image pull policy
|
||||||
|
## @param metrics.image.pullSecrets Specify docker-registry secret names as an array
|
||||||
|
##
|
||||||
|
image:
|
||||||
|
registry: docker.io
|
||||||
|
repository: bitnami/nginx-exporter
|
||||||
|
tag: 0.11.0-debian-11-r66
|
||||||
|
digest: ""
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
## Optionally specify an array of imagePullSecrets.
|
||||||
|
## Secrets must be manually created in the namespace.
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||||
|
## e.g:
|
||||||
|
## pullSecrets:
|
||||||
|
## - myRegistryKeySecretName
|
||||||
|
##
|
||||||
|
pullSecrets: []
|
||||||
|
## @param metrics.podAnnotations Additional annotations for NGINX Prometheus exporter pod(s)
|
||||||
|
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
|
||||||
|
##
|
||||||
|
podAnnotations: {}
|
||||||
|
## Container Security Context
|
||||||
|
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||||
|
## @param metrics.securityContext.enabled Enabled NGINX Exporter containers' Security Context
|
||||||
|
## @param metrics.securityContext.runAsUser Set NGINX Exporter container's Security Context runAsUser
|
||||||
|
##
|
||||||
|
securityContext:
|
||||||
|
enabled: false
|
||||||
|
runAsUser: 1001
|
||||||
|
## Prometheus exporter service parameters
|
||||||
|
##
|
||||||
|
service:
|
||||||
|
## @param metrics.service.port NGINX Prometheus exporter service port
|
||||||
|
##
|
||||||
|
port: 9113
|
||||||
|
## @param metrics.service.annotations [object] Annotations for the Prometheus exporter service
|
||||||
|
##
|
||||||
|
annotations:
|
||||||
|
prometheus.io/scrape: "true"
|
||||||
|
prometheus.io/port: "{{ .Values.metrics.service.port }}"
|
||||||
|
## NGINX Prometheus exporter resource requests and limits
|
||||||
|
## ref: https://kubernetes.io/docs/user-guide/compute-resources/
|
||||||
|
## We usually recommend not to specify default resources and to leave this as a conscious
|
||||||
|
## choice for the user. This also increases chances charts run on environments with little
|
||||||
|
## resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||||
|
## lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||||
|
## @param metrics.resources.limits The resources limits for the NGINX Prometheus exporter container
|
||||||
|
## @param metrics.resources.requests The requested resources for the NGINX Prometheus exporter container
|
||||||
|
##
|
||||||
|
resources:
|
||||||
|
## Example:
|
||||||
|
## limits:
|
||||||
|
## cpu: 100m
|
||||||
|
## memory: 128Mi
|
||||||
|
limits: {}
|
||||||
|
## Examples:
|
||||||
|
## requests:
|
||||||
|
## cpu: 100m
|
||||||
|
## memory: 128Mi
|
||||||
|
requests: {}
|
||||||
|
## Prometheus Operator ServiceMonitor configuration
|
||||||
|
##
|
||||||
|
serviceMonitor:
|
||||||
|
## @param metrics.serviceMonitor.enabled Creates a Prometheus Operator ServiceMonitor (also requires `metrics.enabled` to be `true`)
|
||||||
|
##
|
||||||
|
enabled: false
|
||||||
|
## @param metrics.serviceMonitor.namespace Namespace in which Prometheus is running
|
||||||
|
##
|
||||||
|
namespace: ""
|
||||||
|
## @param metrics.serviceMonitor.jobLabel The name of the label on the target service to use as the job name in prometheus.
|
||||||
|
##
|
||||||
|
jobLabel: ""
|
||||||
|
## @param metrics.serviceMonitor.interval Interval at which metrics should be scraped.
|
||||||
|
## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#endpoint
|
||||||
|
## e.g:
|
||||||
|
## interval: 10s
|
||||||
|
##
|
||||||
|
interval: ""
|
||||||
|
## @param metrics.serviceMonitor.scrapeTimeout Timeout after which the scrape is ended
|
||||||
|
## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#endpoint
|
||||||
|
## e.g:
|
||||||
|
## scrapeTimeout: 10s
|
||||||
|
##
|
||||||
|
scrapeTimeout: ""
|
||||||
|
## @param metrics.serviceMonitor.selector Prometheus instance selector labels
|
||||||
|
## ref: https://github.com/bitnami/charts/tree/main/bitnami/prometheus-operator#prometheus-configuration
|
||||||
|
##
|
||||||
|
## selector:
|
||||||
|
## prometheus: my-prometheus
|
||||||
|
##
|
||||||
|
selector: {}
|
||||||
|
## @param metrics.serviceMonitor.labels Additional labels that can be used so PodMonitor will be discovered by Prometheus
|
||||||
|
##
|
||||||
|
labels: {}
|
||||||
|
## @param metrics.serviceMonitor.relabelings RelabelConfigs to apply to samples before scraping
|
||||||
|
##
|
||||||
|
relabelings: []
|
||||||
|
## @param metrics.serviceMonitor.metricRelabelings MetricRelabelConfigs to apply to samples before ingestion
|
||||||
|
##
|
||||||
|
metricRelabelings: []
|
||||||
|
## @param metrics.serviceMonitor.honorLabels honorLabels chooses the metric's labels on collisions with target labels
|
||||||
|
##
|
||||||
|
honorLabels: false
|
||||||
|
## Prometheus Operator PrometheusRule configuration
|
||||||
|
##
|
||||||
|
prometheusRule:
|
||||||
|
## @param metrics.prometheusRule.enabled if `true`, creates a Prometheus Operator PrometheusRule (also requires `metrics.enabled` to be `true` and `metrics.prometheusRule.rules`)
|
||||||
|
##
|
||||||
|
enabled: false
|
||||||
|
## @param metrics.prometheusRule.namespace Namespace for the PrometheusRule Resource (defaults to the Release Namespace)
|
||||||
|
##
|
||||||
|
namespace: ""
|
||||||
|
## @param metrics.prometheusRule.additionalLabels Additional labels that can be used so PrometheusRule will be discovered by Prometheus
|
||||||
|
##
|
||||||
|
additionalLabels: {}
|
||||||
|
## @param metrics.prometheusRule.rules Prometheus Rule definitions
|
||||||
|
## - alert: LowInstance
|
||||||
|
## expr: up{service="{{ template "common.names.fullname" . }}"} < 1
|
||||||
|
## for: 1m
|
||||||
|
## labels:
|
||||||
|
## severity: critical
|
||||||
|
## annotations:
|
||||||
|
## description: Service {{ template "common.names.fullname" . }} Tomcat is down since 1m.
|
||||||
|
## summary: Tomcat instance is down.
|
||||||
|
##
|
||||||
|
rules: []
|
21
internal/accept_test/test_data/nginx/.helmignore
Normal file
21
internal/accept_test/test_data/nginx/.helmignore
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# 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
|
||||||
|
*~
|
||||||
|
# Various IDEs
|
||||||
|
.project
|
||||||
|
.idea/
|
||||||
|
*.tmproj
|
6
internal/accept_test/test_data/nginx/Chart.lock
Normal file
6
internal/accept_test/test_data/nginx/Chart.lock
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
dependencies:
|
||||||
|
- name: common
|
||||||
|
repository: https://charts.bitnami.com/bitnami
|
||||||
|
version: 2.2.4
|
||||||
|
digest: sha256:634d19e9b7f6e4c07d7c04a0161ab96b3f83335ebdd70b35b952319ef0a2586b
|
||||||
|
generated: "2023-03-18T23:11:02.451957901Z"
|
30
internal/accept_test/test_data/nginx/Chart.yaml
Normal file
30
internal/accept_test/test_data/nginx/Chart.yaml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
annotations:
|
||||||
|
category: Infrastructure
|
||||||
|
licenses: Apache-2.0
|
||||||
|
apiVersion: v2
|
||||||
|
appVersion: 1.23.4
|
||||||
|
dependencies:
|
||||||
|
- name: common
|
||||||
|
repository: https://charts.bitnami.com/bitnami
|
||||||
|
tags:
|
||||||
|
- bitnami-common
|
||||||
|
version: 2.x.x
|
||||||
|
description: NGINX Open Source is a web server that can be also used as a reverse
|
||||||
|
proxy, load balancer, and HTTP cache. Recommended for high-demanding sites due to
|
||||||
|
its ability to provide faster content.
|
||||||
|
home: https://github.com/bitnami/charts/tree/main/bitnami/nginx
|
||||||
|
icon: https://bitnami.com/assets/stacks/nginx/img/nginx-stack-220x234.png
|
||||||
|
keywords:
|
||||||
|
- nginx
|
||||||
|
- http
|
||||||
|
- web
|
||||||
|
- www
|
||||||
|
- reverse proxy
|
||||||
|
maintainers:
|
||||||
|
- name: Bitnami
|
||||||
|
url: https://github.com/bitnami/charts
|
||||||
|
name: nginx
|
||||||
|
sources:
|
||||||
|
- https://github.com/bitnami/containers/tree/main/bitnami/nginx
|
||||||
|
- https://www.nginx.org
|
||||||
|
version: 13.2.33
|
481
internal/accept_test/test_data/nginx/README.md
Normal file
481
internal/accept_test/test_data/nginx/README.md
Normal file
@ -0,0 +1,481 @@
|
|||||||
|
<!--- app-name: NGINX Open Source -->
|
||||||
|
|
||||||
|
# NGINX Open Source packaged by Bitnami
|
||||||
|
|
||||||
|
NGINX Open Source is a web server that can be also used as a reverse proxy, load balancer, and HTTP cache. Recommended for high-demanding sites due to its ability to provide faster content.
|
||||||
|
|
||||||
|
[Overview of NGINX Open Source](http://nginx.org)
|
||||||
|
|
||||||
|
Trademarks: This software listing is packaged by Bitnami. The respective trademarks mentioned in the offering are owned by the respective companies, and use of them does not imply any affiliation or endorsement.
|
||||||
|
|
||||||
|
## TL;DR
|
||||||
|
|
||||||
|
```console
|
||||||
|
helm repo add my-repo https://charts.bitnami.com/bitnami
|
||||||
|
helm install my-release my-repo/nginx
|
||||||
|
```
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
Bitnami charts for Helm are carefully engineered, actively maintained and are the quickest and easiest way to deploy containers on a Kubernetes cluster that are ready to handle production workloads.
|
||||||
|
|
||||||
|
This chart bootstraps a [NGINX Open Source](https://github.com/bitnami/containers/tree/main/bitnami/nginx) deployment on a [Kubernetes](https://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
|
||||||
|
|
||||||
|
Bitnami charts can be used with [Kubeapps](https://kubeapps.dev/) for deployment and management of Helm Charts in clusters.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- Kubernetes 1.19+
|
||||||
|
- Helm 3.2.0+
|
||||||
|
|
||||||
|
## Installing the Chart
|
||||||
|
|
||||||
|
To install the chart with the release name `my-release`:
|
||||||
|
|
||||||
|
```console
|
||||||
|
helm repo add my-repo https://charts.bitnami.com/bitnami
|
||||||
|
helm install my-release my-repo/nginx
|
||||||
|
```
|
||||||
|
|
||||||
|
These commands deploy NGINX Open Source on the Kubernetes cluster in the default configuration.
|
||||||
|
|
||||||
|
> **Tip**: List all releases using `helm list`
|
||||||
|
|
||||||
|
## Uninstalling the Chart
|
||||||
|
|
||||||
|
To uninstall/delete the `my-release` deployment:
|
||||||
|
|
||||||
|
```console
|
||||||
|
helm delete my-release
|
||||||
|
```
|
||||||
|
|
||||||
|
The command removes all the Kubernetes components associated with the chart and deletes the release.
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
### Global parameters
|
||||||
|
|
||||||
|
| Name | Description | Value |
|
||||||
|
| ------------------------- | ----------------------------------------------- | ----- |
|
||||||
|
| `global.imageRegistry` | Global Docker image registry | `""` |
|
||||||
|
| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` |
|
||||||
|
|
||||||
|
### Common parameters
|
||||||
|
|
||||||
|
| Name | Description | Value |
|
||||||
|
| ------------------------ | --------------------------------------------------------------------------------------- | --------------- |
|
||||||
|
| `nameOverride` | String to partially override nginx.fullname template (will maintain the release name) | `""` |
|
||||||
|
| `fullnameOverride` | String to fully override nginx.fullname template | `""` |
|
||||||
|
| `namespaceOverride` | String to fully override common.names.namespace | `""` |
|
||||||
|
| `kubeVersion` | Force target Kubernetes version (using Helm capabilities if not set) | `""` |
|
||||||
|
| `clusterDomain` | Kubernetes Cluster Domain | `cluster.local` |
|
||||||
|
| `extraDeploy` | Extra objects to deploy (value evaluated as a template) | `[]` |
|
||||||
|
| `commonLabels` | Add labels to all the deployed resources | `{}` |
|
||||||
|
| `commonAnnotations` | Add annotations to all the deployed resources | `{}` |
|
||||||
|
| `diagnosticMode.enabled` | Enable diagnostic mode (all probes will be disabled and the command will be overridden) | `false` |
|
||||||
|
| `diagnosticMode.command` | Command to override all containers in the the deployment(s)/statefulset(s) | `["sleep"]` |
|
||||||
|
| `diagnosticMode.args` | Args to override all containers in the the deployment(s)/statefulset(s) | `["infinity"]` |
|
||||||
|
|
||||||
|
### NGINX parameters
|
||||||
|
|
||||||
|
| Name | Description | Value |
|
||||||
|
| -------------------- | ----------------------------------------------------------------------------------------------------- | --------------------- |
|
||||||
|
| `image.registry` | NGINX image registry | `docker.io` |
|
||||||
|
| `image.repository` | NGINX image repository | `bitnami/nginx` |
|
||||||
|
| `image.tag` | NGINX image tag (immutable tags are recommended) | `1.23.4-debian-11-r1` |
|
||||||
|
| `image.digest` | NGINX image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag | `""` |
|
||||||
|
| `image.pullPolicy` | NGINX image pull policy | `IfNotPresent` |
|
||||||
|
| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` |
|
||||||
|
| `image.debug` | Set to true if you would like to see extra information on logs | `false` |
|
||||||
|
| `hostAliases` | Deployment pod host aliases | `[]` |
|
||||||
|
| `command` | Override default container command (useful when using custom images) | `[]` |
|
||||||
|
| `args` | Override default container args (useful when using custom images) | `[]` |
|
||||||
|
| `extraEnvVars` | Extra environment variables to be set on NGINX containers | `[]` |
|
||||||
|
| `extraEnvVarsCM` | ConfigMap with extra environment variables | `""` |
|
||||||
|
| `extraEnvVarsSecret` | Secret with extra environment variables | `""` |
|
||||||
|
|
||||||
|
### NGINX deployment parameters
|
||||||
|
|
||||||
|
| Name | Description | Value |
|
||||||
|
| --------------------------------------------- | ----------------------------------------------------------------------------------------- | --------------- |
|
||||||
|
| `replicaCount` | Number of NGINX replicas to deploy | `1` |
|
||||||
|
| `updateStrategy.type` | NGINX deployment strategy type | `RollingUpdate` |
|
||||||
|
| `updateStrategy.rollingUpdate` | NGINX deployment rolling update configuration parameters | `{}` |
|
||||||
|
| `podLabels` | Additional labels for NGINX pods | `{}` |
|
||||||
|
| `podAnnotations` | Annotations for NGINX pods | `{}` |
|
||||||
|
| `podAffinityPreset` | Pod affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` |
|
||||||
|
| `podAntiAffinityPreset` | Pod anti-affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `soft` |
|
||||||
|
| `nodeAffinityPreset.type` | Node affinity preset type. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` |
|
||||||
|
| `nodeAffinityPreset.key` | Node label key to match Ignored if `affinity` is set. | `""` |
|
||||||
|
| `nodeAffinityPreset.values` | Node label values to match. Ignored if `affinity` is set. | `[]` |
|
||||||
|
| `affinity` | Affinity for pod assignment | `{}` |
|
||||||
|
| `hostNetwork` | Specify if host network should be enabled for NGINX pod | `false` |
|
||||||
|
| `hostIPC` | Specify if host IPC should be enabled for NGINX pod | `false` |
|
||||||
|
| `nodeSelector` | Node labels for pod assignment. Evaluated as a template. | `{}` |
|
||||||
|
| `tolerations` | Tolerations for pod assignment. Evaluated as a template. | `[]` |
|
||||||
|
| `priorityClassName` | NGINX pods' priorityClassName | `""` |
|
||||||
|
| `schedulerName` | Name of the k8s scheduler (other than default) | `""` |
|
||||||
|
| `terminationGracePeriodSeconds` | In seconds, time the given to the NGINX pod needs to terminate gracefully | `""` |
|
||||||
|
| `topologySpreadConstraints` | Topology Spread Constraints for pod assignment | `[]` |
|
||||||
|
| `podSecurityContext.enabled` | Enabled NGINX pods' Security Context | `false` |
|
||||||
|
| `podSecurityContext.fsGroup` | Set NGINX pod's Security Context fsGroup | `1001` |
|
||||||
|
| `podSecurityContext.sysctls` | sysctl settings of the NGINX pods | `[]` |
|
||||||
|
| `containerSecurityContext.enabled` | Enabled NGINX containers' Security Context | `false` |
|
||||||
|
| `containerSecurityContext.runAsUser` | Set NGINX container's Security Context runAsUser | `1001` |
|
||||||
|
| `containerSecurityContext.runAsNonRoot` | Set NGINX container's Security Context runAsNonRoot | `true` |
|
||||||
|
| `containerPorts.http` | Sets http port inside NGINX container | `8080` |
|
||||||
|
| `containerPorts.https` | Sets https port inside NGINX container | `""` |
|
||||||
|
| `extraContainerPorts` | Array of additional container ports for the Nginx container | `[]` |
|
||||||
|
| `resources.limits` | The resources limits for the NGINX container | `{}` |
|
||||||
|
| `resources.requests` | The requested resources for the NGINX container | `{}` |
|
||||||
|
| `lifecycleHooks` | Optional lifecycleHooks for the NGINX container | `{}` |
|
||||||
|
| `startupProbe.enabled` | Enable startupProbe | `false` |
|
||||||
|
| `startupProbe.initialDelaySeconds` | Initial delay seconds for startupProbe | `30` |
|
||||||
|
| `startupProbe.periodSeconds` | Period seconds for startupProbe | `10` |
|
||||||
|
| `startupProbe.timeoutSeconds` | Timeout seconds for startupProbe | `5` |
|
||||||
|
| `startupProbe.failureThreshold` | Failure threshold for startupProbe | `6` |
|
||||||
|
| `startupProbe.successThreshold` | Success threshold for startupProbe | `1` |
|
||||||
|
| `livenessProbe.enabled` | Enable livenessProbe | `true` |
|
||||||
|
| `livenessProbe.initialDelaySeconds` | Initial delay seconds for livenessProbe | `30` |
|
||||||
|
| `livenessProbe.periodSeconds` | Period seconds for livenessProbe | `10` |
|
||||||
|
| `livenessProbe.timeoutSeconds` | Timeout seconds for livenessProbe | `5` |
|
||||||
|
| `livenessProbe.failureThreshold` | Failure threshold for livenessProbe | `6` |
|
||||||
|
| `livenessProbe.successThreshold` | Success threshold for livenessProbe | `1` |
|
||||||
|
| `readinessProbe.enabled` | Enable readinessProbe | `true` |
|
||||||
|
| `readinessProbe.initialDelaySeconds` | Initial delay seconds for readinessProbe | `5` |
|
||||||
|
| `readinessProbe.periodSeconds` | Period seconds for readinessProbe | `5` |
|
||||||
|
| `readinessProbe.timeoutSeconds` | Timeout seconds for readinessProbe | `3` |
|
||||||
|
| `readinessProbe.failureThreshold` | Failure threshold for readinessProbe | `3` |
|
||||||
|
| `readinessProbe.successThreshold` | Success threshold for readinessProbe | `1` |
|
||||||
|
| `customStartupProbe` | Custom liveness probe for the Web component | `{}` |
|
||||||
|
| `customLivenessProbe` | Override default liveness probe | `{}` |
|
||||||
|
| `customReadinessProbe` | Override default readiness probe | `{}` |
|
||||||
|
| `autoscaling.enabled` | Enable autoscaling for NGINX deployment | `false` |
|
||||||
|
| `autoscaling.minReplicas` | Minimum number of replicas to scale back | `""` |
|
||||||
|
| `autoscaling.maxReplicas` | Maximum number of replicas to scale out | `""` |
|
||||||
|
| `autoscaling.targetCPU` | Target CPU utilization percentage | `""` |
|
||||||
|
| `autoscaling.targetMemory` | Target Memory utilization percentage | `""` |
|
||||||
|
| `extraVolumes` | Array to add extra volumes | `[]` |
|
||||||
|
| `extraVolumeMounts` | Array to add extra mount | `[]` |
|
||||||
|
| `serviceAccount.create` | Enable creation of ServiceAccount for nginx pod | `false` |
|
||||||
|
| `serviceAccount.name` | The name of the ServiceAccount to use. | `""` |
|
||||||
|
| `serviceAccount.annotations` | Annotations for service account. Evaluated as a template. | `{}` |
|
||||||
|
| `serviceAccount.automountServiceAccountToken` | Auto-mount the service account token in the pod | `false` |
|
||||||
|
| `sidecars` | Sidecar parameters | `[]` |
|
||||||
|
| `sidecarSingleProcessNamespace` | Enable sharing the process namespace with sidecars | `false` |
|
||||||
|
| `initContainers` | Extra init containers | `[]` |
|
||||||
|
| `pdb.create` | Created a PodDisruptionBudget | `false` |
|
||||||
|
| `pdb.minAvailable` | Min number of pods that must still be available after the eviction | `1` |
|
||||||
|
| `pdb.maxUnavailable` | Max number of pods that can be unavailable after the eviction | `0` |
|
||||||
|
|
||||||
|
### Custom NGINX application parameters
|
||||||
|
|
||||||
|
| Name | Description | Value |
|
||||||
|
| ------------------------------------------ | --------------------------------------------------------------------------------------------------- | --------------------- |
|
||||||
|
| `cloneStaticSiteFromGit.enabled` | Get the server static content from a Git repository | `false` |
|
||||||
|
| `cloneStaticSiteFromGit.image.registry` | Git image registry | `docker.io` |
|
||||||
|
| `cloneStaticSiteFromGit.image.repository` | Git image repository | `bitnami/git` |
|
||||||
|
| `cloneStaticSiteFromGit.image.tag` | Git image tag (immutable tags are recommended) | `2.40.0-debian-11-r5` |
|
||||||
|
| `cloneStaticSiteFromGit.image.digest` | Git image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag | `""` |
|
||||||
|
| `cloneStaticSiteFromGit.image.pullPolicy` | Git image pull policy | `IfNotPresent` |
|
||||||
|
| `cloneStaticSiteFromGit.image.pullSecrets` | Specify docker-registry secret names as an array | `[]` |
|
||||||
|
| `cloneStaticSiteFromGit.repository` | Git Repository to clone static content from | `""` |
|
||||||
|
| `cloneStaticSiteFromGit.branch` | Git branch to checkout | `""` |
|
||||||
|
| `cloneStaticSiteFromGit.interval` | Interval for sidecar container pull from the Git repository | `60` |
|
||||||
|
| `cloneStaticSiteFromGit.gitClone.command` | Override default container command for git-clone-repository | `[]` |
|
||||||
|
| `cloneStaticSiteFromGit.gitClone.args` | Override default container args for git-clone-repository | `[]` |
|
||||||
|
| `cloneStaticSiteFromGit.gitSync.command` | Override default container command for git-repo-syncer | `[]` |
|
||||||
|
| `cloneStaticSiteFromGit.gitSync.args` | Override default container args for git-repo-syncer | `[]` |
|
||||||
|
| `cloneStaticSiteFromGit.extraEnvVars` | Additional environment variables to set for the in the containers that clone static site from git | `[]` |
|
||||||
|
| `cloneStaticSiteFromGit.extraVolumeMounts` | Add extra volume mounts for the Git containers | `[]` |
|
||||||
|
| `serverBlock` | Custom server block to be added to NGINX configuration | `""` |
|
||||||
|
| `existingServerBlockConfigmap` | ConfigMap with custom server block to be added to NGINX configuration | `""` |
|
||||||
|
| `staticSiteConfigmap` | Name of existing ConfigMap with the server static site content | `""` |
|
||||||
|
| `staticSitePVC` | Name of existing PVC with the server static site content | `""` |
|
||||||
|
|
||||||
|
### Traffic Exposure parameters
|
||||||
|
|
||||||
|
| Name | Description | Value |
|
||||||
|
| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------------------ |
|
||||||
|
| `service.type` | Service type | `LoadBalancer` |
|
||||||
|
| `service.ports.http` | Service HTTP port | `80` |
|
||||||
|
| `service.ports.https` | Service HTTPS port | `443` |
|
||||||
|
| `service.nodePorts` | Specify the nodePort(s) value(s) for the LoadBalancer and NodePort service types. | `{}` |
|
||||||
|
| `service.targetPort` | Target port reference value for the Loadbalancer service types can be specified explicitly. | `{}` |
|
||||||
|
| `service.clusterIP` | NGINX service Cluster IP | `""` |
|
||||||
|
| `service.loadBalancerIP` | LoadBalancer service IP address | `""` |
|
||||||
|
| `service.loadBalancerSourceRanges` | NGINX service Load Balancer sources | `[]` |
|
||||||
|
| `service.extraPorts` | Extra ports to expose (normally used with the `sidecar` value) | `[]` |
|
||||||
|
| `service.sessionAffinity` | Session Affinity for Kubernetes service, can be "None" or "ClientIP" | `None` |
|
||||||
|
| `service.sessionAffinityConfig` | Additional settings for the sessionAffinity | `{}` |
|
||||||
|
| `service.annotations` | Service annotations | `{}` |
|
||||||
|
| `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` |
|
||||||
|
| `ingress.enabled` | Set to true to enable ingress record generation | `false` |
|
||||||
|
| `ingress.selfSigned` | Create a TLS secret for this ingress record using self-signed certificates generated by Helm | `false` |
|
||||||
|
| `ingress.pathType` | Ingress path type | `ImplementationSpecific` |
|
||||||
|
| `ingress.apiVersion` | Force Ingress API version (automatically detected if not set) | `""` |
|
||||||
|
| `ingress.hostname` | Default host for the ingress resource | `nginx.local` |
|
||||||
|
| `ingress.path` | The Path to Nginx. You may need to set this to '/*' in order to use this with ALB ingress controllers. | `/` |
|
||||||
|
| `ingress.annotations` | Additional annotations for the Ingress resource. To enable certificate autogeneration, place here your cert-manager annotations. | `{}` |
|
||||||
|
| `ingress.ingressClassName` | Set the ingerssClassName on the ingress record for k8s 1.18+ | `""` |
|
||||||
|
| `ingress.tls` | Create TLS Secret | `false` |
|
||||||
|
| `ingress.extraHosts` | The list of additional hostnames to be covered with this ingress record. | `[]` |
|
||||||
|
| `ingress.extraPaths` | Any additional arbitrary paths that may need to be added to the ingress under the main host. | `[]` |
|
||||||
|
| `ingress.extraTls` | The tls configuration for additional hostnames to be covered with this ingress record. | `[]` |
|
||||||
|
| `ingress.secrets` | If you're providing your own certificates, please use this to add the certificates as secrets | `[]` |
|
||||||
|
| `ingress.extraRules` | The list of additional rules to be added to this ingress record. Evaluated as a template | `[]` |
|
||||||
|
| `healthIngress.enabled` | Set to true to enable health ingress record generation | `false` |
|
||||||
|
| `healthIngress.selfSigned` | Create a TLS secret for this ingress record using self-signed certificates generated by Helm | `false` |
|
||||||
|
| `healthIngress.pathType` | Ingress path type | `ImplementationSpecific` |
|
||||||
|
| `healthIngress.hostname` | When the health ingress is enabled, a host pointing to this will be created | `example.local` |
|
||||||
|
| `healthIngress.path` | Default path for the ingress record | `/` |
|
||||||
|
| `healthIngress.annotations` | Additional annotations for the Ingress resource. To enable certificate autogeneration, place here your cert-manager annotations. | `{}` |
|
||||||
|
| `healthIngress.tls` | Enable TLS configuration for the hostname defined at `healthIngress.hostname` parameter | `false` |
|
||||||
|
| `healthIngress.extraHosts` | An array with additional hostname(s) to be covered with the ingress record | `[]` |
|
||||||
|
| `healthIngress.extraPaths` | An array with additional arbitrary paths that may need to be added to the ingress under the main host | `[]` |
|
||||||
|
| `healthIngress.extraTls` | TLS configuration for additional hostnames to be covered | `[]` |
|
||||||
|
| `healthIngress.secrets` | TLS Secret configuration | `[]` |
|
||||||
|
| `healthIngress.ingressClassName` | IngressClass that will be be used to implement the Ingress (Kubernetes 1.18+) | `""` |
|
||||||
|
| `healthIngress.extraRules` | The list of additional rules to be added to this ingress record. Evaluated as a template | `[]` |
|
||||||
|
|
||||||
|
### Metrics parameters
|
||||||
|
|
||||||
|
| Name | Description | Value |
|
||||||
|
| ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ |
|
||||||
|
| `metrics.enabled` | Start a Prometheus exporter sidecar container | `false` |
|
||||||
|
| `metrics.port` | NGINX Container Status Port scraped by Prometheus Exporter | `""` |
|
||||||
|
| `metrics.image.registry` | NGINX Prometheus exporter image registry | `docker.io` |
|
||||||
|
| `metrics.image.repository` | NGINX Prometheus exporter image repository | `bitnami/nginx-exporter` |
|
||||||
|
| `metrics.image.tag` | NGINX Prometheus exporter image tag (immutable tags are recommended) | `0.11.0-debian-11-r66` |
|
||||||
|
| `metrics.image.digest` | NGINX Prometheus exporter image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag | `""` |
|
||||||
|
| `metrics.image.pullPolicy` | NGINX Prometheus exporter image pull policy | `IfNotPresent` |
|
||||||
|
| `metrics.image.pullSecrets` | Specify docker-registry secret names as an array | `[]` |
|
||||||
|
| `metrics.podAnnotations` | Additional annotations for NGINX Prometheus exporter pod(s) | `{}` |
|
||||||
|
| `metrics.securityContext.enabled` | Enabled NGINX Exporter containers' Security Context | `false` |
|
||||||
|
| `metrics.securityContext.runAsUser` | Set NGINX Exporter container's Security Context runAsUser | `1001` |
|
||||||
|
| `metrics.service.port` | NGINX Prometheus exporter service port | `9113` |
|
||||||
|
| `metrics.service.annotations` | Annotations for the Prometheus exporter service | `{}` |
|
||||||
|
| `metrics.resources.limits` | The resources limits for the NGINX Prometheus exporter container | `{}` |
|
||||||
|
| `metrics.resources.requests` | The requested resources for the NGINX Prometheus exporter container | `{}` |
|
||||||
|
| `metrics.serviceMonitor.enabled` | Creates a Prometheus Operator ServiceMonitor (also requires `metrics.enabled` to be `true`) | `false` |
|
||||||
|
| `metrics.serviceMonitor.namespace` | Namespace in which Prometheus is running | `""` |
|
||||||
|
| `metrics.serviceMonitor.jobLabel` | The name of the label on the target service to use as the job name in prometheus. | `""` |
|
||||||
|
| `metrics.serviceMonitor.interval` | Interval at which metrics should be scraped. | `""` |
|
||||||
|
| `metrics.serviceMonitor.scrapeTimeout` | Timeout after which the scrape is ended | `""` |
|
||||||
|
| `metrics.serviceMonitor.selector` | Prometheus instance selector labels | `{}` |
|
||||||
|
| `metrics.serviceMonitor.labels` | Additional labels that can be used so PodMonitor will be discovered by Prometheus | `{}` |
|
||||||
|
| `metrics.serviceMonitor.relabelings` | RelabelConfigs to apply to samples before scraping | `[]` |
|
||||||
|
| `metrics.serviceMonitor.metricRelabelings` | MetricRelabelConfigs to apply to samples before ingestion | `[]` |
|
||||||
|
| `metrics.serviceMonitor.honorLabels` | honorLabels chooses the metric's labels on collisions with target labels | `false` |
|
||||||
|
| `metrics.prometheusRule.enabled` | if `true`, creates a Prometheus Operator PrometheusRule (also requires `metrics.enabled` to be `true` and `metrics.prometheusRule.rules`) | `false` |
|
||||||
|
| `metrics.prometheusRule.namespace` | Namespace for the PrometheusRule Resource (defaults to the Release Namespace) | `""` |
|
||||||
|
| `metrics.prometheusRule.additionalLabels` | Additional labels that can be used so PrometheusRule will be discovered by Prometheus | `{}` |
|
||||||
|
| `metrics.prometheusRule.rules` | Prometheus Rule definitions | `[]` |
|
||||||
|
|
||||||
|
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||||
|
|
||||||
|
```console
|
||||||
|
helm install my-release \
|
||||||
|
--set imagePullPolicy=Always \
|
||||||
|
my-repo/nginx
|
||||||
|
```
|
||||||
|
|
||||||
|
The above command sets the `imagePullPolicy` to `Always`.
|
||||||
|
|
||||||
|
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
|
||||||
|
|
||||||
|
```console
|
||||||
|
helm install my-release -f values.yaml my-repo/nginx
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Tip**: You can use the default [values.yaml](values.yaml)
|
||||||
|
|
||||||
|
## Configuration and installation details
|
||||||
|
|
||||||
|
### [Rolling VS Immutable tags](https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/)
|
||||||
|
|
||||||
|
It is strongly recommended to use immutable tags in a production environment. This ensures your deployment does not change automatically if the same tag is updated with a different image.
|
||||||
|
|
||||||
|
Bitnami will release a new chart updating its containers if a new version of the main container, significant changes, or critical vulnerabilities exist.
|
||||||
|
|
||||||
|
### Use a different NGINX version
|
||||||
|
|
||||||
|
To modify the application version used in this chart, specify a different version of the image using the `image.tag` parameter and/or a different repository using the `image.repository` parameter. Refer to the [chart documentation for more information on these parameters and how to use them with images from a private registry](https://docs.bitnami.com/kubernetes/infrastructure/nginx/configuration/change-image-version/).
|
||||||
|
|
||||||
|
### Deploying your custom web application
|
||||||
|
|
||||||
|
The NGINX chart allows you to deploy a custom web application using one of the following methods:
|
||||||
|
|
||||||
|
- Cloning from a git repository: Set `cloneStaticSiteFromGit.enabled` to `true` and set the repository and branch using the `cloneStaticSiteFromGit.repository` and `cloneStaticSiteFromGit.branch` parameters. A sidecar will also pull the latest changes in an interval set by `cloneStaticSitesFromGit.interval`.
|
||||||
|
- Providing a ConfigMap: Set the `staticSiteConfigmap` value to mount a ConfigMap in the NGINX html folder.
|
||||||
|
- Using an existing PVC: Set the `staticSitePVC` value to mount an PersistentVolumeClaim with the static site content.
|
||||||
|
|
||||||
|
You can deploy a example web application using git deploying the chart with the following parameters:
|
||||||
|
|
||||||
|
```console
|
||||||
|
cloneStaticSiteFromGit.enabled=true
|
||||||
|
cloneStaticSiteFromGit.repository=https://github.com/mdn/beginner-html-site-styled.git
|
||||||
|
cloneStaticSiteFromGit.branch=master
|
||||||
|
```
|
||||||
|
|
||||||
|
### Providing a custom server block
|
||||||
|
|
||||||
|
This helm chart supports using custom custom server block for NGINX to use.
|
||||||
|
|
||||||
|
You can use the `serverBlock` value to provide a custom server block for NGINX to use. To do this, create a values files with your server block and install the chart using it:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
serverBlock: |-
|
||||||
|
server {
|
||||||
|
listen 0.0.0.0:8080;
|
||||||
|
location / {
|
||||||
|
return 200 "hello!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
> Warning: The above example is not compatible with enabling Prometheus metrics since it affects the `/status` endpoint.
|
||||||
|
|
||||||
|
In addition, you can also set an external ConfigMap with the configuration file. This is done by setting the `existingServerBlockConfigmap` parameter. Note that this will override the previous option.
|
||||||
|
|
||||||
|
### Adding extra environment variables
|
||||||
|
|
||||||
|
In case you want to add extra environment variables (useful for advanced operations like custom init scripts), you can use the `extraEnvVars` property.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
extraEnvVars:
|
||||||
|
- name: LOG_LEVEL
|
||||||
|
value: error
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, you can use a ConfigMap or a Secret with the environment variables. To do so, use the `extraEnvVarsCM` or the `extraEnvVarsSecret` values.
|
||||||
|
|
||||||
|
### Setting Pod's affinity
|
||||||
|
|
||||||
|
This chart allows you to set your custom affinity using the `affinity` parameter. Find more information about Pod's affinity in the [kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity).
|
||||||
|
|
||||||
|
As an alternative, you can use of the preset configurations for pod affinity, pod anti-affinity, and node affinity available at the [bitnami/common](https://github.com/bitnami/charts/tree/main/bitnami/common#affinity) chart. To do so, set the `podAffinityPreset`, `podAntiAffinityPreset`, or `nodeAffinityPreset` parameters.
|
||||||
|
|
||||||
|
### Deploying extra resources
|
||||||
|
|
||||||
|
There are cases where you may want to deploy extra objects, such a ConfigMap containing your app's configuration or some extra deployment with a micro service used by your app. For covering this case, the chart allows adding the full specification of other objects using the `extraDeploy` parameter.
|
||||||
|
|
||||||
|
### Ingress
|
||||||
|
|
||||||
|
This chart provides support for ingress resources. If you have an ingress controller installed on your cluster, such as [nginx-ingress-controller](https://github.com/bitnami/charts/tree/main/bitnami/nginx-ingress-controller) or [contour](https://github.com/bitnami/charts/tree/main/bitnami/contour) you can utilize the ingress controller to serve your application.
|
||||||
|
|
||||||
|
To enable ingress integration, please set `ingress.enabled` to `true`.
|
||||||
|
|
||||||
|
#### Hosts
|
||||||
|
|
||||||
|
Most likely you will only want to have one hostname that maps to this NGINX installation. If that's your case, the property `ingress.hostname` will set it. However, it is possible to have more than one host. To facilitate this, the `ingress.extraHosts` object can be specified as an array. You can also use `ingress.extraTLS` to add the TLS configuration for extra hosts.
|
||||||
|
|
||||||
|
For each host indicated at `ingress.extraHosts`, please indicate a `name`, `path`, and any `annotations` that you may want the ingress controller to know about.
|
||||||
|
|
||||||
|
For annotations, please see [this document](https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md). Not all annotations are supported by all ingress controllers, but this document does a good job of indicating which annotation is supported by many popular ingress controllers.
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
Find more information about how to deal with common errors related to Bitnami's Helm charts in [this troubleshooting guide](https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues).
|
||||||
|
|
||||||
|
## Upgrading
|
||||||
|
|
||||||
|
### To 11.0.0
|
||||||
|
|
||||||
|
This major release renames several values in this chart and adds missing features, in order to be aligned with the rest of the assets in the Bitnami charts repository.
|
||||||
|
|
||||||
|
Affected values:
|
||||||
|
|
||||||
|
- `service.port` was renamed as `service.ports.http`.
|
||||||
|
- `service.httpsPort` was deprecated. We recommend using `service.ports.https`.
|
||||||
|
- `serviceAccount.autoMount` was renamed as `serviceAccount.automountServiceAccountToken`
|
||||||
|
- `metrics.serviceMonitor.additionalLabels` was renamed as `metrics.serviceMonitor.labels`
|
||||||
|
|
||||||
|
### To 10.0.0
|
||||||
|
|
||||||
|
This major release no longer uses the bitnami/nginx-ldap-auth-daemon container as a dependency since its upstream project is not actively maintained.
|
||||||
|
|
||||||
|
*2022-04-12 edit*:
|
||||||
|
|
||||||
|
[Bitnami's reference implementation](https://www.nginx.com/blog/nginx-plus-authenticate-users/).
|
||||||
|
|
||||||
|
On 9 April 2022, security vulnerabilities in the [NGINX LDAP reference implementation](https://github.com/nginxinc/nginx-ldap-auth) were publicly shared. **Although the deprecation of this container from the Bitnami catalog was not related to this security issue, [here](https://docs.bitnami.com/general/security/) you can find more information from the Bitnami security team.**
|
||||||
|
|
||||||
|
### To 8.0.0
|
||||||
|
|
||||||
|
[On November 13, 2020, Helm v2 support was formally finished](https://github.com/helm/charts#status-of-the-project), this major version is the result of the required changes applied to the Helm Chart to be able to incorporate the different features added in Helm v3 and to be consistent with the Helm project itself regarding the Helm v2 EOL.
|
||||||
|
|
||||||
|
#### What changes were introduced in this major version?
|
||||||
|
|
||||||
|
- Previous versions of this Helm Chart use `apiVersion: v1` (installable by both Helm 2 and 3), this Helm Chart was updated to `apiVersion: v2` (installable by Helm 3 only). [Here](https://helm.sh/docs/topics/charts/#the-apiversion-field) you can find more information about the `apiVersion` field.
|
||||||
|
- Move dependency information from the *requirements.yaml* to the *Chart.yaml*
|
||||||
|
- After running `helm dependency update`, a *Chart.lock* file is generated containing the same structure used in the previous *requirements.lock*
|
||||||
|
- The different fields present in the *Chart.yaml* file has been ordered alphabetically in a homogeneous way for all the Bitnami Helm Charts
|
||||||
|
|
||||||
|
#### Considerations when upgrading to this version
|
||||||
|
|
||||||
|
- If you want to upgrade to this version from a previous one installed with Helm v3, you shouldn't face any issues
|
||||||
|
- If you want to upgrade to this version using Helm v2, this scenario is not supported as this version doesn't support Helm v2 anymore
|
||||||
|
- If you installed the previous version with Helm v2 and wants to upgrade to this version with Helm v3, please refer to the [official Helm documentation](https://helm.sh/docs/topics/v2_v3_migration/#migration-use-cases) about migrating from Helm v2 to v3
|
||||||
|
|
||||||
|
#### Useful links
|
||||||
|
|
||||||
|
- <https://docs.bitnami.com/tutorials/resolve-helm2-helm3-post-migration-issues/>
|
||||||
|
- <https://helm.sh/docs/topics/v2_v3_migration/>
|
||||||
|
- <https://helm.sh/blog/migrate-from-helm-v2-to-helm-v3/>
|
||||||
|
|
||||||
|
### To 7.0.0
|
||||||
|
|
||||||
|
- This version also introduces `bitnami/common`, a [library chart](https://helm.sh/docs/topics/library_charts/#helm) as a dependency. More documentation about this new utility could be found [here](https://github.com/bitnami/charts/tree/main/bitnami/common#bitnami-common-library-chart). Please, make sure that you have updated the chart dependencies before executing any upgrade.
|
||||||
|
- Ingress configuration was also adapted to follow the Helm charts best practices.
|
||||||
|
|
||||||
|
> Note: There is no backwards compatibility due to the above mentioned changes. It's necessary to install a new release of the chart, and migrate your existing application to the new NGINX instances.
|
||||||
|
|
||||||
|
### To 5.6.0
|
||||||
|
|
||||||
|
Added support for the use of LDAP.
|
||||||
|
|
||||||
|
### To 5.0.0
|
||||||
|
|
||||||
|
Backwards compatibility is not guaranteed unless you modify the labels used on the chart's deployments.
|
||||||
|
Use the workaround below to upgrade from versions previous to 5.0.0. The following example assumes that the release name is nginx:
|
||||||
|
|
||||||
|
```console
|
||||||
|
kubectl delete deployment nginx --cascade=false
|
||||||
|
helm upgrade nginx my-repo/nginx
|
||||||
|
```
|
||||||
|
|
||||||
|
### To 1.0.0
|
||||||
|
|
||||||
|
Backwards compatibility is not guaranteed unless you modify the labels used on the chart's deployments.
|
||||||
|
Use the workaround below to upgrade from versions previous to 1.0.0. The following example assumes that the release name is nginx:
|
||||||
|
|
||||||
|
```console
|
||||||
|
kubectl patch deployment nginx --type=json -p='[{"op": "remove", "path": "/spec/selector/matchLabels/chart"}]'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Bitnami Kubernetes Documentation
|
||||||
|
|
||||||
|
Bitnami Kubernetes documentation is available at [https://docs.bitnami.com/](https://docs.bitnami.com/). You can find there the following resources:
|
||||||
|
|
||||||
|
- [Documentation for NGINX Helm chart](https://docs.bitnami.com/kubernetes/infrastructure/nginx/)
|
||||||
|
- [Get Started with Kubernetes guides](https://docs.bitnami.com/kubernetes/)
|
||||||
|
- [Bitnami Helm charts documentation](https://docs.bitnami.com/kubernetes/apps/)
|
||||||
|
- [Kubernetes FAQs](https://docs.bitnami.com/kubernetes/faq/)
|
||||||
|
- [Kubernetes Developer guides](https://docs.bitnami.com/tutorials/)
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Copyright © 2023 Bitnami
|
||||||
|
|
||||||
|
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.
|
@ -0,0 +1,22 @@
|
|||||||
|
# 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
|
||||||
|
*~
|
||||||
|
# Various IDEs
|
||||||
|
.project
|
||||||
|
.idea/
|
||||||
|
*.tmproj
|
||||||
|
.vscode/
|
@ -0,0 +1,24 @@
|
|||||||
|
annotations:
|
||||||
|
category: Infrastructure
|
||||||
|
licenses: Apache-2.0
|
||||||
|
apiVersion: v2
|
||||||
|
appVersion: 2.2.4
|
||||||
|
description: A Library Helm Chart for grouping common logic between bitnami charts.
|
||||||
|
This chart is not deployable by itself.
|
||||||
|
home: https://github.com/bitnami/charts/tree/main/bitnami/common
|
||||||
|
icon: https://bitnami.com/downloads/logos/bitnami-mark.png
|
||||||
|
keywords:
|
||||||
|
- common
|
||||||
|
- helper
|
||||||
|
- template
|
||||||
|
- function
|
||||||
|
- bitnami
|
||||||
|
maintainers:
|
||||||
|
- name: Bitnami
|
||||||
|
url: https://github.com/bitnami/charts
|
||||||
|
name: common
|
||||||
|
sources:
|
||||||
|
- https://github.com/bitnami/charts
|
||||||
|
- https://www.bitnami.com/
|
||||||
|
type: library
|
||||||
|
version: 2.2.4
|
233
internal/accept_test/test_data/nginx/charts/common/README.md
Normal file
233
internal/accept_test/test_data/nginx/charts/common/README.md
Normal file
@ -0,0 +1,233 @@
|
|||||||
|
# Bitnami Common Library Chart
|
||||||
|
|
||||||
|
A [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm) for grouping common logic between bitnami charts.
|
||||||
|
|
||||||
|
## TL;DR
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
dependencies:
|
||||||
|
- name: common
|
||||||
|
version: 1.x.x
|
||||||
|
repository: https://charts.bitnami.com/bitnami
|
||||||
|
```
|
||||||
|
|
||||||
|
```console
|
||||||
|
helm dependency update
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ include "common.names.fullname" . }}
|
||||||
|
data:
|
||||||
|
myvalue: "Hello World"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
This chart provides a common template helpers which can be used to develop new charts using [Helm](https://helm.sh) package manager.
|
||||||
|
|
||||||
|
Bitnami charts can be used with [Kubeapps](https://kubeapps.dev/) for deployment and management of Helm Charts in clusters.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- Kubernetes 1.19+
|
||||||
|
- Helm 3.2.0+
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
## Special input schemas
|
||||||
|
|
||||||
|
### ImageRoot
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
registry:
|
||||||
|
type: string
|
||||||
|
description: Docker registry where the image is located
|
||||||
|
example: docker.io
|
||||||
|
|
||||||
|
repository:
|
||||||
|
type: string
|
||||||
|
description: Repository and image name
|
||||||
|
example: bitnami/nginx
|
||||||
|
|
||||||
|
tag:
|
||||||
|
type: string
|
||||||
|
description: image tag
|
||||||
|
example: 1.16.1-debian-10-r63
|
||||||
|
|
||||||
|
pullPolicy:
|
||||||
|
type: string
|
||||||
|
description: Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
||||||
|
|
||||||
|
pullSecrets:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
description: Optionally specify an array of imagePullSecrets (evaluated as templates).
|
||||||
|
|
||||||
|
debug:
|
||||||
|
type: boolean
|
||||||
|
description: Set to true if you would like to see extra information on logs
|
||||||
|
example: false
|
||||||
|
|
||||||
|
## An instance would be:
|
||||||
|
# registry: docker.io
|
||||||
|
# repository: bitnami/nginx
|
||||||
|
# tag: 1.16.1-debian-10-r63
|
||||||
|
# pullPolicy: IfNotPresent
|
||||||
|
# debug: false
|
||||||
|
```
|
||||||
|
|
||||||
|
### Persistence
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
enabled:
|
||||||
|
type: boolean
|
||||||
|
description: Whether enable persistence.
|
||||||
|
example: true
|
||||||
|
|
||||||
|
storageClass:
|
||||||
|
type: string
|
||||||
|
description: Ghost data Persistent Volume Storage Class, If set to "-", storageClassName: "" which disables dynamic provisioning.
|
||||||
|
example: "-"
|
||||||
|
|
||||||
|
accessMode:
|
||||||
|
type: string
|
||||||
|
description: Access mode for the Persistent Volume Storage.
|
||||||
|
example: ReadWriteOnce
|
||||||
|
|
||||||
|
size:
|
||||||
|
type: string
|
||||||
|
description: Size the Persistent Volume Storage.
|
||||||
|
example: 8Gi
|
||||||
|
|
||||||
|
path:
|
||||||
|
type: string
|
||||||
|
description: Path to be persisted.
|
||||||
|
example: /bitnami
|
||||||
|
|
||||||
|
## An instance would be:
|
||||||
|
# enabled: true
|
||||||
|
# storageClass: "-"
|
||||||
|
# accessMode: ReadWriteOnce
|
||||||
|
# size: 8Gi
|
||||||
|
# path: /bitnami
|
||||||
|
```
|
||||||
|
|
||||||
|
### ExistingSecret
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
description: Name of the existing secret.
|
||||||
|
example: mySecret
|
||||||
|
keyMapping:
|
||||||
|
description: Mapping between the expected key name and the name of the key in the existing secret.
|
||||||
|
type: object
|
||||||
|
|
||||||
|
## An instance would be:
|
||||||
|
# name: mySecret
|
||||||
|
# keyMapping:
|
||||||
|
# password: myPasswordKey
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Example of use
|
||||||
|
|
||||||
|
When we store sensitive data for a deployment in a secret, some times we want to give to users the possibility of using theirs existing secrets.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# templates/secret.yaml
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ include "common.names.fullname" . }}
|
||||||
|
labels:
|
||||||
|
app: {{ include "common.names.fullname" . }}
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
password: {{ .Values.password | b64enc | quote }}
|
||||||
|
|
||||||
|
# templates/dpl.yaml
|
||||||
|
---
|
||||||
|
...
|
||||||
|
env:
|
||||||
|
- name: PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "common.secrets.name" (dict "existingSecret" .Values.existingSecret "context" $) }}
|
||||||
|
key: {{ include "common.secrets.key" (dict "existingSecret" .Values.existingSecret "key" "password") }}
|
||||||
|
...
|
||||||
|
|
||||||
|
# values.yaml
|
||||||
|
---
|
||||||
|
name: mySecret
|
||||||
|
keyMapping:
|
||||||
|
password: myPasswordKey
|
||||||
|
```
|
||||||
|
|
||||||
|
### ValidateValue
|
||||||
|
|
||||||
|
#### NOTES.txt
|
||||||
|
|
||||||
|
```console
|
||||||
|
{{- $validateValueConf00 := (dict "valueKey" "path.to.value00" "secret" "secretName" "field" "password-00") -}}
|
||||||
|
{{- $validateValueConf01 := (dict "valueKey" "path.to.value01" "secret" "secretName" "field" "password-01") -}}
|
||||||
|
|
||||||
|
{{ include "common.validations.values.multiple.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }}
|
||||||
|
```
|
||||||
|
|
||||||
|
If we force those values to be empty we will see some alerts
|
||||||
|
|
||||||
|
```console
|
||||||
|
helm install test mychart --set path.to.value00="",path.to.value01=""
|
||||||
|
'path.to.value00' must not be empty, please add '--set path.to.value00=$PASSWORD_00' to the command. To get the current value:
|
||||||
|
|
||||||
|
export PASSWORD_00=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-00}" | base64 -d)
|
||||||
|
|
||||||
|
'path.to.value01' must not be empty, please add '--set path.to.value01=$PASSWORD_01' to the command. To get the current value:
|
||||||
|
|
||||||
|
export PASSWORD_01=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-01}" | base64 -d)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Upgrading
|
||||||
|
|
||||||
|
### To 1.0.0
|
||||||
|
|
||||||
|
[On November 13, 2020, Helm v2 support was formally finished](https://github.com/helm/charts#status-of-the-project), this major version is the result of the required changes applied to the Helm Chart to be able to incorporate the different features added in Helm v3 and to be consistent with the Helm project itself regarding the Helm v2 EOL.
|
||||||
|
|
||||||
|
#### What changes were introduced in this major version?
|
||||||
|
|
||||||
|
- Previous versions of this Helm Chart use `apiVersion: v1` (installable by both Helm 2 and 3), this Helm Chart was updated to `apiVersion: v2` (installable by Helm 3 only). [Here](https://helm.sh/docs/topics/charts/#the-apiversion-field) you can find more information about the `apiVersion` field.
|
||||||
|
- Use `type: library`. [Here](https://v3.helm.sh/docs/faq/#library-chart-support) you can find more information.
|
||||||
|
- The different fields present in the *Chart.yaml* file has been ordered alphabetically in a homogeneous way for all the Bitnami Helm Charts
|
||||||
|
|
||||||
|
#### Considerations when upgrading to this version
|
||||||
|
|
||||||
|
- If you want to upgrade to this version from a previous one installed with Helm v3, you shouldn't face any issues
|
||||||
|
- If you want to upgrade to this version using Helm v2, this scenario is not supported as this version doesn't support Helm v2 anymore
|
||||||
|
- If you installed the previous version with Helm v2 and wants to upgrade to this version with Helm v3, please refer to the [official Helm documentation](https://helm.sh/docs/topics/v2_v3_migration/#migration-use-cases) about migrating from Helm v2 to v3
|
||||||
|
|
||||||
|
#### Useful links
|
||||||
|
|
||||||
|
- <https://docs.bitnami.com/tutorials/resolve-helm2-helm3-post-migration-issues/>
|
||||||
|
- <https://helm.sh/docs/topics/v2_v3_migration/>
|
||||||
|
- <https://helm.sh/blog/migrate-from-helm-v2-to-helm-v3/>
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Copyright © 2023 Bitnami
|
||||||
|
|
||||||
|
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.
|
@ -0,0 +1,106 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a soft nodeAffinity definition
|
||||||
|
{{ include "common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.affinities.nodes.soft" -}}
|
||||||
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- preference:
|
||||||
|
matchExpressions:
|
||||||
|
- key: {{ .key }}
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
{{- range .values }}
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
weight: 1
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a hard nodeAffinity definition
|
||||||
|
{{ include "common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.affinities.nodes.hard" -}}
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
nodeSelectorTerms:
|
||||||
|
- matchExpressions:
|
||||||
|
- key: {{ .key }}
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
{{- range .values }}
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a nodeAffinity definition
|
||||||
|
{{ include "common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.affinities.nodes" -}}
|
||||||
|
{{- if eq .type "soft" }}
|
||||||
|
{{- include "common.affinities.nodes.soft" . -}}
|
||||||
|
{{- else if eq .type "hard" }}
|
||||||
|
{{- include "common.affinities.nodes.hard" . -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a topologyKey definition
|
||||||
|
{{ include "common.affinities.topologyKey" (dict "topologyKey" "BAR") -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.affinities.topologyKey" -}}
|
||||||
|
{{ .topologyKey | default "kubernetes.io/hostname" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a soft podAffinity/podAntiAffinity definition
|
||||||
|
{{ include "common.affinities.pods.soft" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "topologyKey" "BAR" "context" $) -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.affinities.pods.soft" -}}
|
||||||
|
{{- $component := default "" .component -}}
|
||||||
|
{{- $extraMatchLabels := default (dict) .extraMatchLabels -}}
|
||||||
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- podAffinityTerm:
|
||||||
|
labelSelector:
|
||||||
|
matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 10 }}
|
||||||
|
{{- if not (empty $component) }}
|
||||||
|
{{ printf "app.kubernetes.io/component: %s" $component }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $key, $value := $extraMatchLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
topologyKey: {{ include "common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }}
|
||||||
|
weight: 1
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a hard podAffinity/podAntiAffinity definition
|
||||||
|
{{ include "common.affinities.pods.hard" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "topologyKey" "BAR" "context" $) -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.affinities.pods.hard" -}}
|
||||||
|
{{- $component := default "" .component -}}
|
||||||
|
{{- $extraMatchLabels := default (dict) .extraMatchLabels -}}
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- labelSelector:
|
||||||
|
matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 8 }}
|
||||||
|
{{- if not (empty $component) }}
|
||||||
|
{{ printf "app.kubernetes.io/component: %s" $component }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $key, $value := $extraMatchLabels }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
topologyKey: {{ include "common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a podAffinity/podAntiAffinity definition
|
||||||
|
{{ include "common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.affinities.pods" -}}
|
||||||
|
{{- if eq .type "soft" }}
|
||||||
|
{{- include "common.affinities.pods.soft" . -}}
|
||||||
|
{{- else if eq .type "hard" }}
|
||||||
|
{{- include "common.affinities.pods.hard" . -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,154 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the target Kubernetes version
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.kubeVersion" -}}
|
||||||
|
{{- if .Values.global }}
|
||||||
|
{{- if .Values.global.kubeVersion }}
|
||||||
|
{{- .Values.global.kubeVersion -}}
|
||||||
|
{{- else }}
|
||||||
|
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- else }}
|
||||||
|
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for poddisruptionbudget.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.policy.apiVersion" -}}
|
||||||
|
{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "policy/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "policy/v1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for networkpolicy.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.networkPolicy.apiVersion" -}}
|
||||||
|
{{- if semverCompare "<1.7-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "extensions/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "networking.k8s.io/v1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for cronjob.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.cronjob.apiVersion" -}}
|
||||||
|
{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "batch/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "batch/v1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for deployment.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.deployment.apiVersion" -}}
|
||||||
|
{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "extensions/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "apps/v1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for statefulset.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.statefulset.apiVersion" -}}
|
||||||
|
{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "apps/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "apps/v1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for ingress.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.ingress.apiVersion" -}}
|
||||||
|
{{- if .Values.ingress -}}
|
||||||
|
{{- if .Values.ingress.apiVersion -}}
|
||||||
|
{{- .Values.ingress.apiVersion -}}
|
||||||
|
{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "extensions/v1beta1" -}}
|
||||||
|
{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "networking.k8s.io/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "networking.k8s.io/v1" -}}
|
||||||
|
{{- end }}
|
||||||
|
{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "extensions/v1beta1" -}}
|
||||||
|
{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "networking.k8s.io/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "networking.k8s.io/v1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for RBAC resources.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.rbac.apiVersion" -}}
|
||||||
|
{{- if semverCompare "<1.17-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "rbac.authorization.k8s.io/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "rbac.authorization.k8s.io/v1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for CRDs.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.crd.apiVersion" -}}
|
||||||
|
{{- if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "apiextensions.k8s.io/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "apiextensions.k8s.io/v1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for APIService.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.apiService.apiVersion" -}}
|
||||||
|
{{- if semverCompare "<1.10-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "apiregistration.k8s.io/v1beta1" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "apiregistration.k8s.io/v1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the appropriate apiVersion for Horizontal Pod Autoscaler.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.hpa.apiVersion" -}}
|
||||||
|
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .context) -}}
|
||||||
|
{{- if .beta2 -}}
|
||||||
|
{{- print "autoscaling/v2beta2" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "autoscaling/v2beta1" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "autoscaling/v2" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Returns true if the used Helm version is 3.3+.
|
||||||
|
A way to check the used Helm version was not introduced until version 3.3.0 with .Capabilities.HelmVersion, which contains an additional "{}}" structure.
|
||||||
|
This check is introduced as a regexMatch instead of {{ if .Capabilities.HelmVersion }} because checking for the key HelmVersion in <3.3 results in a "interface not found" error.
|
||||||
|
**To be removed when the catalog's minimun Helm version is 3.3**
|
||||||
|
*/}}
|
||||||
|
{{- define "common.capabilities.supportsHelmVersion" -}}
|
||||||
|
{{- if regexMatch "{(v[0-9])*[^}]*}}$" (.Capabilities | toString ) }}
|
||||||
|
{{- true -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,23 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Through error when upgrading using empty passwords values that must not be empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}}
|
||||||
|
{{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}}
|
||||||
|
{{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }}
|
||||||
|
|
||||||
|
Required password params:
|
||||||
|
- validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error.
|
||||||
|
- context - Context - Required. Parent context.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.errors.upgrade.passwords.empty" -}}
|
||||||
|
{{- $validationErrors := join "" .validationErrors -}}
|
||||||
|
{{- if and $validationErrors .context.Release.IsUpgrade -}}
|
||||||
|
{{- $errorString := "\nPASSWORDS ERROR: You must provide your current passwords when upgrading the release." -}}
|
||||||
|
{{- $errorString = print $errorString "\n Note that even after reinstallation, old credentials may be needed as they may be kept in persistent volume claims." -}}
|
||||||
|
{{- $errorString = print $errorString "\n Further information can be obtained at https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues/#credential-errors-while-upgrading-chart-releases" -}}
|
||||||
|
{{- $errorString = print $errorString "\n%s" -}}
|
||||||
|
{{- printf $errorString $validationErrors | fail -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,80 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Return the proper image name
|
||||||
|
{{ include "common.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" .Values.global ) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.images.image" -}}
|
||||||
|
{{- $registryName := .imageRoot.registry -}}
|
||||||
|
{{- $repositoryName := .imageRoot.repository -}}
|
||||||
|
{{- $separator := ":" -}}
|
||||||
|
{{- $termination := .imageRoot.tag | toString -}}
|
||||||
|
{{- if .global }}
|
||||||
|
{{- if .global.imageRegistry }}
|
||||||
|
{{- $registryName = .global.imageRegistry -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if .imageRoot.digest }}
|
||||||
|
{{- $separator = "@" -}}
|
||||||
|
{{- $termination = .imageRoot.digest | toString -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if $registryName }}
|
||||||
|
{{- printf "%s/%s%s%s" $registryName $repositoryName $separator $termination -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%s%s%s" $repositoryName $separator $termination -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead)
|
||||||
|
{{ include "common.images.pullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.images.pullSecrets" -}}
|
||||||
|
{{- $pullSecrets := list }}
|
||||||
|
|
||||||
|
{{- if .global }}
|
||||||
|
{{- range .global.imagePullSecrets -}}
|
||||||
|
{{- $pullSecrets = append $pullSecrets . -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- range .images -}}
|
||||||
|
{{- range .pullSecrets -}}
|
||||||
|
{{- $pullSecrets = append $pullSecrets . -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if (not (empty $pullSecrets)) }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- range $pullSecrets }}
|
||||||
|
- name: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the proper Docker Image Registry Secret Names evaluating values as templates
|
||||||
|
{{ include "common.images.renderPullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.images.renderPullSecrets" -}}
|
||||||
|
{{- $pullSecrets := list }}
|
||||||
|
{{- $context := .context }}
|
||||||
|
|
||||||
|
{{- if $context.Values.global }}
|
||||||
|
{{- range $context.Values.global.imagePullSecrets -}}
|
||||||
|
{{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- range .images -}}
|
||||||
|
{{- range .pullSecrets -}}
|
||||||
|
{{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if (not (empty $pullSecrets)) }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- range $pullSecrets }}
|
||||||
|
- name: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,68 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Generate backend entry that is compatible with all Kubernetes API versions.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.ingress.backend" (dict "serviceName" "backendName" "servicePort" "backendPort" "context" $) }}
|
||||||
|
|
||||||
|
Params:
|
||||||
|
- serviceName - String. Name of an existing service backend
|
||||||
|
- servicePort - String/Int. Port name (or number) of the service. It will be translated to different yaml depending if it is a string or an integer.
|
||||||
|
- context - Dict - Required. The context for the template evaluation.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.ingress.backend" -}}
|
||||||
|
{{- $apiVersion := (include "common.capabilities.ingress.apiVersion" .context) -}}
|
||||||
|
{{- if or (eq $apiVersion "extensions/v1beta1") (eq $apiVersion "networking.k8s.io/v1beta1") -}}
|
||||||
|
serviceName: {{ .serviceName }}
|
||||||
|
servicePort: {{ .servicePort }}
|
||||||
|
{{- else -}}
|
||||||
|
service:
|
||||||
|
name: {{ .serviceName }}
|
||||||
|
port:
|
||||||
|
{{- if typeIs "string" .servicePort }}
|
||||||
|
name: {{ .servicePort }}
|
||||||
|
{{- else if or (typeIs "int" .servicePort) (typeIs "float64" .servicePort) }}
|
||||||
|
number: {{ .servicePort | int }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Print "true" if the API pathType field is supported
|
||||||
|
Usage:
|
||||||
|
{{ include "common.ingress.supportsPathType" . }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.ingress.supportsPathType" -}}
|
||||||
|
{{- if (semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .)) -}}
|
||||||
|
{{- print "false" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "true" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Returns true if the ingressClassname field is supported
|
||||||
|
Usage:
|
||||||
|
{{ include "common.ingress.supportsIngressClassname" . }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.ingress.supportsIngressClassname" -}}
|
||||||
|
{{- if semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .) -}}
|
||||||
|
{{- print "false" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- print "true" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return true if cert-manager required annotations for TLS signed
|
||||||
|
certificates are set in the Ingress annotations
|
||||||
|
Ref: https://cert-manager.io/docs/usage/ingress/#supported-annotations
|
||||||
|
Usage:
|
||||||
|
{{ include "common.ingress.certManagerRequest" ( dict "annotations" .Values.path.to.the.ingress.annotations ) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.ingress.certManagerRequest" -}}
|
||||||
|
{{ if or (hasKey .annotations "cert-manager.io/cluster-issuer") (hasKey .annotations "cert-manager.io/issuer") (hasKey .annotations "kubernetes.io/tls-acme") }}
|
||||||
|
{{- true -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,18 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Kubernetes standard labels
|
||||||
|
*/}}
|
||||||
|
{{- define "common.labels.standard" -}}
|
||||||
|
app.kubernetes.io/name: {{ include "common.names.name" . }}
|
||||||
|
helm.sh/chart: {{ include "common.names.chart" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector
|
||||||
|
*/}}
|
||||||
|
{{- define "common.labels.matchLabels" -}}
|
||||||
|
app.kubernetes.io/name: {{ include "common.names.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,66 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.names.name" -}}
|
||||||
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create chart name and version as used by the chart label.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.names.chart" -}}
|
||||||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create a default fully qualified app name.
|
||||||
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||||
|
If release name contains chart name it will be used as a full name.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.names.fullname" -}}
|
||||||
|
{{- if .Values.fullnameOverride -}}
|
||||||
|
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||||
|
{{- if contains $name .Release.Name -}}
|
||||||
|
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create a default fully qualified dependency name.
|
||||||
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||||
|
If release name contains chart name it will be used as a full name.
|
||||||
|
Usage:
|
||||||
|
{{ include "common.names.dependency.fullname" (dict "chartName" "dependency-chart-name" "chartValues" .Values.dependency-chart "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.names.dependency.fullname" -}}
|
||||||
|
{{- if .chartValues.fullnameOverride -}}
|
||||||
|
{{- .chartValues.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $name := default .chartName .chartValues.nameOverride -}}
|
||||||
|
{{- if contains $name .context.Release.Name -}}
|
||||||
|
{{- .context.Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%s-%s" .context.Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Allow the release namespace to be overridden for multi-namespace deployments in combined charts.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.names.namespace" -}}
|
||||||
|
{{- default .Release.Namespace .Values.namespaceOverride | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create a fully qualified app name adding the installation's namespace.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.names.fullname.namespace" -}}
|
||||||
|
{{- printf "%s-%s" (include "common.names.fullname" .) (include "common.names.namespace" .) | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,165 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Generate secret name.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.secrets.name" (dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $) }}
|
||||||
|
|
||||||
|
Params:
|
||||||
|
- existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user
|
||||||
|
to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility.
|
||||||
|
+info: https://github.com/bitnami/charts/tree/main/bitnami/common#existingsecret
|
||||||
|
- defaultNameSuffix - String - Optional. It is used only if we have several secrets in the same deployment.
|
||||||
|
- context - Dict - Required. The context for the template evaluation.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.secrets.name" -}}
|
||||||
|
{{- $name := (include "common.names.fullname" .context) -}}
|
||||||
|
|
||||||
|
{{- if .defaultNameSuffix -}}
|
||||||
|
{{- $name = printf "%s-%s" $name .defaultNameSuffix | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- with .existingSecret -}}
|
||||||
|
{{- if not (typeIs "string" .) -}}
|
||||||
|
{{- with .name -}}
|
||||||
|
{{- $name = . -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $name = . -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- printf "%s" $name -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Generate secret key.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.secrets.key" (dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName") }}
|
||||||
|
|
||||||
|
Params:
|
||||||
|
- existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user
|
||||||
|
to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility.
|
||||||
|
+info: https://github.com/bitnami/charts/tree/main/bitnami/common#existingsecret
|
||||||
|
- key - String - Required. Name of the key in the secret.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.secrets.key" -}}
|
||||||
|
{{- $key := .key -}}
|
||||||
|
|
||||||
|
{{- if .existingSecret -}}
|
||||||
|
{{- if not (typeIs "string" .existingSecret) -}}
|
||||||
|
{{- if .existingSecret.keyMapping -}}
|
||||||
|
{{- $key = index .existingSecret.keyMapping $.key -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- printf "%s" $key -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Generate secret password or retrieve one if already created.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.secrets.passwords.manage" (dict "secret" "secret-name" "key" "keyName" "providedValues" (list "path.to.password1" "path.to.password2") "length" 10 "strong" false "chartName" "chartName" "context" $) }}
|
||||||
|
|
||||||
|
Params:
|
||||||
|
- secret - String - Required - Name of the 'Secret' resource where the password is stored.
|
||||||
|
- key - String - Required - Name of the key in the secret.
|
||||||
|
- providedValues - List<String> - Required - The path to the validating value in the values.yaml, e.g: "mysql.password". Will pick first parameter with a defined value.
|
||||||
|
- length - int - Optional - Length of the generated random password.
|
||||||
|
- strong - Boolean - Optional - Whether to add symbols to the generated random password.
|
||||||
|
- chartName - String - Optional - Name of the chart used when said chart is deployed as a subchart.
|
||||||
|
- context - Context - Required - Parent context.
|
||||||
|
|
||||||
|
The order in which this function returns a secret password:
|
||||||
|
1. Already existing 'Secret' resource
|
||||||
|
(If a 'Secret' resource is found under the name provided to the 'secret' parameter to this function and that 'Secret' resource contains a key with the name passed as the 'key' parameter to this function then the value of this existing secret password will be returned)
|
||||||
|
2. Password provided via the values.yaml
|
||||||
|
(If one of the keys passed to the 'providedValues' parameter to this function is a valid path to a key in the values.yaml and has a value, the value of the first key with a value will be returned)
|
||||||
|
3. Randomly generated secret password
|
||||||
|
(A new random secret password with the length specified in the 'length' parameter will be generated and returned)
|
||||||
|
|
||||||
|
*/}}
|
||||||
|
{{- define "common.secrets.passwords.manage" -}}
|
||||||
|
|
||||||
|
{{- $password := "" }}
|
||||||
|
{{- $subchart := "" }}
|
||||||
|
{{- $chartName := default "" .chartName }}
|
||||||
|
{{- $passwordLength := default 10 .length }}
|
||||||
|
{{- $providedPasswordKey := include "common.utils.getKeyFromList" (dict "keys" .providedValues "context" $.context) }}
|
||||||
|
{{- $providedPasswordValue := include "common.utils.getValueFromKey" (dict "key" $providedPasswordKey "context" $.context) }}
|
||||||
|
{{- $secretData := (lookup "v1" "Secret" (include "common.names.namespace" .context) .secret).data }}
|
||||||
|
{{- if $secretData }}
|
||||||
|
{{- if hasKey $secretData .key }}
|
||||||
|
{{- $password = index $secretData .key | quote }}
|
||||||
|
{{- else }}
|
||||||
|
{{- printf "\nPASSWORDS ERROR: The secret \"%s\" does not contain the key \"%s\"\n" .secret .key | fail -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- else if $providedPasswordValue }}
|
||||||
|
{{- $password = $providedPasswordValue | toString | b64enc | quote }}
|
||||||
|
{{- else }}
|
||||||
|
|
||||||
|
{{- if .context.Values.enabled }}
|
||||||
|
{{- $subchart = $chartName }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- $requiredPassword := dict "valueKey" $providedPasswordKey "secret" .secret "field" .key "subchart" $subchart "context" $.context -}}
|
||||||
|
{{- $requiredPasswordError := include "common.validations.values.single.empty" $requiredPassword -}}
|
||||||
|
{{- $passwordValidationErrors := list $requiredPasswordError -}}
|
||||||
|
{{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" $passwordValidationErrors "context" $.context) -}}
|
||||||
|
|
||||||
|
{{- if .strong }}
|
||||||
|
{{- $subStr := list (lower (randAlpha 1)) (randNumeric 1) (upper (randAlpha 1)) | join "_" }}
|
||||||
|
{{- $password = randAscii $passwordLength }}
|
||||||
|
{{- $password = regexReplaceAllLiteral "\\W" $password "@" | substr 5 $passwordLength }}
|
||||||
|
{{- $password = printf "%s%s" $subStr $password | toString | shuffle | b64enc | quote }}
|
||||||
|
{{- else }}
|
||||||
|
{{- $password = randAlphaNum $passwordLength | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- printf "%s" $password -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Reuses the value from an existing secret, otherwise sets its value to a default value.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.secrets.lookup" (dict "secret" "secret-name" "key" "keyName" "defaultValue" .Values.myValue "context" $) }}
|
||||||
|
|
||||||
|
Params:
|
||||||
|
- secret - String - Required - Name of the 'Secret' resource where the password is stored.
|
||||||
|
- key - String - Required - Name of the key in the secret.
|
||||||
|
- defaultValue - String - Required - The path to the validating value in the values.yaml, e.g: "mysql.password". Will pick first parameter with a defined value.
|
||||||
|
- context - Context - Required - Parent context.
|
||||||
|
|
||||||
|
*/}}
|
||||||
|
{{- define "common.secrets.lookup" -}}
|
||||||
|
{{- $value := "" -}}
|
||||||
|
{{- $defaultValue := required "\n'common.secrets.lookup': Argument 'defaultValue' missing or empty" .defaultValue -}}
|
||||||
|
{{- $secretData := (lookup "v1" "Secret" (include "common.names.namespace" .context) .secret).data -}}
|
||||||
|
{{- if and $secretData (hasKey $secretData .key) -}}
|
||||||
|
{{- $value = index $secretData .key -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $value = $defaultValue | toString | b64enc -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- printf "%s" $value -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Returns whether a previous generated secret already exists
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.secrets.exists" (dict "secret" "secret-name" "context" $) }}
|
||||||
|
|
||||||
|
Params:
|
||||||
|
- secret - String - Required - Name of the 'Secret' resource where the password is stored.
|
||||||
|
- context - Context - Required - Parent context.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.secrets.exists" -}}
|
||||||
|
{{- $secret := (lookup "v1" "Secret" (include "common.names.namespace" .context) .secret) }}
|
||||||
|
{{- if $secret }}
|
||||||
|
{{- true -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,23 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Return the proper Storage Class
|
||||||
|
{{ include "common.storage.class" ( dict "persistence" .Values.path.to.the.persistence "global" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.storage.class" -}}
|
||||||
|
|
||||||
|
{{- $storageClass := .persistence.storageClass -}}
|
||||||
|
{{- if .global -}}
|
||||||
|
{{- if .global.storageClass -}}
|
||||||
|
{{- $storageClass = .global.storageClass -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if $storageClass -}}
|
||||||
|
{{- if (eq "-" $storageClass) -}}
|
||||||
|
{{- printf "storageClassName: \"\"" -}}
|
||||||
|
{{- else }}
|
||||||
|
{{- printf "storageClassName: %s" $storageClass -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- end -}}
|
@ -0,0 +1,13 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Renders a value that contains template.
|
||||||
|
Usage:
|
||||||
|
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.tplvalues.render" -}}
|
||||||
|
{{- if typeIs "string" .value }}
|
||||||
|
{{- tpl .value .context }}
|
||||||
|
{{- else }}
|
||||||
|
{{- tpl (.value | toYaml) .context }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,62 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Print instructions to get a secret value.
|
||||||
|
Usage:
|
||||||
|
{{ include "common.utils.secret.getvalue" (dict "secret" "secret-name" "field" "secret-value-field" "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.utils.secret.getvalue" -}}
|
||||||
|
{{- $varname := include "common.utils.fieldToEnvVar" . -}}
|
||||||
|
export {{ $varname }}=$(kubectl get secret --namespace {{ include "common.names.namespace" .context | quote }} {{ .secret }} -o jsonpath="{.data.{{ .field }}}" | base64 -d)
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Build env var name given a field
|
||||||
|
Usage:
|
||||||
|
{{ include "common.utils.fieldToEnvVar" dict "field" "my-password" }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.utils.fieldToEnvVar" -}}
|
||||||
|
{{- $fieldNameSplit := splitList "-" .field -}}
|
||||||
|
{{- $upperCaseFieldNameSplit := list -}}
|
||||||
|
|
||||||
|
{{- range $fieldNameSplit -}}
|
||||||
|
{{- $upperCaseFieldNameSplit = append $upperCaseFieldNameSplit ( upper . ) -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{ join "_" $upperCaseFieldNameSplit }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Gets a value from .Values given
|
||||||
|
Usage:
|
||||||
|
{{ include "common.utils.getValueFromKey" (dict "key" "path.to.key" "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.utils.getValueFromKey" -}}
|
||||||
|
{{- $splitKey := splitList "." .key -}}
|
||||||
|
{{- $value := "" -}}
|
||||||
|
{{- $latestObj := $.context.Values -}}
|
||||||
|
{{- range $splitKey -}}
|
||||||
|
{{- if not $latestObj -}}
|
||||||
|
{{- printf "please review the entire path of '%s' exists in values" $.key | fail -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- $value = ( index $latestObj . ) -}}
|
||||||
|
{{- $latestObj = $value -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- printf "%v" (default "" $value) -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Returns first .Values key with a defined value or first of the list if all non-defined
|
||||||
|
Usage:
|
||||||
|
{{ include "common.utils.getKeyFromList" (dict "keys" (list "path.to.key1" "path.to.key2") "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.utils.getKeyFromList" -}}
|
||||||
|
{{- $key := first .keys -}}
|
||||||
|
{{- $reverseKeys := reverse .keys }}
|
||||||
|
{{- range $reverseKeys }}
|
||||||
|
{{- $value := include "common.utils.getValueFromKey" (dict "key" . "context" $.context ) }}
|
||||||
|
{{- if $value -}}
|
||||||
|
{{- $key = . }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- printf "%s" $key -}}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,14 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Warning about using rolling tag.
|
||||||
|
Usage:
|
||||||
|
{{ include "common.warnings.rollingTag" .Values.path.to.the.imageRoot }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.warnings.rollingTag" -}}
|
||||||
|
|
||||||
|
{{- if and (contains "bitnami/" .repository) (not (.tag | toString | regexFind "-r\\d+$|sha256:")) }}
|
||||||
|
WARNING: Rolling tag detected ({{ .repository }}:{{ .tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment.
|
||||||
|
+info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- end -}}
|
@ -0,0 +1,72 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Validate Cassandra required passwords are not empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.validations.values.cassandra.passwords" (dict "secret" "secretName" "subchart" false "context" $) }}
|
||||||
|
Params:
|
||||||
|
- secret - String - Required. Name of the secret where Cassandra values are stored, e.g: "cassandra-passwords-secret"
|
||||||
|
- subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.validations.values.cassandra.passwords" -}}
|
||||||
|
{{- $existingSecret := include "common.cassandra.values.existingSecret" . -}}
|
||||||
|
{{- $enabled := include "common.cassandra.values.enabled" . -}}
|
||||||
|
{{- $dbUserPrefix := include "common.cassandra.values.key.dbUser" . -}}
|
||||||
|
{{- $valueKeyPassword := printf "%s.password" $dbUserPrefix -}}
|
||||||
|
|
||||||
|
{{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}}
|
||||||
|
{{- $requiredPasswords := list -}}
|
||||||
|
|
||||||
|
{{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "cassandra-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredPassword -}}
|
||||||
|
|
||||||
|
{{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}}
|
||||||
|
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for existingSecret.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.cassandra.values.existingSecret" (dict "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.cassandra.values.existingSecret" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- .context.Values.cassandra.dbUser.existingSecret | quote -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- .context.Values.dbUser.existingSecret | quote -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for enabled cassandra.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.cassandra.values.enabled" (dict "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.cassandra.values.enabled" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- printf "%v" .context.Values.cassandra.enabled -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%v" (not .context.Values.enabled) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for the key dbUser
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.cassandra.values.key.dbUser" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.cassandra.values.key.dbUser" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
cassandra.dbUser
|
||||||
|
{{- else -}}
|
||||||
|
dbUser
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,103 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Validate MariaDB required passwords are not empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.validations.values.mariadb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }}
|
||||||
|
Params:
|
||||||
|
- secret - String - Required. Name of the secret where MariaDB values are stored, e.g: "mysql-passwords-secret"
|
||||||
|
- subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.validations.values.mariadb.passwords" -}}
|
||||||
|
{{- $existingSecret := include "common.mariadb.values.auth.existingSecret" . -}}
|
||||||
|
{{- $enabled := include "common.mariadb.values.enabled" . -}}
|
||||||
|
{{- $architecture := include "common.mariadb.values.architecture" . -}}
|
||||||
|
{{- $authPrefix := include "common.mariadb.values.key.auth" . -}}
|
||||||
|
{{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}}
|
||||||
|
{{- $valueKeyUsername := printf "%s.username" $authPrefix -}}
|
||||||
|
{{- $valueKeyPassword := printf "%s.password" $authPrefix -}}
|
||||||
|
{{- $valueKeyReplicationPassword := printf "%s.replicationPassword" $authPrefix -}}
|
||||||
|
|
||||||
|
{{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}}
|
||||||
|
{{- $requiredPasswords := list -}}
|
||||||
|
|
||||||
|
{{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mariadb-root-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}}
|
||||||
|
|
||||||
|
{{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }}
|
||||||
|
{{- if not (empty $valueUsername) -}}
|
||||||
|
{{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mariadb-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredPassword -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if (eq $architecture "replication") -}}
|
||||||
|
{{- $requiredReplicationPassword := dict "valueKey" $valueKeyReplicationPassword "secret" .secret "field" "mariadb-replication-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}}
|
||||||
|
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for existingSecret.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mariadb.values.auth.existingSecret" (dict "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mariadb.values.auth.existingSecret" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- .context.Values.mariadb.auth.existingSecret | quote -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- .context.Values.auth.existingSecret | quote -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for enabled mariadb.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mariadb.values.enabled" (dict "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mariadb.values.enabled" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- printf "%v" .context.Values.mariadb.enabled -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%v" (not .context.Values.enabled) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for architecture
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mariadb.values.architecture" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mariadb.values.architecture" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- .context.Values.mariadb.architecture -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- .context.Values.architecture -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for the key auth
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mariadb.values.key.auth" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mariadb.values.key.auth" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
mariadb.auth
|
||||||
|
{{- else -}}
|
||||||
|
auth
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,108 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Validate MongoDB® required passwords are not empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.validations.values.mongodb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }}
|
||||||
|
Params:
|
||||||
|
- secret - String - Required. Name of the secret where MongoDB® values are stored, e.g: "mongodb-passwords-secret"
|
||||||
|
- subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.validations.values.mongodb.passwords" -}}
|
||||||
|
{{- $existingSecret := include "common.mongodb.values.auth.existingSecret" . -}}
|
||||||
|
{{- $enabled := include "common.mongodb.values.enabled" . -}}
|
||||||
|
{{- $authPrefix := include "common.mongodb.values.key.auth" . -}}
|
||||||
|
{{- $architecture := include "common.mongodb.values.architecture" . -}}
|
||||||
|
{{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}}
|
||||||
|
{{- $valueKeyUsername := printf "%s.username" $authPrefix -}}
|
||||||
|
{{- $valueKeyDatabase := printf "%s.database" $authPrefix -}}
|
||||||
|
{{- $valueKeyPassword := printf "%s.password" $authPrefix -}}
|
||||||
|
{{- $valueKeyReplicaSetKey := printf "%s.replicaSetKey" $authPrefix -}}
|
||||||
|
{{- $valueKeyAuthEnabled := printf "%s.enabled" $authPrefix -}}
|
||||||
|
|
||||||
|
{{- $authEnabled := include "common.utils.getValueFromKey" (dict "key" $valueKeyAuthEnabled "context" .context) -}}
|
||||||
|
|
||||||
|
{{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") (eq $authEnabled "true") -}}
|
||||||
|
{{- $requiredPasswords := list -}}
|
||||||
|
|
||||||
|
{{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mongodb-root-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}}
|
||||||
|
|
||||||
|
{{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }}
|
||||||
|
{{- $valueDatabase := include "common.utils.getValueFromKey" (dict "key" $valueKeyDatabase "context" .context) }}
|
||||||
|
{{- if and $valueUsername $valueDatabase -}}
|
||||||
|
{{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mongodb-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredPassword -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if (eq $architecture "replicaset") -}}
|
||||||
|
{{- $requiredReplicaSetKey := dict "valueKey" $valueKeyReplicaSetKey "secret" .secret "field" "mongodb-replica-set-key" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredReplicaSetKey -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}}
|
||||||
|
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for existingSecret.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mongodb.values.auth.existingSecret" (dict "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether MongoDb is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mongodb.values.auth.existingSecret" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- .context.Values.mongodb.auth.existingSecret | quote -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- .context.Values.auth.existingSecret | quote -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for enabled mongodb.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mongodb.values.enabled" (dict "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mongodb.values.enabled" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- printf "%v" .context.Values.mongodb.enabled -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%v" (not .context.Values.enabled) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for the key auth
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mongodb.values.key.auth" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mongodb.values.key.auth" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
mongodb.auth
|
||||||
|
{{- else -}}
|
||||||
|
auth
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for architecture
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mongodb.values.architecture" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mongodb.values.architecture" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- .context.Values.mongodb.architecture -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- .context.Values.architecture -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,103 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Validate MySQL required passwords are not empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.validations.values.mysql.passwords" (dict "secret" "secretName" "subchart" false "context" $) }}
|
||||||
|
Params:
|
||||||
|
- secret - String - Required. Name of the secret where MySQL values are stored, e.g: "mysql-passwords-secret"
|
||||||
|
- subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.validations.values.mysql.passwords" -}}
|
||||||
|
{{- $existingSecret := include "common.mysql.values.auth.existingSecret" . -}}
|
||||||
|
{{- $enabled := include "common.mysql.values.enabled" . -}}
|
||||||
|
{{- $architecture := include "common.mysql.values.architecture" . -}}
|
||||||
|
{{- $authPrefix := include "common.mysql.values.key.auth" . -}}
|
||||||
|
{{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}}
|
||||||
|
{{- $valueKeyUsername := printf "%s.username" $authPrefix -}}
|
||||||
|
{{- $valueKeyPassword := printf "%s.password" $authPrefix -}}
|
||||||
|
{{- $valueKeyReplicationPassword := printf "%s.replicationPassword" $authPrefix -}}
|
||||||
|
|
||||||
|
{{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}}
|
||||||
|
{{- $requiredPasswords := list -}}
|
||||||
|
|
||||||
|
{{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mysql-root-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}}
|
||||||
|
|
||||||
|
{{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }}
|
||||||
|
{{- if not (empty $valueUsername) -}}
|
||||||
|
{{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mysql-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredPassword -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if (eq $architecture "replication") -}}
|
||||||
|
{{- $requiredReplicationPassword := dict "valueKey" $valueKeyReplicationPassword "secret" .secret "field" "mysql-replication-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}}
|
||||||
|
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for existingSecret.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mysql.values.auth.existingSecret" (dict "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mysql.values.auth.existingSecret" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- .context.Values.mysql.auth.existingSecret | quote -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- .context.Values.auth.existingSecret | quote -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for enabled mysql.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mysql.values.enabled" (dict "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mysql.values.enabled" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- printf "%v" .context.Values.mysql.enabled -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%v" (not .context.Values.enabled) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for architecture
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mysql.values.architecture" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mysql.values.architecture" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- .context.Values.mysql.architecture -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- .context.Values.architecture -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for the key auth
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.mysql.values.key.auth" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.mysql.values.key.auth" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
mysql.auth
|
||||||
|
{{- else -}}
|
||||||
|
auth
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,129 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Validate PostgreSQL required passwords are not empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.validations.values.postgresql.passwords" (dict "secret" "secretName" "subchart" false "context" $) }}
|
||||||
|
Params:
|
||||||
|
- secret - String - Required. Name of the secret where postgresql values are stored, e.g: "postgresql-passwords-secret"
|
||||||
|
- subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.validations.values.postgresql.passwords" -}}
|
||||||
|
{{- $existingSecret := include "common.postgresql.values.existingSecret" . -}}
|
||||||
|
{{- $enabled := include "common.postgresql.values.enabled" . -}}
|
||||||
|
{{- $valueKeyPostgresqlPassword := include "common.postgresql.values.key.postgressPassword" . -}}
|
||||||
|
{{- $valueKeyPostgresqlReplicationEnabled := include "common.postgresql.values.key.replicationPassword" . -}}
|
||||||
|
{{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}}
|
||||||
|
{{- $requiredPasswords := list -}}
|
||||||
|
{{- $requiredPostgresqlPassword := dict "valueKey" $valueKeyPostgresqlPassword "secret" .secret "field" "postgresql-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlPassword -}}
|
||||||
|
|
||||||
|
{{- $enabledReplication := include "common.postgresql.values.enabled.replication" . -}}
|
||||||
|
{{- if (eq $enabledReplication "true") -}}
|
||||||
|
{{- $requiredPostgresqlReplicationPassword := dict "valueKey" $valueKeyPostgresqlReplicationEnabled "secret" .secret "field" "postgresql-replication-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlReplicationPassword -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to decide whether evaluate global values.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.postgresql.values.use.global" (dict "key" "key-of-global" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- key - String - Required. Field to be evaluated within global, e.g: "existingSecret"
|
||||||
|
*/}}
|
||||||
|
{{- define "common.postgresql.values.use.global" -}}
|
||||||
|
{{- if .context.Values.global -}}
|
||||||
|
{{- if .context.Values.global.postgresql -}}
|
||||||
|
{{- index .context.Values.global.postgresql .key | quote -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for existingSecret.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.postgresql.values.existingSecret" (dict "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.postgresql.values.existingSecret" -}}
|
||||||
|
{{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "existingSecret" "context" .context) -}}
|
||||||
|
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- default (.context.Values.postgresql.existingSecret | quote) $globalValue -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- default (.context.Values.existingSecret | quote) $globalValue -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for enabled postgresql.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.postgresql.values.enabled" (dict "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.postgresql.values.enabled" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- printf "%v" .context.Values.postgresql.enabled -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%v" (not .context.Values.enabled) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for the key postgressPassword.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.postgresql.values.key.postgressPassword" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.postgresql.values.key.postgressPassword" -}}
|
||||||
|
{{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "postgresqlUsername" "context" .context) -}}
|
||||||
|
|
||||||
|
{{- if not $globalValue -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
postgresql.postgresqlPassword
|
||||||
|
{{- else -}}
|
||||||
|
postgresqlPassword
|
||||||
|
{{- end -}}
|
||||||
|
{{- else -}}
|
||||||
|
global.postgresql.postgresqlPassword
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for enabled.replication.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.postgresql.values.enabled.replication" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.postgresql.values.enabled.replication" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- printf "%v" .context.Values.postgresql.replication.enabled -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%v" .context.Values.replication.enabled -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for the key replication.password.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.postgresql.values.key.replicationPassword" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.postgresql.values.key.replicationPassword" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
postgresql.replication.password
|
||||||
|
{{- else -}}
|
||||||
|
replication.password
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,76 @@
|
|||||||
|
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Validate Redis® required passwords are not empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.validations.values.redis.passwords" (dict "secret" "secretName" "subchart" false "context" $) }}
|
||||||
|
Params:
|
||||||
|
- secret - String - Required. Name of the secret where redis values are stored, e.g: "redis-passwords-secret"
|
||||||
|
- subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.validations.values.redis.passwords" -}}
|
||||||
|
{{- $enabled := include "common.redis.values.enabled" . -}}
|
||||||
|
{{- $valueKeyPrefix := include "common.redis.values.keys.prefix" . -}}
|
||||||
|
{{- $standarizedVersion := include "common.redis.values.standarized.version" . }}
|
||||||
|
|
||||||
|
{{- $existingSecret := ternary (printf "%s%s" $valueKeyPrefix "auth.existingSecret") (printf "%s%s" $valueKeyPrefix "existingSecret") (eq $standarizedVersion "true") }}
|
||||||
|
{{- $existingSecretValue := include "common.utils.getValueFromKey" (dict "key" $existingSecret "context" .context) }}
|
||||||
|
|
||||||
|
{{- $valueKeyRedisPassword := ternary (printf "%s%s" $valueKeyPrefix "auth.password") (printf "%s%s" $valueKeyPrefix "password") (eq $standarizedVersion "true") }}
|
||||||
|
{{- $valueKeyRedisUseAuth := ternary (printf "%s%s" $valueKeyPrefix "auth.enabled") (printf "%s%s" $valueKeyPrefix "usePassword") (eq $standarizedVersion "true") }}
|
||||||
|
|
||||||
|
{{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}}
|
||||||
|
{{- $requiredPasswords := list -}}
|
||||||
|
|
||||||
|
{{- $useAuth := include "common.utils.getValueFromKey" (dict "key" $valueKeyRedisUseAuth "context" .context) -}}
|
||||||
|
{{- if eq $useAuth "true" -}}
|
||||||
|
{{- $requiredRedisPassword := dict "valueKey" $valueKeyRedisPassword "secret" .secret "field" "redis-password" -}}
|
||||||
|
{{- $requiredPasswords = append $requiredPasswords $requiredRedisPassword -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right value for enabled redis.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.redis.values.enabled" (dict "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.redis.values.enabled" -}}
|
||||||
|
{{- if .subchart -}}
|
||||||
|
{{- printf "%v" .context.Values.redis.enabled -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%v" (not .context.Values.enabled) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Auxiliary function to get the right prefix path for the values
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.redis.values.key.prefix" (dict "subchart" "true" "context" $) }}
|
||||||
|
Params:
|
||||||
|
- subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false
|
||||||
|
*/}}
|
||||||
|
{{- define "common.redis.values.keys.prefix" -}}
|
||||||
|
{{- if .subchart -}}redis.{{- else -}}{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Checks whether the redis chart's includes the standarizations (version >= 14)
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.redis.values.standarized.version" (dict "context" $) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "common.redis.values.standarized.version" -}}
|
||||||
|
|
||||||
|
{{- $standarizedAuth := printf "%s%s" (include "common.redis.values.keys.prefix" .) "auth" -}}
|
||||||
|
{{- $standarizedAuthValues := include "common.utils.getValueFromKey" (dict "key" $standarizedAuth "context" .context) }}
|
||||||
|
|
||||||
|
{{- if $standarizedAuthValues -}}
|
||||||
|
{{- true -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,46 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Validate values must not be empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{- $validateValueConf00 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-00") -}}
|
||||||
|
{{- $validateValueConf01 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-01") -}}
|
||||||
|
{{ include "common.validations.values.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }}
|
||||||
|
|
||||||
|
Validate value params:
|
||||||
|
- valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password"
|
||||||
|
- secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret"
|
||||||
|
- field - String - Optional. Name of the field in the secret data, e.g: "mysql-password"
|
||||||
|
*/}}
|
||||||
|
{{- define "common.validations.values.multiple.empty" -}}
|
||||||
|
{{- range .required -}}
|
||||||
|
{{- include "common.validations.values.single.empty" (dict "valueKey" .valueKey "secret" .secret "field" .field "context" $.context) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Validate a value must not be empty.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
{{ include "common.validations.value.empty" (dict "valueKey" "mariadb.password" "secret" "secretName" "field" "my-password" "subchart" "subchart" "context" $) }}
|
||||||
|
|
||||||
|
Validate value params:
|
||||||
|
- valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password"
|
||||||
|
- secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret"
|
||||||
|
- field - String - Optional. Name of the field in the secret data, e.g: "mysql-password"
|
||||||
|
- subchart - String - Optional - Name of the subchart that the validated password is part of.
|
||||||
|
*/}}
|
||||||
|
{{- define "common.validations.values.single.empty" -}}
|
||||||
|
{{- $value := include "common.utils.getValueFromKey" (dict "key" .valueKey "context" .context) }}
|
||||||
|
{{- $subchart := ternary "" (printf "%s." .subchart) (empty .subchart) }}
|
||||||
|
|
||||||
|
{{- if not $value -}}
|
||||||
|
{{- $varname := "my-value" -}}
|
||||||
|
{{- $getCurrentValue := "" -}}
|
||||||
|
{{- if and .secret .field -}}
|
||||||
|
{{- $varname = include "common.utils.fieldToEnvVar" . -}}
|
||||||
|
{{- $getCurrentValue = printf " To get the current value:\n\n %s\n" (include "common.utils.secret.getvalue" .) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- printf "\n '%s' must not be empty, please add '--set %s%s=$%s' to the command.%s" .valueKey $subchart .valueKey $varname $getCurrentValue -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,5 @@
|
|||||||
|
## bitnami/common
|
||||||
|
## It is required by CI/CD tools and processes.
|
||||||
|
## @skip exampleValue
|
||||||
|
##
|
||||||
|
exampleValue: common-chart
|
72
internal/accept_test/test_data/nginx/templates/NOTES.txt
Normal file
72
internal/accept_test/test_data/nginx/templates/NOTES.txt
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
CHART NAME: {{ .Chart.Name }}
|
||||||
|
CHART VERSION: {{ .Chart.Version }}
|
||||||
|
APP VERSION: {{ .Chart.AppVersion }}
|
||||||
|
|
||||||
|
** Please be patient while the chart is being deployed **
|
||||||
|
|
||||||
|
{{- if .Values.diagnosticMode.enabled }}
|
||||||
|
The chart has been deployed in diagnostic mode. All probes have been disabled and the command has been overwritten with:
|
||||||
|
|
||||||
|
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 4 }}
|
||||||
|
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 4 }}
|
||||||
|
|
||||||
|
Get the list of pods by executing:
|
||||||
|
|
||||||
|
kubectl get pods --namespace {{ template "common.names.namespace" . }} -l app.kubernetes.io/instance={{ .Release.Name }}
|
||||||
|
|
||||||
|
Access the pod you want to debug by executing
|
||||||
|
|
||||||
|
kubectl exec --namespace {{ template "common.names.namespace" . }} -ti <NAME OF THE POD> -- bash
|
||||||
|
|
||||||
|
In order to replicate the container startup scripts execute this command:
|
||||||
|
|
||||||
|
/opt/bitnami/scripts/nginx/entrypoint.sh /opt/bitnami/scripts/nginx/run.sh
|
||||||
|
|
||||||
|
{{- else }}
|
||||||
|
NGINX can be accessed through the following DNS name from within your cluster:
|
||||||
|
|
||||||
|
{{ include "common.names.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }} (port {{ .Values.service.ports.http }})
|
||||||
|
|
||||||
|
To access NGINX from outside the cluster, follow the steps below:
|
||||||
|
|
||||||
|
{{- if .Values.ingress.enabled }}
|
||||||
|
|
||||||
|
1. Get the NGINX URL and associate its hostname to your cluster external IP:
|
||||||
|
|
||||||
|
export CLUSTER_IP=$(minikube ip) # On Minikube. Use: `kubectl cluster-info` on others K8s clusters
|
||||||
|
echo "NGINX URL: http{{ if .Values.ingress.tls }}s{{ end }}://{{ .Values.ingress.hostname }}"
|
||||||
|
echo "$CLUSTER_IP {{ .Values.ingress.hostname }}" | sudo tee -a /etc/hosts
|
||||||
|
|
||||||
|
{{- else }}
|
||||||
|
|
||||||
|
1. Get the NGINX URL by running these commands:
|
||||||
|
|
||||||
|
{{- if contains "LoadBalancer" .Values.service.type }}
|
||||||
|
|
||||||
|
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||||
|
Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ include "common.names.fullname" . }}'
|
||||||
|
|
||||||
|
export SERVICE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].port}" services {{ include "common.names.fullname" . }})
|
||||||
|
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "common.names.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||||
|
echo "http://${SERVICE_IP}:${SERVICE_PORT}"
|
||||||
|
|
||||||
|
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||||
|
|
||||||
|
export SERVICE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].port}" services {{ include "common.names.fullname" . }})
|
||||||
|
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "common.names.fullname" . }} ${SERVICE_PORT}:${SERVICE_PORT} &
|
||||||
|
echo "http://127.0.0.1:${SERVICE_PORT}"
|
||||||
|
|
||||||
|
{{- else if contains "NodePort" .Values.service.type }}
|
||||||
|
|
||||||
|
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "common.names.fullname" . }})
|
||||||
|
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||||
|
echo "http://${NODE_IP}:${NODE_PORT}"
|
||||||
|
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- include "common.warnings.rollingTag" .Values.image }}
|
||||||
|
{{- include "common.warnings.rollingTag" .Values.cloneStaticSiteFromGit.image }}
|
||||||
|
{{- include "common.warnings.rollingTag" .Values.metrics.image }}
|
||||||
|
{{- include "nginx.validateValues" . }}
|
||||||
|
{{- end }}
|
107
internal/accept_test/test_data/nginx/templates/_helpers.tpl
Normal file
107
internal/accept_test/test_data/nginx/templates/_helpers.tpl
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Return the proper NGINX image name
|
||||||
|
*/}}
|
||||||
|
{{- define "nginx.image" -}}
|
||||||
|
{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the proper GIT image name
|
||||||
|
*/}}
|
||||||
|
{{- define "nginx.cloneStaticSiteFromGit.image" -}}
|
||||||
|
{{ include "common.images.image" (dict "imageRoot" .Values.cloneStaticSiteFromGit.image "global" .Values.global) }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the proper Prometheus metrics image name
|
||||||
|
*/}}
|
||||||
|
{{- define "nginx.metrics.image" -}}
|
||||||
|
{{ include "common.images.image" (dict "imageRoot" .Values.metrics.image "global" .Values.global) }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the proper Docker Image Registry Secret Names
|
||||||
|
*/}}
|
||||||
|
{{- define "nginx.imagePullSecrets" -}}
|
||||||
|
{{ include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.cloneStaticSiteFromGit.image .Values.metrics.image) "global" .Values.global) }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return true if a static site should be mounted in the NGINX container
|
||||||
|
*/}}
|
||||||
|
{{- define "nginx.useStaticSite" -}}
|
||||||
|
{{- if or .Values.cloneStaticSiteFromGit.enabled .Values.staticSiteConfigmap .Values.staticSitePVC }}
|
||||||
|
{- true -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the volume to use to mount the static site in the NGINX container
|
||||||
|
*/}}
|
||||||
|
{{- define "nginx.staticSiteVolume" -}}
|
||||||
|
{{- if .Values.cloneStaticSiteFromGit.enabled }}
|
||||||
|
emptyDir: {}
|
||||||
|
{{- else if .Values.staticSiteConfigmap }}
|
||||||
|
configMap:
|
||||||
|
name: {{ printf "%s" (tpl .Values.staticSiteConfigmap $) -}}
|
||||||
|
{{- else if .Values.staticSitePVC }}
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: {{ printf "%s" (tpl .Values.staticSitePVC $) -}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return the custom NGINX server block configmap.
|
||||||
|
*/}}
|
||||||
|
{{- define "nginx.serverBlockConfigmapName" -}}
|
||||||
|
{{- if .Values.existingServerBlockConfigmap -}}
|
||||||
|
{{- printf "%s" (tpl .Values.existingServerBlockConfigmap $) -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%s-server-block" (include "common.names.fullname" .) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Compile all warnings into a single message, and call fail.
|
||||||
|
*/}}
|
||||||
|
{{- define "nginx.validateValues" -}}
|
||||||
|
{{- $messages := list -}}
|
||||||
|
{{- $messages := append $messages (include "nginx.validateValues.cloneStaticSiteFromGit" .) -}}
|
||||||
|
{{- $messages := append $messages (include "nginx.validateValues.extraVolumes" .) -}}
|
||||||
|
{{- $messages := without $messages "" -}}
|
||||||
|
{{- $message := join "\n" $messages -}}
|
||||||
|
|
||||||
|
{{- if $message -}}
|
||||||
|
{{- printf "\nVALUES VALIDATION:\n%s" $message | fail -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* Validate values of NGINX - Clone StaticSite from Git configuration */}}
|
||||||
|
{{- define "nginx.validateValues.cloneStaticSiteFromGit" -}}
|
||||||
|
{{- if and .Values.cloneStaticSiteFromGit.enabled (or (not .Values.cloneStaticSiteFromGit.repository) (not .Values.cloneStaticSiteFromGit.branch)) -}}
|
||||||
|
nginx: cloneStaticSiteFromGit
|
||||||
|
When enabling cloing a static site from a Git repository, both the Git repository and the Git branch must be provided.
|
||||||
|
Please provide them by setting the `cloneStaticSiteFromGit.repository` and `cloneStaticSiteFromGit.branch` parameters.
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* Validate values of NGINX - Incorrect extra volume settings */}}
|
||||||
|
{{- define "nginx.validateValues.extraVolumes" -}}
|
||||||
|
{{- if and (.Values.extraVolumes) (not (or .Values.extraVolumeMounts .Values.cloneStaticSiteFromGit.extraVolumeMounts)) -}}
|
||||||
|
nginx: missing-extra-volume-mounts
|
||||||
|
You specified extra volumes but not mount points for them. Please set
|
||||||
|
the extraVolumeMounts value
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "nginx.serviceAccountName" -}}
|
||||||
|
{{- if .Values.serviceAccount.create -}}
|
||||||
|
{{ default (include "common.names.fullname" .) .Values.serviceAccount.name }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ default "default" .Values.serviceAccount.name }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
276
internal/accept_test/test_data/nginx/templates/deployment.yaml
Normal file
276
internal/accept_test/test_data/nginx/templates/deployment.yaml
Normal file
@ -0,0 +1,276 @@
|
|||||||
|
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "common.names.fullname" . }}
|
||||||
|
namespace: {{ include "common.names.namespace" . | quote }}
|
||||||
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonLabels }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if not .Values.autoscaling.enabled }}
|
||||||
|
replicas: {{ .Values.replicaCount }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.updateStrategy }}
|
||||||
|
strategy: {{- toYaml .Values.updateStrategy | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
selector:
|
||||||
|
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels: {{- include "common.labels.standard" . | nindent 8 }}
|
||||||
|
{{- if .Values.podLabels }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
annotations:
|
||||||
|
{{- if .Values.podAnnotations }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.podAnnotations "context" $) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and .Values.serverBlock (not .Values.existingServerBlockConfigmap) }}
|
||||||
|
checksum/server-block-configuration: {{ include (print $.Template.BasePath "/server-block-configmap.yaml") . | sha256sum }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- include "nginx.imagePullSecrets" . | nindent 6 }}
|
||||||
|
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
|
||||||
|
shareProcessNamespace: {{ .Values.sidecarSingleProcessNamespace }}
|
||||||
|
serviceAccountName: {{ template "nginx.serviceAccountName" . }}
|
||||||
|
{{- if .Values.hostAliases }}
|
||||||
|
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.affinity }}
|
||||||
|
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }}
|
||||||
|
{{- else }}
|
||||||
|
affinity:
|
||||||
|
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }}
|
||||||
|
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }}
|
||||||
|
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }}
|
||||||
|
{{- end }}
|
||||||
|
hostNetwork: {{ .Values.hostNetwork }}
|
||||||
|
hostIPC: {{ .Values.hostIPC }}
|
||||||
|
{{- if .Values.priorityClassName }}
|
||||||
|
priorityClassName: {{ .Values.priorityClassName | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.nodeSelector }}
|
||||||
|
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.tolerations }}
|
||||||
|
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.schedulerName }}
|
||||||
|
schedulerName: {{ .Values.schedulerName | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.topologySpreadConstraints }}
|
||||||
|
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.topologySpreadConstraints "context" .) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.podSecurityContext.enabled }}
|
||||||
|
securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.terminationGracePeriodSeconds }}
|
||||||
|
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
||||||
|
{{- end }}
|
||||||
|
initContainers:
|
||||||
|
{{- if .Values.cloneStaticSiteFromGit.enabled }}
|
||||||
|
- name: git-clone-repository
|
||||||
|
image: {{ include "nginx.cloneStaticSiteFromGit.image" . }}
|
||||||
|
imagePullPolicy: {{ .Values.cloneStaticSiteFromGit.image.pullPolicy | quote }}
|
||||||
|
{{- if .Values.containerSecurityContext.enabled }}
|
||||||
|
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.cloneStaticSiteFromGit.gitClone.command }}
|
||||||
|
command: {{- include "common.tplvalues.render" (dict "value" .Values.cloneStaticSiteFromGit.gitClone.command "context" $) | nindent 12 }}
|
||||||
|
{{- else }}
|
||||||
|
command:
|
||||||
|
- /bin/bash
|
||||||
|
- -ec
|
||||||
|
- |
|
||||||
|
[[ -f "/opt/bitnami/scripts/git/entrypoint.sh" ]] && source "/opt/bitnami/scripts/git/entrypoint.sh"
|
||||||
|
git clone {{ .Values.cloneStaticSiteFromGit.repository }} --branch {{ .Values.cloneStaticSiteFromGit.branch }} /tmp/app
|
||||||
|
[[ "$?" -eq 0 ]] && shopt -s dotglob && rm -rf /app/* && mv /tmp/app/* /app/
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.cloneStaticSiteFromGit.gitClone.args }}
|
||||||
|
args: {{- include "common.tplvalues.render" (dict "value" .Values.cloneStaticSiteFromGit.gitClone.args "context" $) | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: staticsite
|
||||||
|
mountPath: /app
|
||||||
|
{{- if .Values.cloneStaticSiteFromGit.extraVolumeMounts }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" .Values.cloneStaticSiteFromGit.extraVolumeMounts "context" $) | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.cloneStaticSiteFromGit.extraEnvVars }}
|
||||||
|
env: {{- include "common.tplvalues.render" (dict "value" .Values.cloneStaticSiteFromGit.extraEnvVars "context" $) | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.initContainers }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
containers:
|
||||||
|
{{- if .Values.cloneStaticSiteFromGit.enabled }}
|
||||||
|
- name: git-repo-syncer
|
||||||
|
image: {{ include "nginx.cloneStaticSiteFromGit.image" . }}
|
||||||
|
imagePullPolicy: {{ .Values.cloneStaticSiteFromGit.image.pullPolicy | quote }}
|
||||||
|
{{- if .Values.containerSecurityContext.enabled }}
|
||||||
|
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.cloneStaticSiteFromGit.gitSync.command }}
|
||||||
|
command: {{- include "common.tplvalues.render" (dict "value" .Values.cloneStaticSiteFromGit.gitSync.command "context" $) | nindent 12 }}
|
||||||
|
{{- else }}
|
||||||
|
command:
|
||||||
|
- /bin/bash
|
||||||
|
- -ec
|
||||||
|
- |
|
||||||
|
[[ -f "/opt/bitnami/scripts/git/entrypoint.sh" ]] && source "/opt/bitnami/scripts/git/entrypoint.sh"
|
||||||
|
while true; do
|
||||||
|
cd /app && git pull origin {{ .Values.cloneStaticSiteFromGit.branch }}
|
||||||
|
sleep {{ .Values.cloneStaticSiteFromGit.interval }}
|
||||||
|
done
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.cloneStaticSiteFromGit.gitSync.args }}
|
||||||
|
args: {{- include "common.tplvalues.render" (dict "value" .Values.cloneStaticSiteFromGit.gitSync.args "context" $) | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: staticsite
|
||||||
|
mountPath: /app
|
||||||
|
{{- if .Values.cloneStaticSiteFromGit.extraVolumeMounts }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" .Values.cloneStaticSiteFromGit.extraVolumeMounts "context" $) | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.cloneStaticSiteFromGit.extraEnvVars }}
|
||||||
|
env: {{- include "common.tplvalues.render" (dict "value" .Values.cloneStaticSiteFromGit.extraEnvVars "context" $) | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
- name: nginx
|
||||||
|
image: {{ include "nginx.image" . }}
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
||||||
|
{{- if .Values.containerSecurityContext.enabled }}
|
||||||
|
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.diagnosticMode.enabled }}
|
||||||
|
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
|
||||||
|
{{- else if .Values.command }}
|
||||||
|
command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.diagnosticMode.enabled }}
|
||||||
|
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
|
||||||
|
{{- else if .Values.args }}
|
||||||
|
args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.lifecycleHooks }}
|
||||||
|
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
env:
|
||||||
|
- name: BITNAMI_DEBUG
|
||||||
|
value: {{ ternary "true" "false" .Values.image.debug | quote }}
|
||||||
|
- name: NGINX_HTTP_PORT_NUMBER
|
||||||
|
value: {{ .Values.containerPorts.http | quote }}
|
||||||
|
{{- if .Values.containerPorts.https }}
|
||||||
|
- name: NGINX_HTTPS_PORT_NUMBER
|
||||||
|
value: {{ .Values.containerPorts.https | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.extraEnvVars }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
envFrom:
|
||||||
|
{{- if .Values.extraEnvVarsCM }}
|
||||||
|
- configMapRef:
|
||||||
|
name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsCM "context" $) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.extraEnvVarsSecret }}
|
||||||
|
- secretRef:
|
||||||
|
name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: {{ .Values.containerPorts.http }}
|
||||||
|
{{- if .Values.containerPorts.https }}
|
||||||
|
- name: https
|
||||||
|
containerPort: {{ .Values.containerPorts.https }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.extraContainerPorts }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" .Values.extraContainerPorts "context" $) | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if not .Values.diagnosticMode.enabled }}
|
||||||
|
{{- if .Values.customLivenessProbe }}
|
||||||
|
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }}
|
||||||
|
{{- else if .Values.livenessProbe.enabled }}
|
||||||
|
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }}
|
||||||
|
tcpSocket:
|
||||||
|
port: http
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.customReadinessProbe }}
|
||||||
|
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }}
|
||||||
|
{{- else if .Values.readinessProbe.enabled }}
|
||||||
|
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }}
|
||||||
|
tcpSocket:
|
||||||
|
port: http
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.customStartupProbe }}
|
||||||
|
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }}
|
||||||
|
{{- else if .Values.startupProbe.enabled }}
|
||||||
|
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }}
|
||||||
|
tcpSocket:
|
||||||
|
port: http
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.resources }}
|
||||||
|
resources: {{- toYaml .Values.resources | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
{{- if or .Values.serverBlock .Values.existingServerBlockConfigmap }}
|
||||||
|
- name: nginx-server-block
|
||||||
|
mountPath: /opt/bitnami/nginx/conf/server_blocks
|
||||||
|
{{- end }}
|
||||||
|
{{- if (include "nginx.useStaticSite" .) }}
|
||||||
|
- name: staticsite
|
||||||
|
mountPath: /app
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.extraVolumeMounts }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.extraVolumeMounts "context" $) | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.metrics.enabled }}
|
||||||
|
- name: metrics
|
||||||
|
image: {{ include "nginx.metrics.image" . }}
|
||||||
|
imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
|
||||||
|
{{- if .Values.metrics.securityContext.enabled }}
|
||||||
|
securityContext: {{- omit .Values.metrics.securityContext "enabled" | toYaml | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
command: ['/usr/bin/exporter', '-nginx.scrape-uri', 'http://127.0.0.1:{{- default .Values.containerPorts.http .Values.metrics.port }}/status']
|
||||||
|
ports:
|
||||||
|
- name: metrics
|
||||||
|
containerPort: 9113
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /metrics
|
||||||
|
port: metrics
|
||||||
|
initialDelaySeconds: 15
|
||||||
|
timeoutSeconds: 5
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /metrics
|
||||||
|
port: metrics
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
timeoutSeconds: 1
|
||||||
|
{{- if .Values.metrics.resources }}
|
||||||
|
resources: {{- toYaml .Values.metrics.resources | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.sidecars }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
volumes:
|
||||||
|
{{- if or .Values.serverBlock .Values.existingServerBlockConfigmap }}
|
||||||
|
- name: nginx-server-block
|
||||||
|
configMap:
|
||||||
|
name: {{ include "nginx.serverBlockConfigmapName" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if (include "nginx.useStaticSite" .) }}
|
||||||
|
- name: staticsite
|
||||||
|
{{- include "nginx.staticSiteVolume" . | nindent 10 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.extraVolumes }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.extraVolumes "context" $) | nindent 8 }}
|
||||||
|
{{- end }}
|
@ -0,0 +1,4 @@
|
|||||||
|
{{- range .Values.extraDeploy }}
|
||||||
|
---
|
||||||
|
{{ include "common.tplvalues.render" (dict "value" . "context" $) }}
|
||||||
|
{{- end }}
|
@ -0,0 +1,60 @@
|
|||||||
|
{{- if .Values.healthIngress.enabled }}
|
||||||
|
apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: {{ include "common.names.fullname" . }}-health
|
||||||
|
namespace: {{ include "common.names.namespace" . | quote }}
|
||||||
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonLabels }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
annotations:
|
||||||
|
{{- if .Values.healthIngress.annotations }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" .Values.healthIngress.annotations "context" $) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if and .Values.healthIngress.ingressClassName (eq "true" (include "common.ingress.supportsIngressClassname" .)) }}
|
||||||
|
ingressClassName: {{ .Values.healthIngress.ingressClassName | quote }}
|
||||||
|
{{- end }}
|
||||||
|
rules:
|
||||||
|
{{- if .Values.healthIngress.hostname }}
|
||||||
|
- host: {{ .Values.healthIngress.hostname }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
{{- if .Values.healthIngress.extraPaths }}
|
||||||
|
{{- toYaml .Values.healthIngress.extraPaths | nindent 10 }}
|
||||||
|
{{- end }}
|
||||||
|
- path: {{ .Values.healthIngress.path }}
|
||||||
|
{{- if eq "true" (include "common.ingress.supportsPathType" .) }}
|
||||||
|
pathType: {{ .Values.healthIngress.pathType }}
|
||||||
|
{{- end }}
|
||||||
|
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "common.names.fullname" .) "servicePort" "http" "context" $) | nindent 14 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range .Values.healthIngress.extraHosts }}
|
||||||
|
- host: {{ .name | quote }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: {{ default "/" .path }}
|
||||||
|
{{- if eq "true" (include "common.ingress.supportsPathType" $) }}
|
||||||
|
pathType: {{ default "ImplementationSpecific" .pathType }}
|
||||||
|
{{- end }}
|
||||||
|
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "common.names.fullname" $) "servicePort" "http" "context" $) | nindent 14 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.healthIngress.extraRules }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" .Values.healthIngress.extraRules "context" $) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if or (and .Values.healthIngress.tls (or (include "common.ingress.certManagerRequest" ( dict "annotations" .Values.healthIngress.annotations )) .Values.healthIngress.selfSigned (not (empty .Values.healthIngress.secrets)))) .Values.healthIngress.extraTls }}
|
||||||
|
tls:
|
||||||
|
{{- if and .Values.healthIngress.tls (or (include "common.ingress.certManagerRequest" ( dict "annotations" .Values.healthIngress.annotations )) .Values.healthIngress.selfSigned (not (empty .Values.healthIngress.secrets))) }}
|
||||||
|
- hosts:
|
||||||
|
- {{ .Values.healthIngress.hostname | quote }}
|
||||||
|
secretName: {{ printf "%s-health-tls" .Values.healthIngress.hostname }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.healthIngress.extraTls }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" .Values.healthIngress.extraTls "context" $) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
46
internal/accept_test/test_data/nginx/templates/hpa.yaml
Normal file
46
internal/accept_test/test_data/nginx/templates/hpa.yaml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{{- if .Values.autoscaling.enabled }}
|
||||||
|
apiVersion: {{ include "common.capabilities.hpa.apiVersion" ( dict "context" $ ) }}
|
||||||
|
kind: HorizontalPodAutoscaler
|
||||||
|
metadata:
|
||||||
|
name: {{ template "common.names.fullname" . }}
|
||||||
|
namespace: {{ include "common.names.namespace" . | quote }}
|
||||||
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonLabels }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
scaleTargetRef:
|
||||||
|
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
|
||||||
|
kind: Deployment
|
||||||
|
name: {{ template "common.names.fullname" . }}
|
||||||
|
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
||||||
|
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
||||||
|
metrics:
|
||||||
|
{{- if .Values.autoscaling.targetMemory }}
|
||||||
|
- type: Resource
|
||||||
|
resource:
|
||||||
|
name: memory
|
||||||
|
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
|
||||||
|
targetAverageUtilization: {{ .Values.autoscaling.targetMemory }}
|
||||||
|
{{- else }}
|
||||||
|
target:
|
||||||
|
type: Utilization
|
||||||
|
averageUtilization: {{ .Values.autoscaling.targetMemory }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.autoscaling.targetCPU }}
|
||||||
|
- type: Resource
|
||||||
|
resource:
|
||||||
|
name: cpu
|
||||||
|
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
|
||||||
|
targetAverageUtilization: {{ .Values.autoscaling.targetCPU }}
|
||||||
|
{{- else }}
|
||||||
|
target:
|
||||||
|
type: Utilization
|
||||||
|
averageUtilization: {{ .Values.autoscaling.targetCPU }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
71
internal/accept_test/test_data/nginx/templates/ingress.yaml
Normal file
71
internal/accept_test/test_data/nginx/templates/ingress.yaml
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
{{- if .Values.ingress.enabled }}
|
||||||
|
apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: {{ include "common.names.fullname" . }}
|
||||||
|
namespace: {{ include "common.names.namespace" . | quote }}
|
||||||
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonLabels }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
annotations:
|
||||||
|
{{- if .Values.ingress.annotations }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" .Values.ingress.annotations "context" $) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if and .Values.ingress.ingressClassName (eq "true" (include "common.ingress.supportsIngressClassname" .)) }}
|
||||||
|
ingressClassName: {{ .Values.ingress.ingressClassName | quote }}
|
||||||
|
{{- end }}
|
||||||
|
rules:
|
||||||
|
{{- if .Values.ingress.hostname }}
|
||||||
|
- host: {{ .Values.ingress.hostname | quote }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
{{- if .Values.ingress.extraPaths }}
|
||||||
|
{{- toYaml .Values.ingress.extraPaths | nindent 10 }}
|
||||||
|
{{- end }}
|
||||||
|
- path: {{ .Values.ingress.path }}
|
||||||
|
{{- if eq "true" (include "common.ingress.supportsPathType" .) }}
|
||||||
|
pathType: {{ .Values.ingress.pathType }}
|
||||||
|
{{- end }}
|
||||||
|
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "common.names.fullname" .) "servicePort" "http" "context" $) | nindent 14 }}
|
||||||
|
{{- else if .Values.ingress.path }}
|
||||||
|
- http:
|
||||||
|
paths:
|
||||||
|
{{- if .Values.ingress.extraPaths }}
|
||||||
|
{{- toYaml .Values.ingress.extraPaths | nindent 10 }}
|
||||||
|
{{- end }}
|
||||||
|
- path: {{ .Values.ingress.path }}
|
||||||
|
{{- if eq "true" (include "common.ingress.supportsPathType" .) }}
|
||||||
|
pathType: {{ .Values.ingress.pathType }}
|
||||||
|
{{- end }}
|
||||||
|
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "common.names.fullname" .) "servicePort" "http" "context" $) | nindent 14 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range .Values.ingress.extraHosts }}
|
||||||
|
- host: {{ .name | quote }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: {{ default "/" .path }}
|
||||||
|
{{- if eq "true" (include "common.ingress.supportsPathType" $) }}
|
||||||
|
pathType: {{ default "ImplementationSpecific" .pathType }}
|
||||||
|
{{- end }}
|
||||||
|
backend: {{- include "common.ingress.backend" (dict "serviceName" (include "common.names.fullname" $) "servicePort" "http" "context" $) | nindent 14 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.ingress.extraRules }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" .Values.ingress.extraRules "context" $) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if or (and .Values.ingress.tls (or (include "common.ingress.certManagerRequest" ( dict "annotations" .Values.ingress.annotations )) .Values.ingress.selfSigned (not (empty .Values.ingress.secrets)))) .Values.ingress.extraTls }}
|
||||||
|
tls:
|
||||||
|
{{- if and .Values.ingress.tls (or (include "common.ingress.certManagerRequest" ( dict "annotations" .Values.ingress.annotations )) .Values.ingress.selfSigned (not (empty .Values.ingress.secrets))) }}
|
||||||
|
- hosts:
|
||||||
|
- {{ .Values.ingress.hostname | quote }}
|
||||||
|
secretName: {{ printf "%s-tls" .Values.ingress.hostname }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.ingress.extraTls }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" .Values.ingress.extraTls "context" $) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
23
internal/accept_test/test_data/nginx/templates/pdb.yaml
Normal file
23
internal/accept_test/test_data/nginx/templates/pdb.yaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{{- if .Values.pdb.create }}
|
||||||
|
apiVersion: {{ include "common.capabilities.policy.apiVersion" . }}
|
||||||
|
kind: PodDisruptionBudget
|
||||||
|
metadata:
|
||||||
|
name: {{ include "common.names.fullname" . }}
|
||||||
|
namespace: {{ include "common.names.namespace" . | quote }}
|
||||||
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonLabels }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if .Values.pdb.minAvailable }}
|
||||||
|
minAvailable: {{ .Values.pdb.minAvailable }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.pdb.maxUnavailable }}
|
||||||
|
maxUnavailable: {{ .Values.pdb.maxUnavailable }}
|
||||||
|
{{- end }}
|
||||||
|
selector:
|
||||||
|
matchLabels: {{ include "common.labels.matchLabels" . | nindent 6 }}
|
||||||
|
{{- end }}
|
@ -0,0 +1,23 @@
|
|||||||
|
{{- if and .Values.metrics.enabled .Values.metrics.prometheusRule.enabled }}
|
||||||
|
apiVersion: monitoring.coreos.com/v1
|
||||||
|
kind: PrometheusRule
|
||||||
|
metadata:
|
||||||
|
name: {{ include "common.names.fullname" . }}
|
||||||
|
namespace: {{ default (include "common.names.namespace" .) .Values.metrics.prometheusRule.namespace | quote }}
|
||||||
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
app.kubernetes.io/component: nginx
|
||||||
|
app.kubernetes.io/component: metrics
|
||||||
|
{{- if .Values.commonLabels }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.metrics.prometheusRule.additionalLabels }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.prometheusRule.additionalLabels "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
groups:
|
||||||
|
- name: {{ include "common.names.fullname" . }}
|
||||||
|
rules: {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.prometheusRule.rules "context" $ ) | nindent 6 }}
|
||||||
|
{{- end }}
|
@ -0,0 +1,17 @@
|
|||||||
|
{{- if and .Values.serverBlock (not .Values.existingServerBlockConfigmap) }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ template "common.names.fullname" . }}-server-block
|
||||||
|
namespace: {{ include "common.names.namespace" . | quote }}
|
||||||
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonLabels }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
data:
|
||||||
|
server-block.conf: |-
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.serverBlock "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
@ -0,0 +1,19 @@
|
|||||||
|
{{- if .Values.serviceAccount.create -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: {{ include "nginx.serviceAccountName" . }}
|
||||||
|
namespace: {{ include "common.names.namespace" . | quote }}
|
||||||
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonLabels }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
annotations:
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.serviceAccount.annotations }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" .Values.serviceAccount.annotations "context" $) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,45 @@
|
|||||||
|
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
|
||||||
|
apiVersion: monitoring.coreos.com/v1
|
||||||
|
kind: ServiceMonitor
|
||||||
|
metadata:
|
||||||
|
name: {{ template "common.names.fullname" . }}
|
||||||
|
namespace: {{ default (include "common.names.namespace" .) .Values.metrics.serviceMonitor.namespace | quote }}
|
||||||
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonLabels }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.metrics.serviceMonitor.labels }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.labels "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel | quote }}
|
||||||
|
selector:
|
||||||
|
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
|
||||||
|
{{- if .Values.metrics.serviceMonitor.selector }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.selector "context" $) | nindent 6 }}
|
||||||
|
{{- end }}
|
||||||
|
endpoints:
|
||||||
|
- port: metrics
|
||||||
|
path: /metrics
|
||||||
|
{{- if .Values.metrics.serviceMonitor.interval }}
|
||||||
|
interval: {{ .Values.metrics.serviceMonitor.interval }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
|
||||||
|
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.metrics.serviceMonitor.honorLabels }}
|
||||||
|
honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.metrics.serviceMonitor.relabelings }}
|
||||||
|
relabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.relabelings "context" $) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.metrics.serviceMonitor.metricRelabelings }}
|
||||||
|
metricRelabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.metricRelabelings "context" $) | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
namespaceSelector:
|
||||||
|
matchNames:
|
||||||
|
- {{ .Release.Namespace }}
|
||||||
|
{{- end }}
|
63
internal/accept_test/test_data/nginx/templates/svc.yaml
Normal file
63
internal/accept_test/test_data/nginx/templates/svc.yaml
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ template "common.names.fullname" . }}
|
||||||
|
namespace: {{ include "common.names.namespace" . | quote }}
|
||||||
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonLabels }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
annotations:
|
||||||
|
{{- if .Values.service.annotations }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.service.annotations "context" $) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and .Values.metrics.enabled .Values.metrics.service.annotations }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.service.annotations "context" $) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
type: {{ .Values.service.type }}
|
||||||
|
{{- if and .Values.service.clusterIP (eq .Values.service.type "ClusterIP") }}
|
||||||
|
clusterIP: {{ .Values.service.clusterIP }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.service.sessionAffinity }}
|
||||||
|
sessionAffinity: {{ .Values.service.sessionAffinity }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.service.sessionAffinityConfig }}
|
||||||
|
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.service.sessionAffinityConfig "context" $) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") }}
|
||||||
|
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerSourceRanges)) }}
|
||||||
|
loadBalancerSourceRanges: {{- toYaml .Values.service.loadBalancerSourceRanges | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP)) }}
|
||||||
|
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: {{ .Values.service.ports.http }}
|
||||||
|
targetPort: {{ .Values.service.targetPort.http }}
|
||||||
|
{{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.http)) }}
|
||||||
|
nodePort: {{ .Values.service.nodePorts.http }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.containerPorts.https }}
|
||||||
|
- name: https
|
||||||
|
port: {{ .Values.service.ports.https }}
|
||||||
|
targetPort: {{ .Values.service.targetPort.https }}
|
||||||
|
{{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.https)) }}
|
||||||
|
nodePort: {{ .Values.service.nodePorts.https }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.metrics.enabled }}
|
||||||
|
- name: metrics
|
||||||
|
port: {{ .Values.metrics.service.port }}
|
||||||
|
targetPort: metrics
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.service.extraPorts }}
|
||||||
|
{{- include "common.tplvalues.render" (dict "value" .Values.service.extraPorts "context" $) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
|
@ -0,0 +1,90 @@
|
|||||||
|
{{- if .Values.ingress.enabled }}
|
||||||
|
{{- if .Values.ingress.secrets }}
|
||||||
|
{{- range .Values.ingress.secrets }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ .name }}
|
||||||
|
namespace: {{ include "common.names.namespace" $ | quote }}
|
||||||
|
labels: {{- include "common.labels.standard" $ | nindent 4 }}
|
||||||
|
{{- if $.Values.commonLabels }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" $.Values.commonLabels "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if $.Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
type: kubernetes.io/tls
|
||||||
|
data:
|
||||||
|
tls.crt: {{ .certificate | b64enc }}
|
||||||
|
tls.key: {{ .key | b64enc }}
|
||||||
|
---
|
||||||
|
{{- end }}
|
||||||
|
{{- else if and .Values.ingress.tls .Values.ingress.selfSigned }}
|
||||||
|
{{- $secretName := printf "%s-tls" .Values.ingress.hostname }}
|
||||||
|
{{- $ca := genCA "nginx-ca" 365 }}
|
||||||
|
{{- $cert := genSignedCert .Values.ingress.hostname nil (list .Values.ingress.hostname) 365 $ca }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ $secretName }}
|
||||||
|
namespace: {{ include "common.names.namespace" . | quote }}
|
||||||
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonLabels }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
type: kubernetes.io/tls
|
||||||
|
data:
|
||||||
|
tls.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.crt" "defaultValue" $cert.Cert "context" $) }}
|
||||||
|
tls.key: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.key" "defaultValue" $cert.Key "context" $) }}
|
||||||
|
ca.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "ca.crt" "defaultValue" $ca.Cert "context" $) }}
|
||||||
|
---
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.healthIngress.enabled }}
|
||||||
|
{{- if .Values.healthIngress.secrets }}
|
||||||
|
{{- range .Values.healthIngress.secrets }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ .name }}
|
||||||
|
namespace: {{ include "common.names.namespace" $ | quote }}
|
||||||
|
labels: {{- include "common.labels.standard" $ | nindent 4 }}
|
||||||
|
{{- if $.Values.commonLabels }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" $.Values.commonLabels "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if $.Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
type: kubernetes.io/tls
|
||||||
|
data:
|
||||||
|
tls.crt: {{ .certificate | b64enc }}
|
||||||
|
tls.key: {{ .key | b64enc }}
|
||||||
|
---
|
||||||
|
{{- end }}
|
||||||
|
{{- else if and .Values.healthIngress.tls .Values.healthIngress.selfSigned }}
|
||||||
|
{{- $secretName := printf "%s-tls" .Values.healthIngress.hostname }}
|
||||||
|
{{- $ca := genCA "nginx-health-ca" 365 }}
|
||||||
|
{{- $cert := genSignedCert .Values.healthIngress.hostname nil (list .Values.healthIngress.hostname) 365 $ca }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ $secretName }}
|
||||||
|
namespace: {{ include "common.names.namespace" . | quote }}
|
||||||
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||||
|
{{- if .Values.commonLabels }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
type: kubernetes.io/tls
|
||||||
|
data:
|
||||||
|
tls.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.crt" "defaultValue" $cert.Cert "context" $) }}
|
||||||
|
tls.key: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.key" "defaultValue" $cert.Key "context" $) }}
|
||||||
|
ca.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "ca.crt" "defaultValue" $ca.Cert "context" $) }}
|
||||||
|
---
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
95
internal/accept_test/test_data/nginx/values.schema.json
Normal file
95
internal/accept_test/test_data/nginx/values.schema.json
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/schema#",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"ingress": {
|
||||||
|
"type": "object",
|
||||||
|
"form": true,
|
||||||
|
"title": "Ingress details",
|
||||||
|
"properties": {
|
||||||
|
"enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"form": true,
|
||||||
|
"title": "Use a custom hostname",
|
||||||
|
"description": "Enable the ingress resource that allows you to access the NGINX installation."
|
||||||
|
},
|
||||||
|
"hostname": {
|
||||||
|
"type": "string",
|
||||||
|
"form": true,
|
||||||
|
"title": "Hostname",
|
||||||
|
"hidden": {
|
||||||
|
"value": false,
|
||||||
|
"path": "ingress/enabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"service": {
|
||||||
|
"type": "object",
|
||||||
|
"form": true,
|
||||||
|
"title": "Service Configuration",
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"form": true,
|
||||||
|
"title": "Service Type",
|
||||||
|
"description": "Allowed values: \"ClusterIP\", \"NodePort\" and \"LoadBalancer\""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"replicaCount": {
|
||||||
|
"type": "integer",
|
||||||
|
"form": true,
|
||||||
|
"title": "Number of replicas",
|
||||||
|
"description": "Number of replicas to deploy"
|
||||||
|
},
|
||||||
|
"serverBlock": {
|
||||||
|
"type": "string",
|
||||||
|
"form": true,
|
||||||
|
"title": "Custom server block",
|
||||||
|
"description": "Custom server block to be added to NGINX configuration"
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"type": "object",
|
||||||
|
"form": true,
|
||||||
|
"title": "Prometheus metrics details",
|
||||||
|
"properties": {
|
||||||
|
"enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"title": "Create Prometheus metrics exporter",
|
||||||
|
"description": "Create a side-car container to expose Prometheus metrics",
|
||||||
|
"form": true
|
||||||
|
},
|
||||||
|
"serviceMonitor": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"title": "Create Prometheus Operator ServiceMonitor",
|
||||||
|
"description": "Create a ServiceMonitor to track metrics using Prometheus Operator",
|
||||||
|
"form": true,
|
||||||
|
"hidden": {
|
||||||
|
"value": false,
|
||||||
|
"path": "metrics/enabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pdb": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"create": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"minAvailable": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"maxUnavailable": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
6
shuttle.yaml
Normal file
6
shuttle.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
plan: false
|
||||||
|
vars:
|
||||||
|
service: dagger-helm
|
||||||
|
type: library
|
||||||
|
versioning: semantic
|
||||||
|
commits: conventional
|
@ -27,7 +27,12 @@ func WithPath(path string) OptsFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Format(ctx context.Context, optsFuncs ...OptsFunc) error {
|
func Format(ctx context.Context, optsFuncs ...OptsFunc) error {
|
||||||
opts := &Opts{}
|
opts := &Opts{
|
||||||
|
Path: ".",
|
||||||
|
IgnoredFiles: []string{
|
||||||
|
".shuttle/",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
for _, f := range optsFuncs {
|
for _, f := range optsFuncs {
|
||||||
err := f(ctx, opts)
|
err := f(ctx, opts)
|
||||||
|
Loading…
Reference in New Issue
Block a user