This repository has been archived by the owner on Jun 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
grid.go
56 lines (45 loc) · 1.53 KB
/
grid.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
package types
import (
"crypto/md5"
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type Grid struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec GridSpec `json:"spec"`
}
type GridSpec struct {
Clusters []*ClusterSpec `json:"clusters"`
Logger LoggerSpec `json:"logger"`
}
type ClusterSpec struct {
EKS *EKSSpec `json:"eks,omitempty"`
}
type EKSSpec struct {
ExistingCluster *EKSExistingClusterSpec `json:"existingCluster,omitempty"`
NewCluster *EKSNewClusterSpec `json:"newCluster,omitempty"`
}
type EKSExistingClusterSpec struct {
AccessKeyID ValueOrValueFrom `json:"accessKeyId"`
SecretAccessKey ValueOrValueFrom `json:"secretAccessKey"`
ClusterName string `json:"clusterName"`
Region string `json:"region"`
}
type EKSNewClusterSpec struct {
Description string `json:"description,omitempty"`
Version string `json:"version,omitempty"`
AccessKeyID ValueOrValueFrom `json:"accessKeyId"`
SecretAccessKey ValueOrValueFrom `json:"secretAccessKey"`
Region string `json:"region"`
}
type LoggerSpec struct {
Slack *SlackLoggerSpec `json:"slack,omitempty"`
}
type SlackLoggerSpec struct {
Token ValueOrValueFrom `json:"token,omitempty"`
Channel ValueOrValueFrom `json:"channel,omitempty"`
}
func (c EKSNewClusterSpec) GetDeterministicClusterName() string {
return fmt.Sprintf("grid-%x", md5.Sum([]byte(fmt.Sprintf("%s-%s-%s", c.Description, c.Region, c.Version))))
}