-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
169 lines (137 loc) · 7.28 KB
/
config.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
package config
import (
apiv1 "k8s.io/api/core/v1"
wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1"
"github.com/argoproj/argo/workflow/metrics"
)
// WorkflowControllerConfig contain the configuration settings for the workflow controller
type WorkflowControllerConfig struct {
// ExecutorImage is the image name of the executor to use when running pods
// DEPRECATED: use --executor-image flag to workflow-controller instead
ExecutorImage string `json:"executorImage,omitempty"`
// ExecutorImagePullPolicy is the imagePullPolicy of the executor to use when running pods
// DEPRECATED: use `executor.imagePullPolicy` in configmap instead
ExecutorImagePullPolicy string `json:"executorImagePullPolicy,omitempty"`
// Executor holds container customizations for the executor to use when running pods
Executor *apiv1.Container `json:"executor,omitempty"`
// ExecutorResources specifies the resource requirements that will be used for the executor sidecar
// DEPRECATED: use `executor.resources` in configmap instead
ExecutorResources *apiv1.ResourceRequirements `json:"executorResources,omitempty"`
// KubeConfig specifies a kube config file for the wait & init containers
KubeConfig *KubeConfig `json:"kubeConfig,omitempty"`
// ContainerRuntimeExecutor specifies the container runtime interface to use, default is docker
ContainerRuntimeExecutor string `json:"containerRuntimeExecutor,omitempty"`
// KubeletPort is needed when using the kubelet containerRuntimeExecutor, default to 10250
KubeletPort int `json:"kubeletPort,omitempty"`
// KubeletInsecure disable the TLS verification of the kubelet containerRuntimeExecutor, default to false
KubeletInsecure bool `json:"kubeletInsecure,omitempty"`
// ArtifactRepository contains the default location of an artifact repository for container artifacts
ArtifactRepository ArtifactRepository `json:"artifactRepository,omitempty"`
// Namespace is a label selector filter to limit the controller's watch to a specific namespace
// DEPRECATED: support will be remove in a future release
Namespace string `json:"namespace,omitempty"`
// InstanceID is a label selector to limit the controller's watch to a specific instance. It
// contains an arbitrary value that is carried forward into its pod labels, under the key
// workflows.argoproj.io/controller-instanceid, for the purposes of workflow segregation. This
// enables a controller to only receive workflow and pod events that it is interested about,
// in order to support multiple controllers in a single cluster, and ultimately allows the
// controller itself to be bundled as part of a higher level application. If omitted, the
// controller watches workflows and pods that *are not* labeled with an instance id.
InstanceID string `json:"instanceID,omitempty"`
MetricsConfig metrics.PrometheusConfig `json:"metricsConfig,omitempty"`
TelemetryConfig metrics.PrometheusConfig `json:"telemetryConfig,omitempty"`
// Parallelism limits the max total parallel workflows that can execute at the same time
Parallelism int `json:"parallelism,omitempty"`
// Persistence contains the workflow persistence DB configuration
Persistence *PersistConfig `json:"persistence,omitempty"`
// Config customized Docker Sock path
DockerSockPath string `json:"dockerSockPath,omitempty"`
}
// KubeConfig is used for wait & init sidecar containers to communicate with a k8s apiserver by a outofcluster method,
// it is used when the workflow controller is in a different cluster with the workflow workloads
type KubeConfig struct {
// SecretName of the kubeconfig secret
// may not be empty if kuebConfig specified
SecretName string `json:"secretName"`
// SecretKey of the kubeconfig in the secret
// may not be empty if kubeConfig specified
SecretKey string `json:"secretKey"`
// VolumeName of kubeconfig, default to 'kubeconfig'
VolumeName string `json:"volumeName,omitempty"`
// MountPath of the kubeconfig secret, default to '/kube/config'
MountPath string `json:"mountPath,omitempty"`
}
// ArtifactRepository represents a artifact repository in which a controller will store its artifacts
type ArtifactRepository struct {
// ArchiveLogs enables log archiving
ArchiveLogs *bool `json:"archiveLogs,omitempty"`
// S3 stores artifact in a S3-compliant object store
S3 *S3ArtifactRepository `json:"s3,omitempty"`
// Artifactory stores artifacts to JFrog Artifactory
Artifactory *ArtifactoryArtifactRepository `json:"artifactory,omitempty"`
// HDFS stores artifacts in HDFS
HDFS *HDFSArtifactRepository `json:"hdfs,omitempty"`
}
func (a *ArtifactRepository) IsArchiveLogs() bool {
return a != nil && a.ArchiveLogs != nil && *a.ArchiveLogs
}
type PersistConfig struct {
NodeStatusOffload bool `json:"nodeStatusOffLoad,omitempty"`
// Archive workflows to persistence.
Archive bool `json:"archive,omitempty"`
ClusterName string `json:"clusterName,omitempty"`
ConnectionPool *ConnectionPool `json:"connectionPool"`
PostgreSQL *PostgreSQLConfig `json:"postgresql,omitempty"`
MySQL *MySQLConfig `json:"mysql,omitempty"`
}
func (c PersistConfig) GetClusterName() string {
if c.ClusterName != "" {
return c.ClusterName
}
return "default"
}
type ConnectionPool struct {
MaxIdleConns int `json:"maxIdleConns"`
MaxOpenConns int `json:"maxOpenConns"`
}
type PostgreSQLConfig struct {
Host string `json:"host"`
Port string `json:"port"`
Database string `json:"database"`
TableName string `json:"tableName"`
UsernameSecret apiv1.SecretKeySelector `json:"userNameSecret"`
PasswordSecret apiv1.SecretKeySelector `json:"passwordSecret"`
SSL bool `json:"ssl,omitempty"`
}
type MySQLConfig struct {
Host string `json:"host"`
Port string `json:"port"`
Database string `json:"database"`
TableName string `json:"tableName"`
Options map[string]string `json:"options"`
UsernameSecret apiv1.SecretKeySelector `json:"userNameSecret"`
PasswordSecret apiv1.SecretKeySelector `json:"passwordSecret"`
}
// S3ArtifactRepository defines the controller configuration for an S3 artifact repository
type S3ArtifactRepository struct {
wfv1.S3Bucket `json:",inline"`
// KeyFormat is defines the format of how to store keys. Can reference workflow variables
KeyFormat string `json:"keyFormat,omitempty"`
// KeyPrefix is prefix used as part of the bucket key in which the controller will store artifacts.
// DEPRECATED. Use KeyFormat instead
KeyPrefix string `json:"keyPrefix,omitempty"`
}
// ArtifactoryArtifactRepository defines the controller configuration for an artifactory artifact repository
type ArtifactoryArtifactRepository struct {
wfv1.ArtifactoryAuth `json:",inline"`
// RepoURL is the url for artifactory repo.
RepoURL string `json:"repoURL,omitempty"`
}
// HDFSArtifactRepository defines the controller configuration for an HDFS artifact repository
type HDFSArtifactRepository struct {
wfv1.HDFSConfig `json:",inline"`
// PathFormat is defines the format of path to store a file. Can reference workflow variables
PathFormat string `json:"pathFormat,omitempty"`
// Force copies a file forcibly even if it exists (default: false)
Force bool `json:"force,omitempty"`
}