Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into cluster-api-simple-test
Browse files Browse the repository at this point in the history
  • Loading branch information
maciaszczykm committed Sep 26, 2023
2 parents 136692b + 4bd34b5 commit bce51b9
Show file tree
Hide file tree
Showing 9 changed files with 241 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/goreleaser-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ jobs:
run: "packer init ./packer/"
- name: Run `packer validate`
id: validate
env:
PKR_VAR_k8s_cli_version: ${{ github.ref_name}}
run: "packer validate ./packer/"
- name: Run `packer build`
id: build
Expand Down
1 change: 1 addition & 0 deletions cmd/plural/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ func (p *Plural) doBuild(installation *api.Installation, force bool) error {

workspace.PrintLinks()

appReadme(repoName, false) // nolint:errcheck
return err
}

Expand Down
3 changes: 2 additions & 1 deletion cmd/plural/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func handleHelmTemplate(c *cli.Context) error {
_ = os.Remove(name)
}(f.Name())

name := "default"
namespace := "default"
actionConfig, err := helm.GetActionConfig(namespace)
if err != nil {
Expand All @@ -112,7 +113,7 @@ func handleHelmTemplate(c *cli.Context) error {
if err != nil {
return err
}
res, err := helm.Template(actionConfig, c.Args().Get(0), namespace, "./", false, false, values)
res, err := helm.Template(actionConfig, name, namespace, c.Args().Get(0), false, false, values)
if err != nil {
return err
}
Expand Down
24 changes: 24 additions & 0 deletions cmd/plural/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import (

"github.com/pluralsh/plural/pkg/helm"
"github.com/pluralsh/plural/pkg/provider"
"github.com/pluralsh/plural/pkg/scaffold"
"github.com/pluralsh/plural/pkg/utils"
"github.com/pluralsh/plural/pkg/utils/git"
"github.com/pluralsh/plural/pkg/wkspace"
)

Expand All @@ -21,6 +23,18 @@ func (p *Plural) workspaceCommands() []cli.Command {
Usage: "generates kubernetes credentials for this subworkspace",
Action: latestVersion(kubeInit),
},
{
Name: "readme",
Usage: "generate chart readme for an app",
ArgsUsage: "NAME",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "dry-run",
Usage: "output to stdout instead of to a file",
},
},
Action: latestVersion(func(c *cli.Context) error { return appReadme(c.Args().Get(0), c.Bool("dry-run")) }),
},
{
Name: "helm",
Usage: "upgrade/installs the helm chart for this subworkspace",
Expand Down Expand Up @@ -204,3 +218,13 @@ func (p *Plural) mapkubeapis(c *cli.Context) error {

return minimal.MapKubeApis()
}

func appReadme(name string, dryRun bool) error {
repoRoot, err := git.Root()
if err != nil {
return err
}

dir := filepath.Join(repoRoot, name, "helm", name)
return scaffold.Readme(dir, dryRun)
}
16 changes: 9 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ require (
github.com/briandowns/spinner v1.23.0
github.com/buger/goterm v1.0.4
github.com/cert-manager/cert-manager v1.10.0
github.com/charmbracelet/bubbles v0.13.0
github.com/charmbracelet/bubbletea v0.21.0
github.com/charmbracelet/lipgloss v0.5.0
github.com/chartmuseum/helm-push v0.10.3
github.com/coreos/go-semver v0.3.0
github.com/databus23/helm-diff/v3 v3.6.0
Expand All @@ -51,7 +48,7 @@ require (
github.com/mikesmitty/edkey v0.0.0-20170222072505-3356ea4e686a
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/mapstructure v1.5.0
github.com/muesli/reflow v0.3.0
github.com/norwoodj/helm-docs v1.11.2
github.com/olekukonko/tablewriter v0.0.5
github.com/packethost/packngo v0.29.0
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
Expand All @@ -64,6 +61,7 @@ require (
github.com/rivo/tview v0.0.0-20230615085408-bb9595ee0f4d
github.com/rodaine/hclencoder v0.0.1
github.com/samber/lo v1.38.1
github.com/spf13/viper v1.15.0
github.com/thoas/go-funk v0.9.2
github.com/urfave/cli v1.22.14
github.com/wailsapp/wails/v2 v2.4.1
Expand Down Expand Up @@ -143,6 +141,9 @@ require (
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect
github.com/charmbracelet/bubbles v0.13.0 // indirect
github.com/charmbracelet/bubbletea v0.21.0 // indirect
github.com/charmbracelet/lipgloss v0.5.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/cjlapao/common-go v0.0.39 // indirect
github.com/cloudflare/cfssl v1.6.3 // indirect
Expand Down Expand Up @@ -212,6 +213,7 @@ require (
github.com/miekg/dns v1.1.50 // indirect
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.15.1 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 // indirect
Expand All @@ -227,7 +229,6 @@ require (
github.com/soheilhy/cmux v0.1.5 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.15.0 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
Expand Down Expand Up @@ -379,7 +380,7 @@ require (
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-ieproxy v0.0.1 // indirect
github.com/mattn/go-isatty v0.0.19
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
Expand Down Expand Up @@ -412,7 +413,7 @@ require (
github.com/schollz/progressbar/v3 v3.8.6 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cobra v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
Expand Down Expand Up @@ -456,6 +457,7 @@ require (
)

replace (
github.com/norwoodj/helm-docs v1.11.2 => github.com/pluralsh/helm-docs v1.11.3-0.20230914190909-3fe18acd95d7
go.etcd.io/etcd/pkg/v3 => go.etcd.io/etcd/pkg/v3 v3.5.0-alpha.0
k8s.io/cli-runtime => k8s.io/cli-runtime v0.26.3
k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20230109183929-3758b55a6596
Expand Down
5 changes: 5 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYr
github.com/Masterminds/sprig v2.15.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
github.com/Masterminds/sprig/v3 v3.2.1/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk=
github.com/Masterminds/sprig/v3 v3.2.2/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk=
github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA=
github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM=
github.com/Masterminds/squirrel v1.5.3 h1:YPpoceAcxuzIljlr5iWpNKaql7hLeG1KLSrhvdHpkZc=
Expand Down Expand Up @@ -1392,6 +1393,8 @@ github.com/pluralsh/controller-reconcile-helper v0.0.4 h1:1o+7qYSyoeqKFjx+WgQTxD
github.com/pluralsh/controller-reconcile-helper v0.0.4/go.mod h1:AfY0gtteD6veBjmB6jiRx/aR4yevEf6K0M13/pGan/s=
github.com/pluralsh/gqlclient v1.10.0 h1:ccYB+A0JbPYkEeVzdfajd29l65N6x/buSKPMMxM8OIA=
github.com/pluralsh/gqlclient v1.10.0/go.mod h1:qSXKUlio1F2DRPy8el4oFYsmpKbkUYspgPB87T4it5I=
github.com/pluralsh/helm-docs v1.11.3-0.20230914190909-3fe18acd95d7 h1:tfxqRM5zNBXvKXt7TMN4z8PuNUpZ0TbaFT0WUeXSlPY=
github.com/pluralsh/helm-docs v1.11.3-0.20230914190909-3fe18acd95d7/go.mod h1:rLqec59NO7YF57Rq9VlubQHMp7wcRTJhzpkcgs4lOG4=
github.com/pluralsh/oauth v0.9.2 h1:tM9hBK4tCnJUeCOgX0ctxBBCS3hiCDPoxkJLODtedmQ=
github.com/pluralsh/oauth v0.9.2/go.mod h1:aTUw/75rzcsbvW+/TLvWtHVDXFIdtFrDtUncOq9vHyM=
github.com/pluralsh/plural-operator v0.5.5 h1:57GxniNjUa3hpHgvFr9oDonFgvDUC8XDD5B0e7Xduzk=
Expand Down Expand Up @@ -2127,6 +2130,7 @@ golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220209214540-3681064d5158/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-20220330033206-e17cdc41300f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down Expand Up @@ -2520,6 +2524,7 @@ k8s.io/component-base v0.26.1 h1:4ahudpeQXHZL5kko+iDHqLj/FSGAEUnSVO0EBbgDd+4=
k8s.io/component-base v0.26.1/go.mod h1:VHrLR0b58oC035w6YQiBSbtsf0ThuSwXP+p5dD/kAWU=
k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
k8s.io/helm v2.14.3+incompatible/go.mod h1:LZzlS4LQBHfciFOurYBFkCMTaZ0D1l+p0teMg7TSULI=
k8s.io/helm v2.17.0+incompatible h1:Bpn6o1wKLYqKM3+Osh8e+1/K2g/GsQJ4F4yNF2+deao=
k8s.io/helm v2.17.0+incompatible/go.mod h1:LZzlS4LQBHfciFOurYBFkCMTaZ0D1l+p0teMg7TSULI=
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
Expand Down
9 changes: 8 additions & 1 deletion pkg/scaffold/creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/pluralsh/plural/pkg/api"
"github.com/pluralsh/plural/pkg/utils"
"github.com/pluralsh/plural/pkg/utils/pathing"
"helm.sh/helm/v3/pkg/chartutil"
)

var categories = []string{
Expand Down Expand Up @@ -77,7 +78,7 @@ func ApplicationScaffold(client api.Client) error {
return err
}

if err := utils.Exec("helm", "create", app); err != nil {
if err := createHelm(app); err != nil {
return err
}

Expand All @@ -93,3 +94,9 @@ func ApplicationScaffold(client api.Client) error {

return nil
}

func createHelm(name string) error {
chartname := filepath.Base(name)
_, err := chartutil.Create(chartname, filepath.Dir(name))
return err
}
Loading

0 comments on commit bce51b9

Please sign in to comment.