-
Notifications
You must be signed in to change notification settings - Fork 11
/
deploy.go
47 lines (36 loc) · 1.28 KB
/
deploy.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
package internal
import (
"github.com/agoda-com/samsahai/api/v1beta1"
)
type DeployEngine interface {
// GetName returns name of deploy engine
GetName() string
// GetValues returns yaml values of release deployment
GetValues() (map[string][]byte, error)
// Create creates environment
Create(refName string, comp *v1beta1.Component, parentComp *v1beta1.Component, values map[string]interface{}) error
// Delete deletes environment
Delete(refName string) error
// ForceDelete deletes environment when timeout
ForceDelete(refName string) error
// IsReady checks the environment is ready to use or not
IsReady(queue *v1beta1.Queue) (bool, error)
// GetLabelSelector returns map of label for select the components that created by the engine
GetLabelSelectors(refName string) map[string]string
// IsMocked uses for skip some functions due to mock deploy
//
// Skipped function: WaitForComponentsCleaned
IsMocked() bool
}
const (
MaxReleaseNameLength = 53
)
// GenReleaseName returns the release name for deploying components
func GenReleaseName(namespace, compName string) string {
refName := namespace + "-" + compName
if len(refName) > MaxReleaseNameLength {
// component name is more important than team name
return refName[len(refName)-MaxReleaseNameLength:]
}
return refName
}