Skip to content

Commit

Permalink
fix: auth
Browse files Browse the repository at this point in the history
  • Loading branch information
acid-chicken committed May 22, 2024
1 parent 8117b75 commit 16e0325
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/hariko/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
apiVersion: v2
name: hariko
version: 0.1.
version: 0.3.
2 changes: 1 addition & 1 deletion charts/misskey/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
apiVersion: v2
name: misskey
version: 0.1.
version: 0.3.
9 changes: 8 additions & 1 deletion hariko/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ func Execute() {
}

func deploy(namespace string, packageName string, repositoryName string, repositoryURL string, log io.Writer) error {
os.Setenv("HELM_DRIVER", "configmap")
os.Setenv("HELM_KUBEAPISERVER", "https://kubernetes.default.svc")
os.Setenv("HELM_KUBECAFILE", "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt")
token, err := os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/token")
if err != nil {
return err
}
os.Setenv("HELM_KUBETOKEN", string(token))
if err := run(exec.Command("helm", "repo", "add", "-n", namespace, repositoryName, repositoryURL), log); err != nil {
return err
}
Expand All @@ -171,7 +179,6 @@ func deploy(namespace string, packageName string, repositoryName string, reposit
}

func run(cmd *exec.Cmd, log io.Writer) error {
cmd.Env = append(cmd.Env, "HELM_DRIVER=configmap")
cmd.Stdout = log
cmd.Stderr = log
return cmd.Run()
Expand Down

0 comments on commit 16e0325

Please sign in to comment.