Skip to content

Commit

Permalink
feat(cmd/scripts/kubernetes/install_hello_world): Add flag text for T…
Browse files Browse the repository at this point in the history
…EXT value in hello-world chart
  • Loading branch information
ondrejsika committed Apr 27, 2023
1 parent 9912a96 commit 672591c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ var FlagDry bool
var FlagHost string
var FlagNamespace string
var FlagReplicas int
var FlagText string

var Cmd = &cobra.Command{
Use: "install-hello-world",
Short: "Install sikalabs/hello-world (hello-world-server)",
Aliases: []string{"ihw"},
Args: cobra.NoArgs,
Run: func(c *cobra.Command, args []string) {
k8s_scripts.InstallHelloWorld(FlagHost, FlagReplicas, FlagNamespace, FlagDry)
k8s_scripts.InstallHelloWorld(FlagHost, FlagReplicas, FlagText, FlagNamespace, FlagDry)
},
}

Expand Down Expand Up @@ -49,4 +50,11 @@ func init() {
1,
"Nuber of replicas / pods",
)
Cmd.Flags().StringVarP(
&FlagText,
"text",
"t",
"",
"Text to display",
)
}
6 changes: 5 additions & 1 deletion utils/k8s_scripts/k8s_scripts_hello_world.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ package k8s_scripts

import "strconv"

func InstallHelloWorld(host string, replicas int, namespace string, dry bool) {
func InstallHelloWorld(host string, replicas int, text string, namespace string, dry bool) {
if text != "" {
text = `"` + text + `"`
}
sh(`helm upgrade --install \
hello-world hello-world \
--repo https://helm.sikalabs.io \
--create-namespace \
--namespace `+namespace+` \
--set host=`+host+` \
--set replicas=`+strconv.Itoa(replicas)+` \
--set TEXT=`+text+` \
--wait`, dry)
}

0 comments on commit 672591c

Please sign in to comment.