/
argocd_app.go
85 lines (65 loc) · 2.09 KB
/
argocd_app.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// Copyright (c) arkade author(s) 2022. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
package apps
import (
"fmt"
"strings"
"github.com/alexellis/arkade/pkg/config"
"github.com/alexellis/arkade/pkg/k8s"
"github.com/alexellis/arkade/pkg"
"github.com/spf13/cobra"
)
func MakeInstallArgoCD() *cobra.Command {
var command = &cobra.Command{
Use: "argocd",
Short: "Install argocd",
Long: `Install argocd`,
Example: ` arkade install argocd`,
SilenceUsage: true,
}
command.RunE = func(command *cobra.Command, args []string) error {
kubeConfigPath, _ := command.Flags().GetString("kubeconfig")
if err := config.SetKubeconfig(kubeConfigPath); err != nil {
return err
}
arch := k8s.GetNodeArchitecture()
fmt.Printf("Node architecture: %q\n", arch)
_, err := k8s.KubectlTask("create", "ns",
"argocd")
if err != nil {
if !strings.Contains(err.Error(), "exists") {
return err
}
}
_, err = k8s.KubectlTask("apply", "-f",
"https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml", "-n", "argocd")
if err != nil {
return err
}
fmt.Println(ArgoCDInfoMsgInstallMsg)
return nil
}
return command
}
const ArgoCDInfoMsg = `
# Get the ArgoCD CLI
arkade install argocd
# Port-forward the ArgoCD API server
kubectl port-forward svc/argocd-server -n argocd 8443:443 &
# Get the password
PASS=$(kubectl get secret argocd-initial-admin-secret \
-n argocd \
-o jsonpath="{.data.password}" | base64 -d)
echo $PASS
# Or log in:
argocd login --name local 127.0.0.1:8443 --insecure \
--username admin \
--password $PASS
# Open the UI:
https://127.0.0.1:8443
# Get started with ArgoCD at
# https://argoproj.github.io/argo-cd/#quick-start`
const ArgoCDInfoMsgInstallMsg = `=======================================================================
= ArgoCD has been installed =
=======================================================================` +
"\n\n" + ArgoCDInfoMsg + "\n\n" + pkg.SupportMessageShort