-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigFileGenerator.go
60 lines (46 loc) · 988 Bytes
/
configFileGenerator.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
package main
import (
"gopkg.in/yaml.v2"
)
type Image struct {
Repository string
Tag string
}
type Ingress struct {
Path string
}
type HelmValuesFile struct {
ReplicaCount int
FullnameOverride string
Image Image
Ingress Ingress
}
func CreateHelmValuesFile(service Service) []byte {
helmValuesFile := HelmValuesFile{
ReplicaCount: 1,
FullnameOverride: service.Name,
Image: Image{
Repository: service.ContainerRepository,
Tag: service.ImageTag,
},
Ingress: Ingress{
Path: "/" + service.GatewayEndpoint,
},
}
bytes, err := yaml.Marshal(helmValuesFile)
PanicIfError(err)
return bytes
}
type ArgoAppValuesFile struct {
Name string
GatewayEndpoint string
}
func CreateArgoAppFile(service Service) []byte {
argoAppValuesFile := ArgoAppValuesFile{
Name: service.Name,
GatewayEndpoint: service.GatewayEndpoint,
}
bytes, err := yaml.Marshal(argoAppValuesFile)
PanicIfError(err)
return bytes
}