-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathapi.go
More file actions
66 lines (56 loc) · 2.17 KB
/
Copy pathapi.go
File metadata and controls
66 lines (56 loc) · 2.17 KB
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
package snc
import (
"fmt"
cr "github.com/redhat-developer/mapt/pkg/provider/api/compute-request"
spotTypes "github.com/redhat-developer/mapt/pkg/provider/api/spot"
"github.com/redhat-developer/mapt/pkg/util"
"golang.org/x/mod/semver"
)
var (
StackName = "stackOpenshiftSNC"
OCPSNCID = "snc"
consoleURLRegex = "https://console-openshift-console.apps.%s.nip.io"
OutputHost = "aosHost"
OutputUsername = "aosUsername"
OutputUserPrivateKey = "aosPrivatekey"
OutputKubeconfig = "aosKubeconfig"
OutputKubeAdminPass = "aosKubeAdminPasss"
OutputDeveloperPass = "aosDeveloperPass"
PortHTTPS = 443
PortAPI = 6443
)
var (
ClientKubeconfigPath = "/opt/crc/kubeconfig"
ContextAdminStarterVersion = "4.20.8"
contextAdmin = "admin"
contextSystemAdmin = "system:admin"
CommandKubeconfigExists = fmt.Sprintf("while [ ! -f %s ]; do sleep 5; done", ClientKubeconfigPath)
CommandCrcReadiness = "while [ ! -f /tmp/.crc-cluster-ready ]; do sleep 5; done"
commandCaServiceRan = "sudo bash -c 'until oc get node --kubeconfig /opt/kubeconfig --context %s || oc get node --kubeconfig /opt/crc/kubeconfig --context system:admin; do sleep 5; done'"
)
func CommandCaServiceRan(version string) string {
return fmt.Sprintf(commandCaServiceRan, util.If(semver.Compare(version, ContextAdminStarterVersion) < 0, contextSystemAdmin, contextAdmin))
}
type SNCArgs struct {
Prefix string
ComputeRequest *cr.ComputeRequestArgs
Version string
DisableClusterReadiness bool
Arch string
PullSecretFile string
Spot *spotTypes.SpotArgs
Timeout string
ServiceEndpoints []string
Profiles []string
OperatorChannels map[string]string
CatalogSources map[string]string
}
type SNCResults struct {
Username string `json:"username"`
PrivateKey string `json:"private_key"`
Host string `json:"host"`
Kubeconfig string `json:"kubeconfig"`
KubeadminPass string `json:"kubeadmin_pass"`
SpotPrice *float64 `json:"spot_price,omitempty"`
ConsoleUrl string `json:"console_url,omitempty"`
}