-
Notifications
You must be signed in to change notification settings - Fork 168
/
const.go
126 lines (106 loc) · 5.14 KB
/
const.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package common
import (
"fmt"
"time"
)
// ContainerState represents container state.
type ContainerState string
const (
// ResyncPeriod defines resync period for controllers
ResyncPeriod = time.Minute * 5
// EnvStagePodName is an environment which represents pod name.
EnvStagePodName = "POD_NAME"
// EnvStageInfo is an environment which represents stage information.
EnvStageInfo = "STAGE_INFO"
// EnvWorkflowRunInfo is an environment which represents workflowrun information.
EnvWorkflowRunInfo = "WORKFLOWRUN_INFO"
// EnvOutputResourcesInfo is an environment which represents output resources information.
EnvOutputResourcesInfo = "OUTPUT_RESOURCES_INFO"
// EnvWorkflowrunName is an environment which represents workflowrun name.
EnvWorkflowrunName = "WORKFLOWRUN_NAME"
// EnvStageName is an environment which represents stage name.
EnvStageName = "STAGE_NAME"
// EnvWorkloadContainerName is an environment which represents the workload container name.
EnvWorkloadContainerName = "WORKLOAD_CONTAINER_NAME"
// EnvNamespace is an environment which represents namespace.
EnvNamespace = "NAMESPACE"
// EnvCycloneServerAddr is an environment which represents cyclone server address.
EnvCycloneServerAddr = "CYCLONE_SERVER_ADDR"
// DefaultCycloneServerAddr defines default Cyclone Server address
DefaultCycloneServerAddr = "cyclone-server"
// CycloneSidecarPrefix defines container name prefixes for sidecar. There are two kinds of
// sidecars in workflow:
// - Those added automatically by Cyclone such as coordinator, resource resolvers.
// - Those specified by users in stage spec as workload.
CycloneSidecarPrefix = "csc-"
// WorkloadSidecarPrefix defines workload sidecar container name prefix.
WorkloadSidecarPrefix = "wsc-"
// CoordinatorSidecarName defines name of coordinator container.
CoordinatorSidecarName = CycloneSidecarPrefix + "co"
// DockerInDockerSidecarName defines name of docker in docker container.
DockerInDockerSidecarName = CycloneSidecarPrefix + "dind"
// ResolverDefaultWorkspacePath is workspace path in resource resolver containers.
// Following files or directories will be in this workspace.
// - ${WORKFLOWRUN_NAME}-pulling.lock File lock determine which stage to pull the resource
// - notify Directory contains notify file indicating readiness of output resource data.
// - data Directory contains the data of the resource. For example, source code.
ResolverDefaultWorkspacePath = "/workspace"
// ResolverDefaultDataPath is data path in resource resolver containers.
ResolverDefaultDataPath = "/workspace/data"
// ResolverNotifyDir is name of the notify directory where coordinator would create ok file there.
ResolverNotifyDir = "notify"
// ResolverNotifyDirPath is notify directory path in resource resolver container.
ResolverNotifyDirPath = "/workspace/notify"
// ResourcePullCommand indicates pull resource
ResourcePullCommand = "pull"
// ResourcePushCommand indicates push resource
ResourcePushCommand = "push"
// CoordinatorResolverPath ...
CoordinatorResolverPath = "/workspace/resolvers"
// CoordinatorResourcesPath ...
CoordinatorResourcesPath = "/workspace/resolvers/resources"
// CoordinatorResolverNotifyPath ...
CoordinatorResolverNotifyPath = "/workspace/resolvers/notify"
// CoordinatorResolverNotifyOkPath ...
CoordinatorResolverNotifyOkPath = "/workspace/resolvers/notify/ok"
// CoordinatorArtifactsPath ...
CoordinatorArtifactsPath = "/workspace/artifacts"
// DefaultPvVolumeName is name of the default PV used by all workflow stages.
DefaultPvVolumeName = "default-pv"
// CoordinatorSidecarVolumeName is name of the emptyDir volume shared between coordinator and
// sidecar containers, e.g. image resolvers. Coordinator would notify resolvers that workload
// containers have finished their work, so that resource resolvers can push resources.
CoordinatorSidecarVolumeName = "coordinator-sidecar-volume"
// DockerInDockerSockVolume is volume used for docker-in-docker to share it's sock file with other containers.
DockerInDockerSockVolume = "docker-dind-sock"
// DockerConfigJSONVolume is volume for config.json in secret.
DockerConfigJSONVolume = "cyclone-docker-secret-volume"
// DockerSockPath is path of docker socket file in container
DockerSockPath = "/var/run"
// DockerConfigPath is path of docker config
DockerConfigPath = "/root/.docker"
// DockerConfigJSONFile is name of docker config file
DockerConfigJSONFile = "config.json"
// ContainerStateTerminated represents container is stopped.
ContainerStateTerminated ContainerState = "Terminated"
// ContainerStateInitialized represents container is Running or Stopped, not Init or Creating.
ContainerStateInitialized ContainerState = "Initialized"
)
const (
// GCContainerName is name of GC container
GCContainerName = "gc"
// GCDataPath is parent folder holding data to be cleaned by GC pod
GCDataPath = "/workspace"
)
// InputResourceVolumeName ...
func InputResourceVolumeName(name string) string {
return "input-" + name
}
// OutputResourceVolumeName ...
func OutputResourceVolumeName(name string) string {
return "output-" + name
}
// PresetVolumeName ...
func PresetVolumeName(index int) string {
return fmt.Sprintf("preset-%d", index)
}