github.com/argoproj-labs/argocd-operator@v0.10.0/api/v1beta1/argocd_types.go (about) 1 /* 2 Copyright 2021. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package v1beta1 18 19 import ( 20 "strings" 21 22 routev1 "github.com/openshift/api/route/v1" 23 24 "github.com/argoproj-labs/argocd-operator/common" 25 26 autoscaling "k8s.io/api/autoscaling/v1" 27 corev1 "k8s.io/api/core/v1" 28 networkingv1 "k8s.io/api/networking/v1" 29 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 30 ) 31 32 func init() { 33 SchemeBuilder.Register(&ArgoCD{}, &ArgoCDList{}) 34 } 35 36 // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. 37 // Important: Run "make" to regenerate code after modifying this file 38 39 // +kubebuilder:storageversion 40 // +kubebuilder:object:root=true 41 42 // ArgoCD is the Schema for the argocds API 43 // +k8s:openapi-gen=true 44 // +kubebuilder:subresource:status 45 // +operator-sdk:csv:customresourcedefinitions:resources={{ArgoCD,v1beta1,""}} 46 // +operator-sdk:csv:customresourcedefinitions:resources={{ArgoCDExport,v1alpha1,""}} 47 // +operator-sdk:csv:customresourcedefinitions:resources={{ConfigMap,v1,""}} 48 // +operator-sdk:csv:customresourcedefinitions:resources={{CronJob,v1,""}} 49 // +operator-sdk:csv:customresourcedefinitions:resources={{Deployment,v1,""}} 50 // +operator-sdk:csv:customresourcedefinitions:resources={{Ingress,v1,""}} 51 // +operator-sdk:csv:customresourcedefinitions:resources={{Job,v1,""}} 52 // +operator-sdk:csv:customresourcedefinitions:resources={{PersistentVolumeClaim,v1,""}} 53 // +operator-sdk:csv:customresourcedefinitions:resources={{Pod,v1,""}} 54 // +operator-sdk:csv:customresourcedefinitions:resources={{Prometheus,v1,""}} 55 // +operator-sdk:csv:customresourcedefinitions:resources={{ReplicaSet,v1,""}} 56 // +operator-sdk:csv:customresourcedefinitions:resources={{Route,v1,""}} 57 // +operator-sdk:csv:customresourcedefinitions:resources={{Secret,v1,""}} 58 // +operator-sdk:csv:customresourcedefinitions:resources={{Service,v1,""}} 59 // +operator-sdk:csv:customresourcedefinitions:resources={{ServiceMonitor,v1,""}} 60 // +operator-sdk:csv:customresourcedefinitions:resources={{StatefulSet,v1,""}} 61 type ArgoCD struct { 62 metav1.TypeMeta `json:",inline"` 63 metav1.ObjectMeta `json:"metadata,omitempty"` 64 65 Spec ArgoCDSpec `json:"spec,omitempty"` 66 Status ArgoCDStatus `json:"status,omitempty"` 67 } 68 69 // ArgoCDApplicationControllerProcessorsSpec defines the options for the ArgoCD Application Controller processors. 70 type ArgoCDApplicationControllerProcessorsSpec struct { 71 // Operation is the number of application operation processors. 72 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Operation Processor Count'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Controller","urn:alm:descriptor:com.tectonic.ui:number"} 73 Operation int32 `json:"operation,omitempty"` 74 75 // Status is the number of application status processors. 76 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Status Processor Count'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Controller","urn:alm:descriptor:com.tectonic.ui:number"} 77 Status int32 `json:"status,omitempty"` 78 } 79 80 // ArgoCDApplicationControllerSpec defines the options for the ArgoCD Application Controller component. 81 type ArgoCDApplicationControllerSpec struct { 82 // Processors contains the options for the Application Controller processors. 83 Processors ArgoCDApplicationControllerProcessorsSpec `json:"processors,omitempty"` 84 85 // LogLevel refers to the log level used by the Application Controller component. Defaults to ArgoCDDefaultLogLevel if not configured. Valid options are debug, info, error, and warn. 86 LogLevel string `json:"logLevel,omitempty"` 87 88 // LogFormat refers to the log format used by the Application Controller component. Defaults to ArgoCDDefaultLogFormat if not configured. Valid options are text or json. 89 LogFormat string `json:"logFormat,omitempty"` 90 91 // Resources defines the Compute Resources required by the container for the Application Controller. 92 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resource Requirements'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Controller","urn:alm:descriptor:com.tectonic.ui:resourceRequirements"} 93 Resources *corev1.ResourceRequirements `json:"resources,omitempty"` 94 95 // ParallelismLimit defines the limit for parallel kubectl operations 96 ParallelismLimit int32 `json:"parallelismLimit,omitempty"` 97 98 // AppSync is used to control the sync frequency, by default the ArgoCD 99 // controller polls Git every 3m. 100 // 101 // Set this to a duration, e.g. 10m or 600s to control the synchronisation 102 // frequency. 103 // +optional 104 AppSync *metav1.Duration `json:"appSync,omitempty"` 105 106 // Sharding contains the options for the Application Controller sharding configuration. 107 Sharding ArgoCDApplicationControllerShardSpec `json:"sharding,omitempty"` 108 109 // Env lets you specify environment for application controller pods 110 Env []corev1.EnvVar `json:"env,omitempty"` 111 112 // Enabled is the flag to enable the Application Controller during ArgoCD installation. (optional, default `true`) 113 Enabled *bool `json:"enabled,omitempty"` 114 } 115 116 func (a *ArgoCDApplicationControllerSpec) IsEnabled() bool { 117 return a.Enabled == nil || (a.Enabled != nil && *a.Enabled) 118 } 119 120 // ArgoCDApplicationControllerShardSpec defines the options available for enabling sharding for the Application Controller component. 121 type ArgoCDApplicationControllerShardSpec struct { 122 123 // Enabled defines whether sharding should be enabled on the Application Controller component. 124 Enabled bool `json:"enabled,omitempty"` 125 126 // Replicas defines the number of replicas to run in the Application controller shard. 127 Replicas int32 `json:"replicas,omitempty"` 128 129 // DynamicScalingEnabled defines whether dynamic scaling should be enabled for Application Controller component 130 DynamicScalingEnabled *bool `json:"dynamicScalingEnabled,omitempty"` 131 132 // MinShards defines the minimum number of shards at any given point 133 // +kubebuilder:validation:Minimum=1 134 MinShards int32 `json:"minShards,omitempty"` 135 136 // MaxShards defines the maximum number of shards at any given point 137 MaxShards int32 `json:"maxShards,omitempty"` 138 139 // ClustersPerShard defines the maximum number of clusters managed by each argocd shard 140 // +kubebuilder:validation:Minimum=1 141 ClustersPerShard int32 `json:"clustersPerShard,omitempty"` 142 } 143 144 // ArgoCDApplicationSet defines whether the Argo CD ApplicationSet controller should be installed. 145 type ArgoCDApplicationSet struct { 146 147 // Env lets you specify environment for applicationSet controller pods 148 Env []corev1.EnvVar `json:"env,omitempty"` 149 150 // ExtraCommandArgs allows users to pass command line arguments to ApplicationSet controller. 151 // They get added to default command line arguments provided by the operator. 152 // Please note that the command line arguments provided as part of ExtraCommandArgs 153 // will not overwrite the default command line arguments. 154 ExtraCommandArgs []string `json:"extraCommandArgs,omitempty"` 155 156 // Image is the Argo CD ApplicationSet image (optional) 157 Image string `json:"image,omitempty"` 158 159 // Version is the Argo CD ApplicationSet image tag. (optional) 160 Version string `json:"version,omitempty"` 161 162 // Resources defines the Compute Resources required by the container for ApplicationSet. 163 Resources *corev1.ResourceRequirements `json:"resources,omitempty"` 164 165 // LogLevel describes the log level that should be used by the ApplicationSet controller. Defaults to ArgoCDDefaultLogLevel if not set. Valid options are debug,info, error, and warn. 166 LogLevel string `json:"logLevel,omitempty"` 167 168 WebhookServer WebhookServerSpec `json:"webhookServer,omitempty"` 169 170 // SCMRootCAConfigMap is the name of the config map that stores the Gitlab SCM Provider's TLS certificate which will be mounted on the ApplicationSet Controller (optional). 171 SCMRootCAConfigMap string `json:"scmRootCAConfigMap,omitempty"` 172 173 // Enabled is the flag to enable the Application Set Controller during ArgoCD installation. (optional, default `true`) 174 Enabled *bool `json:"enabled,omitempty"` 175 176 // SourceNamespaces defines the namespaces applicationset resources are allowed to be created in 177 SourceNamespaces []string `json:"sourceNamespaces,omitempty"` 178 179 // SCMProviders defines the list of allowed custom SCM provider API URLs 180 SCMProviders []string `json:"scmProviders,omitempty"` 181 } 182 183 func (a *ArgoCDApplicationSet) IsEnabled() bool { 184 return a.Enabled == nil || (a.Enabled != nil && *a.Enabled) 185 } 186 187 // ArgoCDCASpec defines the CA options for ArgCD. 188 type ArgoCDCASpec struct { 189 // ConfigMapName is the name of the ConfigMap containing the CA Certificate. 190 ConfigMapName string `json:"configMapName,omitempty"` 191 192 // SecretName is the name of the Secret containing the CA Certificate and Key. 193 SecretName string `json:"secretName,omitempty"` 194 } 195 196 // ArgoCDCertificateSpec defines the options for the ArgoCD certificates. 197 type ArgoCDCertificateSpec struct { 198 // SecretName is the name of the Secret containing the Certificate and Key. 199 SecretName string `json:"secretName"` 200 } 201 202 // ArgoCDDexSpec defines the desired state for the Dex server component. 203 type ArgoCDDexSpec struct { 204 //Config is the dex connector configuration. 205 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Configuration",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Dex","urn:alm:descriptor:com.tectonic.ui:text"} 206 Config string `json:"config,omitempty"` 207 208 // Optional list of required groups a user must be a member of 209 Groups []string `json:"groups,omitempty"` 210 211 // Image is the Dex container image. 212 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Image",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Dex","urn:alm:descriptor:com.tectonic.ui:text"} 213 Image string `json:"image,omitempty"` 214 215 // OpenShiftOAuth enables OpenShift OAuth authentication for the Dex server. 216 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="OpenShift OAuth Enabled'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Dex","urn:alm:descriptor:com.tectonic.ui:booleanSwitch"} 217 OpenShiftOAuth bool `json:"openShiftOAuth,omitempty"` 218 219 // Resources defines the Compute Resources required by the container for Dex. 220 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resource Requirements'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Dex","urn:alm:descriptor:com.tectonic.ui:resourceRequirements"} 221 Resources *corev1.ResourceRequirements `json:"resources,omitempty"` 222 223 // Version is the Dex container image tag. 224 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Version",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Dex","urn:alm:descriptor:com.tectonic.ui:text"} 225 Version string `json:"version,omitempty"` 226 227 // Env lets you specify environment variables for Dex. 228 Env []corev1.EnvVar `json:"env,omitempty"` 229 } 230 231 // ArgoCDGrafanaSpec defines the desired state for the Grafana component. 232 type ArgoCDGrafanaSpec struct { 233 // Enabled will toggle Grafana support globally for ArgoCD. 234 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enabled",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Grafana","urn:alm:descriptor:com.tectonic.ui:booleanSwitch"} 235 Enabled bool `json:"enabled"` 236 237 // Host is the hostname to use for Ingress/Route resources. 238 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Host",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Grafana","urn:alm:descriptor:com.tectonic.ui:text"} 239 Host string `json:"host,omitempty"` 240 241 // Image is the Grafana container image. 242 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Image",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Grafana","urn:alm:descriptor:com.tectonic.ui:text"} 243 Image string `json:"image,omitempty"` 244 245 // Ingress defines the desired state for an Ingress for the Grafana component. 246 Ingress ArgoCDIngressSpec `json:"ingress,omitempty"` 247 248 // Resources defines the Compute Resources required by the container for Grafana. 249 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resource Requirements'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Grafana","urn:alm:descriptor:com.tectonic.ui:resourceRequirements"} 250 Resources *corev1.ResourceRequirements `json:"resources,omitempty"` 251 252 // Route defines the desired state for an OpenShift Route for the Grafana component. 253 Route ArgoCDRouteSpec `json:"route,omitempty"` 254 255 // Size is the replica count for the Grafana Deployment. 256 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Size",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Grafana","urn:alm:descriptor:com.tectonic.ui:podCount"} 257 Size *int32 `json:"size,omitempty"` 258 259 // Version is the Grafana container image tag. 260 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Version",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Grafana","urn:alm:descriptor:com.tectonic.ui:text"} 261 Version string `json:"version,omitempty"` 262 } 263 264 // ArgoCDHASpec defines the desired state for High Availability support for Argo CD. 265 type ArgoCDHASpec struct { 266 // Enabled will toggle HA support globally for Argo CD. 267 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enabled",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:HA","urn:alm:descriptor:com.tectonic.ui:booleanSwitch"} 268 Enabled bool `json:"enabled"` 269 270 // RedisProxyImage is the Redis HAProxy container image. 271 RedisProxyImage string `json:"redisProxyImage,omitempty"` 272 273 // RedisProxyVersion is the Redis HAProxy container image tag. 274 RedisProxyVersion string `json:"redisProxyVersion,omitempty"` 275 276 // Resources defines the Compute Resources required by the container for HA. 277 Resources *corev1.ResourceRequirements `json:"resources,omitempty"` 278 } 279 280 // ArgoCDImportSpec defines the desired state for the ArgoCD import/restore process. 281 type ArgoCDImportSpec struct { 282 // Name of an ArgoCDExport from which to import data. 283 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Name",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Import","urn:alm:descriptor:com.tectonic.ui:text"} 284 Name string `json:"name"` 285 286 // Namespace for the ArgoCDExport, defaults to the same namespace as the ArgoCD. 287 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Namespace",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Import","urn:alm:descriptor:com.tectonic.ui:text"} 288 Namespace *string `json:"namespace,omitempty"` 289 } 290 291 // ArgoCDIngressSpec defines the desired state for the Ingress resources. 292 type ArgoCDIngressSpec struct { 293 // Annotations is the map of annotations to apply to the Ingress. 294 Annotations map[string]string `json:"annotations,omitempty"` 295 296 // Enabled will toggle the creation of the Ingress. 297 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Ingress Enabled'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Grafana","urn:alm:descriptor:com.tectonic.ui:fieldGroup:Prometheus","urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server","urn:alm:descriptor:com.tectonic.ui:booleanSwitch"} 298 Enabled bool `json:"enabled"` 299 300 // IngressClassName for the Ingress resource. 301 IngressClassName *string `json:"ingressClassName,omitempty"` 302 303 // Path used for the Ingress resource. 304 Path string `json:"path,omitempty"` 305 306 // TLS configuration. Currently the Ingress only supports a single TLS 307 // port, 443. If multiple members of this list specify different hosts, they 308 // will be multiplexed on the same port according to the hostname specified 309 // through the SNI TLS extension, if the ingress controller fulfilling the 310 // ingress supports SNI. 311 // +optional 312 TLS []networkingv1.IngressTLS `json:"tls,omitempty"` 313 } 314 315 // ArgoCDKeycloakSpec defines the desired state for the Keycloak component. 316 type ArgoCDKeycloakSpec struct { 317 // Image is the Keycloak container image. 318 Image string `json:"image,omitempty"` 319 320 // Resources defines the Compute Resources required by the container for Keycloak. 321 Resources *corev1.ResourceRequirements `json:"resources,omitempty"` 322 323 // Custom root CA certificate for communicating with the Keycloak OIDC provider 324 RootCA string `json:"rootCA,omitempty"` 325 326 // Version is the Keycloak container image tag. 327 Version string `json:"version,omitempty"` 328 329 // VerifyTLS set to false disables strict TLS validation. 330 VerifyTLS *bool `json:"verifyTLS,omitempty"` 331 } 332 333 //+kubebuilder:object:root=true 334 335 // ArgoCDList contains a list of ArgoCD 336 type ArgoCDList struct { 337 metav1.TypeMeta `json:",inline"` 338 metav1.ListMeta `json:"metadata,omitempty"` 339 Items []ArgoCD `json:"items"` 340 } 341 342 // ArgoCDNotifications defines whether the Argo CD Notifications controller should be installed. 343 type ArgoCDNotifications struct { 344 345 // Replicas defines the number of replicas to run for notifications-controller 346 Replicas *int32 `json:"replicas,omitempty"` 347 348 // Enabled defines whether argocd-notifications controller should be deployed or not 349 Enabled bool `json:"enabled"` 350 351 // Env let you specify environment variables for Notifications pods 352 Env []corev1.EnvVar `json:"env,omitempty"` 353 354 // Image is the Argo CD Notifications image (optional) 355 Image string `json:"image,omitempty"` 356 357 // Version is the Argo CD Notifications image tag. (optional) 358 Version string `json:"version,omitempty"` 359 360 // Resources defines the Compute Resources required by the container for Argo CD Notifications. 361 Resources *corev1.ResourceRequirements `json:"resources,omitempty"` 362 363 // LogLevel describes the log level that should be used by the argocd-notifications. Defaults to ArgoCDDefaultLogLevel if not set. Valid options are debug,info, error, and warn. 364 LogLevel string `json:"logLevel,omitempty"` 365 } 366 367 // ArgoCDPrometheusSpec defines the desired state for the Prometheus component. 368 type ArgoCDPrometheusSpec struct { 369 // Enabled will toggle Prometheus support globally for ArgoCD. 370 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enabled",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Prometheus","urn:alm:descriptor:com.tectonic.ui:booleanSwitch"} 371 Enabled bool `json:"enabled"` 372 373 // Host is the hostname to use for Ingress/Route resources. 374 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Host",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Prometheus","urn:alm:descriptor:com.tectonic.ui:text"} 375 Host string `json:"host,omitempty"` 376 377 // Ingress defines the desired state for an Ingress for the Prometheus component. 378 Ingress ArgoCDIngressSpec `json:"ingress,omitempty"` 379 380 // Route defines the desired state for an OpenShift Route for the Prometheus component. 381 Route ArgoCDRouteSpec `json:"route,omitempty"` 382 383 // Size is the replica count for the Prometheus StatefulSet. 384 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Size",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Prometheus","urn:alm:descriptor:com.tectonic.ui:podCount"} 385 Size *int32 `json:"size,omitempty"` 386 } 387 388 // ArgoCDRBACSpec defines the desired state for the Argo CD RBAC configuration. 389 type ArgoCDRBACSpec struct { 390 // DefaultPolicy is the name of the default role which Argo CD will falls back to, when 391 // authorizing API requests (optional). If omitted or empty, users may be still be able to login, 392 // but will see no apps, projects, etc... 393 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Default Policy'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:RBAC","urn:alm:descriptor:com.tectonic.ui:text"} 394 DefaultPolicy *string `json:"defaultPolicy,omitempty"` 395 396 // Policy is CSV containing user-defined RBAC policies and role definitions. 397 // Policy rules are in the form: 398 // p, subject, resource, action, object, effect 399 // Role definitions and bindings are in the form: 400 // g, subject, inherited-subject 401 // See https://github.com/argoproj/argo-cd/blob/master/docs/operator-manual/rbac.md for additional information. 402 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Policy",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:RBAC","urn:alm:descriptor:com.tectonic.ui:text"} 403 Policy *string `json:"policy,omitempty"` 404 405 // Scopes controls which OIDC scopes to examine during rbac enforcement (in addition to `sub` scope). 406 // If omitted, defaults to: '[groups]'. 407 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Scopes",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:RBAC","urn:alm:descriptor:com.tectonic.ui:text"} 408 Scopes *string `json:"scopes,omitempty"` 409 410 // PolicyMatcherMode configures the matchers function mode for casbin. 411 // There are two options for this, 'glob' for glob matcher or 'regex' for regex matcher. 412 PolicyMatcherMode *string `json:"policyMatcherMode,omitempty"` 413 } 414 415 // ArgoCDRedisSpec defines the desired state for the Redis server component. 416 type ArgoCDRedisSpec struct { 417 // Image is the Redis container image. 418 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Image",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Redis","urn:alm:descriptor:com.tectonic.ui:text"} 419 Image string `json:"image,omitempty"` 420 421 // Resources defines the Compute Resources required by the container for Redis. 422 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resource Requirements'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Redis","urn:alm:descriptor:com.tectonic.ui:resourceRequirements"} 423 Resources *corev1.ResourceRequirements `json:"resources,omitempty"` 424 425 // Version is the Redis container image tag. 426 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Version",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Redis","urn:alm:descriptor:com.tectonic.ui:text"} 427 Version string `json:"version,omitempty"` 428 429 // DisableTLSVerification defines whether redis server API should be accessed using strict TLS validation 430 DisableTLSVerification bool `json:"disableTLSVerification,omitempty"` 431 432 // AutoTLS specifies the method to use for automatic TLS configuration for the redis server 433 // The value specified here can currently be: 434 // - openshift - Use the OpenShift service CA to request TLS config 435 AutoTLS string `json:"autotls,omitempty"` 436 437 // Enabled is the flag to enable Redis during ArgoCD installation. (optional, default `true`) 438 Enabled *bool `json:"enabled,omitempty"` 439 440 // Remote specifies the remote URL of the Redis container. (optional, by default, a local instance managed by the operator is used.) 441 Remote *string `json:"remote,omitempty"` 442 } 443 444 func (a *ArgoCDRedisSpec) IsEnabled() bool { 445 return a.Enabled == nil || (a.Enabled != nil && *a.Enabled) 446 } 447 448 // ArgoCDRepoSpec defines the desired state for the Argo CD repo server component. 449 type ArgoCDRepoSpec struct { 450 451 // Extra Command arguments allows users to pass command line arguments to repo server workload. They get added to default command line arguments provided 452 // by the operator. 453 // Please note that the command line arguments provided as part of ExtraRepoCommandArgs will not overwrite the default command line arguments. 454 ExtraRepoCommandArgs []string `json:"extraRepoCommandArgs,omitempty"` 455 456 // LogLevel describes the log level that should be used by the Repo Server. Defaults to ArgoCDDefaultLogLevel if not set. Valid options are debug, info, error, and warn. 457 LogLevel string `json:"logLevel,omitempty"` 458 459 // LogFormat describes the log format that should be used by the Repo Server. Defaults to ArgoCDDefaultLogFormat if not configured. Valid options are text or json. 460 LogFormat string `json:"logFormat,omitempty"` 461 462 // MountSAToken describes whether you would like to have the Repo server mount the service account token 463 MountSAToken bool `json:"mountsatoken,omitempty"` 464 465 // Replicas defines the number of replicas for argocd-repo-server. Value should be greater than or equal to 0. Default is nil. 466 Replicas *int32 `json:"replicas,omitempty"` 467 468 // Resources defines the Compute Resources required by the container for Redis. 469 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resource Requirements'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Repo","urn:alm:descriptor:com.tectonic.ui:resourceRequirements"} 470 Resources *corev1.ResourceRequirements `json:"resources,omitempty"` 471 472 // ServiceAccount defines the ServiceAccount user that you would like the Repo server to use 473 ServiceAccount string `json:"serviceaccount,omitempty"` 474 475 // VerifyTLS defines whether repo server API should be accessed using strict TLS validation 476 VerifyTLS bool `json:"verifytls,omitempty"` 477 478 // AutoTLS specifies the method to use for automatic TLS configuration for the repo server 479 // The value specified here can currently be: 480 // - openshift - Use the OpenShift service CA to request TLS config 481 AutoTLS string `json:"autotls,omitempty"` 482 483 // Image is the ArgoCD Repo Server container image. 484 Image string `json:"image,omitempty"` 485 486 // Version is the ArgoCD Repo Server container image tag. 487 Version string `json:"version,omitempty"` 488 489 // ExecTimeout specifies the timeout in seconds for tool execution 490 ExecTimeout *int `json:"execTimeout,omitempty"` 491 492 // Env lets you specify environment for repo server pods 493 Env []corev1.EnvVar `json:"env,omitempty"` 494 495 // Volumes adds volumes to the repo server deployment 496 Volumes []corev1.Volume `json:"volumes,omitempty"` 497 498 // VolumeMounts adds volumeMounts to the repo server container 499 VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"` 500 501 // InitContainers defines the list of initialization containers for the repo server deployment 502 InitContainers []corev1.Container `json:"initContainers,omitempty"` 503 504 // SidecarContainers defines the list of sidecar containers for the repo server deployment 505 SidecarContainers []corev1.Container `json:"sidecarContainers,omitempty"` 506 507 // Enabled is the flag to enable Repo Server during ArgoCD installation. (optional, default `true`) 508 Enabled *bool `json:"enabled,omitempty"` 509 510 // Remote specifies the remote URL of the Repo Server container. (optional, by default, a local instance managed by the operator is used.) 511 Remote *string `json:"remote,omitempty"` 512 } 513 514 func (a *ArgoCDRepoSpec) IsEnabled() bool { 515 return a.Enabled == nil || (a.Enabled != nil && *a.Enabled) 516 } 517 518 // ArgoCDRouteSpec defines the desired state for an OpenShift Route. 519 type ArgoCDRouteSpec struct { 520 // Annotations is the map of annotations to use for the Route resource. 521 Annotations map[string]string `json:"annotations,omitempty"` 522 523 // Labels is the map of labels to use for the Route resource 524 Labels map[string]string `json:"labels,omitempty"` 525 526 // Enabled will toggle the creation of the OpenShift Route. 527 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Route Enabled'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Grafana","urn:alm:descriptor:com.tectonic.ui:fieldGroup:Prometheus","urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server","urn:alm:descriptor:com.tectonic.ui:booleanSwitch"} 528 Enabled bool `json:"enabled"` 529 530 // Path the router watches for, to route traffic for to the service. 531 Path string `json:"path,omitempty"` 532 533 // TLS provides the ability to configure certificates and termination for the Route. 534 TLS *routev1.TLSConfig `json:"tls,omitempty"` 535 536 // WildcardPolicy if any for the route. Currently only 'Subdomain' or 'None' is allowed. 537 WildcardPolicy *routev1.WildcardPolicyType `json:"wildcardPolicy,omitempty"` 538 } 539 540 // ArgoCDServerAutoscaleSpec defines the desired state for autoscaling the Argo CD Server component. 541 type ArgoCDServerAutoscaleSpec struct { 542 // Enabled will toggle autoscaling support for the Argo CD Server component. 543 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Autoscale Enabled'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server","urn:alm:descriptor:com.tectonic.ui:booleanSwitch"} 544 Enabled bool `json:"enabled"` 545 546 // HPA defines the HorizontalPodAutoscaler options for the Argo CD Server component. 547 HPA *autoscaling.HorizontalPodAutoscalerSpec `json:"hpa,omitempty"` 548 } 549 550 // ArgoCDServerGRPCSpec defines the desired state for the Argo CD Server GRPC options. 551 type ArgoCDServerGRPCSpec struct { 552 // Host is the hostname to use for Ingress/Route resources. 553 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="GRPC Host",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server","urn:alm:descriptor:com.tectonic.ui:text"} 554 Host string `json:"host,omitempty"` 555 556 // Ingress defines the desired state for the Argo CD Server GRPC Ingress. 557 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="GRPC Ingress Enabled'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server","urn:alm:descriptor:com.tectonic.ui:booleanSwitch"} 558 Ingress ArgoCDIngressSpec `json:"ingress,omitempty"` 559 } 560 561 // ArgoCDServerSpec defines the options for the ArgoCD Server component. 562 type ArgoCDServerSpec struct { 563 // Autoscale defines the autoscale options for the Argo CD Server component. 564 Autoscale ArgoCDServerAutoscaleSpec `json:"autoscale,omitempty"` 565 566 // GRPC defines the state for the Argo CD Server GRPC options. 567 GRPC ArgoCDServerGRPCSpec `json:"grpc,omitempty"` 568 569 // Host is the hostname to use for Ingress/Route resources. 570 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Host",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server","urn:alm:descriptor:com.tectonic.ui:text"} 571 Host string `json:"host,omitempty"` 572 573 // Ingress defines the desired state for an Ingress for the Argo CD Server component. 574 Ingress ArgoCDIngressSpec `json:"ingress,omitempty"` 575 576 // Insecure toggles the insecure flag. 577 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Insecure",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server","urn:alm:descriptor:com.tectonic.ui:booleanSwitch"} 578 Insecure bool `json:"insecure,omitempty"` 579 580 // LogLevel refers to the log level to be used by the ArgoCD Server component. Defaults to ArgoCDDefaultLogLevel if not set. Valid options are debug, info, error, and warn. 581 LogLevel string `json:"logLevel,omitempty"` 582 583 // LogFormat refers to the log level to be used by the ArgoCD Server component. Defaults to ArgoCDDefaultLogFormat if not configured. Valid options are text or json. 584 LogFormat string `json:"logFormat,omitempty"` 585 586 // Replicas defines the number of replicas for argocd-server. Default is nil. Value should be greater than or equal to 0. Value will be ignored if Autoscaler is enabled. 587 Replicas *int32 `json:"replicas,omitempty"` 588 589 // Resources defines the Compute Resources required by the container for the Argo CD server component. 590 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resource Requirements'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server","urn:alm:descriptor:com.tectonic.ui:resourceRequirements"} 591 Resources *corev1.ResourceRequirements `json:"resources,omitempty"` 592 593 // Route defines the desired state for an OpenShift Route for the Argo CD Server component. 594 Route ArgoCDRouteSpec `json:"route,omitempty"` 595 596 // Service defines the options for the Service backing the ArgoCD Server component. 597 Service ArgoCDServerServiceSpec `json:"service,omitempty"` 598 599 // Env lets you specify environment for API server pods 600 Env []corev1.EnvVar `json:"env,omitempty"` 601 602 // Extra Command arguments that would append to the Argo CD server command. 603 // ExtraCommandArgs will not be added, if one of these commands is already part of the server command 604 // with same or different value. 605 ExtraCommandArgs []string `json:"extraCommandArgs,omitempty"` 606 607 // Enabled is the flag to enable ArgoCD Server during ArgoCD installation. (optional, default `true`) 608 Enabled *bool `json:"enabled,omitempty"` 609 } 610 611 func (a *ArgoCDServerSpec) IsEnabled() bool { 612 return a.Enabled == nil || (a.Enabled != nil && *a.Enabled) 613 } 614 615 // ArgoCDServerServiceSpec defines the Service options for Argo CD Server component. 616 type ArgoCDServerServiceSpec struct { 617 // Type is the ServiceType to use for the Service resource. 618 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Service Type'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server","urn:alm:descriptor:com.tectonic.ui:text"} 619 Type corev1.ServiceType `json:"type"` 620 } 621 622 // Resource Customization for custom health check 623 type ResourceHealthCheck struct { 624 Group string `json:"group,omitempty"` 625 Kind string `json:"kind,omitempty"` 626 Check string `json:"check,omitempty"` 627 } 628 629 // Resource Customization for ignore difference 630 type ResourceIgnoreDifference struct { 631 All *IgnoreDifferenceCustomization `json:"all,omitempty"` 632 ResourceIdentifiers []ResourceIdentifiers `json:"resourceIdentifiers,omitempty"` 633 } 634 635 // Resource Customization fields for ignore difference 636 type ResourceIdentifiers struct { 637 Group string `json:"group,omitempty"` 638 Kind string `json:"kind,omitempty"` 639 Customization IgnoreDifferenceCustomization `json:"customization,omitempty"` 640 } 641 642 type IgnoreDifferenceCustomization struct { 643 JqPathExpressions []string `json:"jqPathExpressions,omitempty"` 644 JsonPointers []string `json:"jsonPointers,omitempty"` 645 ManagedFieldsManagers []string `json:"managedFieldsManagers,omitempty"` 646 } 647 648 // Resource Customization for custom action 649 type ResourceAction struct { 650 Group string `json:"group,omitempty"` 651 Kind string `json:"kind,omitempty"` 652 Action string `json:"action,omitempty"` 653 } 654 655 // SSOProviderType string defines the type of SSO provider. 656 type SSOProviderType string 657 658 const ( 659 // SSOProviderTypeKeycloak means keycloak will be Installed and Integrated with Argo CD. A new realm with name argocd 660 // will be created in this keycloak. This realm will have a client with name argocd that uses OpenShift v4 as Identity Provider. 661 SSOProviderTypeKeycloak SSOProviderType = "keycloak" 662 663 // SSOProviderTypeDex means dex will be Installed and Integrated with Argo CD. 664 SSOProviderTypeDex SSOProviderType = "dex" 665 ) 666 667 // ArgoCDSSOSpec defines SSO provider. 668 type ArgoCDSSOSpec struct { 669 // Provider installs and configures the given SSO Provider with Argo CD. 670 Provider SSOProviderType `json:"provider,omitempty"` 671 672 // Dex contains the configuration for Argo CD dex authentication 673 Dex *ArgoCDDexSpec `json:"dex,omitempty"` 674 675 // Keycloak contains the configuration for Argo CD keycloak authentication 676 Keycloak *ArgoCDKeycloakSpec `json:"keycloak,omitempty"` 677 } 678 679 // KustomizeVersionSpec is used to specify information about a kustomize version to be used within ArgoCD. 680 type KustomizeVersionSpec struct { 681 // Version is a configured kustomize version in the format of vX.Y.Z 682 Version string `json:"version,omitempty"` 683 // Path is the path to a configured kustomize version on the filesystem of your repo server. 684 Path string `json:"path,omitempty"` 685 } 686 687 // ArgoCDMonitoringSpec is used to configure workload status monitoring for a given Argo CD instance. 688 // It triggers creation of serviceMonitor and PrometheusRules that alert users when a given workload 689 // status meets a certain criteria. For e.g, it can fire an alert if the application controller is 690 // pending for x mins consecutively. 691 type ArgoCDMonitoringSpec struct { 692 // Enabled defines whether workload status monitoring is enabled for this instance or not 693 Enabled bool `json:"enabled"` 694 } 695 696 // ArgoCDNodePlacementSpec is used to specify NodeSelector and Tolerations for Argo CD workloads 697 type ArgoCDNodePlacementSpec struct { 698 // NodeSelector is a field of PodSpec, it is a map of key value pairs used for node selection 699 NodeSelector map[string]string `json:"nodeSelector,omitempty"` 700 // Tolerations allow the pods to schedule onto nodes with matching taints 701 Tolerations []corev1.Toleration `json:"tolerations,omitempty"` 702 } 703 704 // ArgoCDSpec defines the desired state of ArgoCD 705 // +k8s:openapi-gen=true 706 type ArgoCDSpec struct { 707 708 // ArgoCDApplicationSet defines whether the Argo CD ApplicationSet controller should be installed. 709 ApplicationSet *ArgoCDApplicationSet `json:"applicationSet,omitempty"` 710 711 // ApplicationInstanceLabelKey is the key name where Argo CD injects the app name as a tracking label. 712 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Application Instance Label Key'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:advanced"} 713 ApplicationInstanceLabelKey string `json:"applicationInstanceLabelKey,omitempty"` 714 715 // ConfigManagementPlugins is used to specify additional config management plugins. 716 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Config Management Plugins'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:advanced"} 717 ConfigManagementPlugins string `json:"configManagementPlugins,omitempty"` 718 719 // Controller defines the Application Controller options for ArgoCD. 720 Controller ArgoCDApplicationControllerSpec `json:"controller,omitempty"` 721 722 // DisableAdmin will disable the admin user. 723 DisableAdmin bool `json:"disableAdmin,omitempty"` 724 725 // ExtraConfig can be used to add fields to Argo CD configmap that are not supported by Argo CD CRD. 726 // 727 // Note: ExtraConfig takes precedence over Argo CD CRD. 728 // For example, A user sets `argocd.Spec.DisableAdmin` = true and also 729 // `a.Spec.ExtraConfig["admin.enabled"]` = true. In this case, operator updates 730 // Argo CD Configmap as follows -> argocd-cm.Data["admin.enabled"] = true. 731 ExtraConfig map[string]string `json:"extraConfig,omitempty"` 732 733 // GATrackingID is the google analytics tracking ID to use. 734 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Google Analytics Tracking ID'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:advanced"} 735 GATrackingID string `json:"gaTrackingID,omitempty"` 736 737 // GAAnonymizeUsers toggles user IDs being hashed before sending to google analytics. 738 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Google Analytics Anonymize Users'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch","urn:alm:descriptor:com.tectonic.ui:advanced"} 739 GAAnonymizeUsers bool `json:"gaAnonymizeUsers,omitempty"` 740 741 // Deprecated: Grafana defines the Grafana server options for ArgoCD. 742 Grafana ArgoCDGrafanaSpec `json:"grafana,omitempty"` 743 744 // HA options for High Availability support for the Redis component. 745 HA ArgoCDHASpec `json:"ha,omitempty"` 746 747 // HelpChatURL is the URL for getting chat help, this will typically be your Slack channel for support. 748 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Help Chat URL'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:advanced"} 749 HelpChatURL string `json:"helpChatURL,omitempty"` 750 751 // HelpChatText is the text for getting chat help, defaults to "Chat now!" 752 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Help Chat Text'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:advanced"} 753 HelpChatText string `json:"helpChatText,omitempty"` 754 755 // Image is the ArgoCD container image for all ArgoCD components. 756 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Image",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:ArgoCD","urn:alm:descriptor:com.tectonic.ui:text"} 757 Image string `json:"image,omitempty"` 758 759 // Import is the import/restore options for ArgoCD. 760 Import *ArgoCDImportSpec `json:"import,omitempty"` 761 762 // InitialRepositories to configure Argo CD with upon creation of the cluster. 763 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Initial Repositories'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:advanced"} 764 InitialRepositories string `json:"initialRepositories,omitempty"` 765 766 // InitialSSHKnownHosts defines the SSH known hosts data upon creation of the cluster for connecting Git repositories via SSH. 767 InitialSSHKnownHosts SSHHostsSpec `json:"initialSSHKnownHosts,omitempty"` 768 769 // KustomizeBuildOptions is used to specify build options/parameters to use with `kustomize build`. 770 KustomizeBuildOptions string `json:"kustomizeBuildOptions,omitempty"` 771 772 // KustomizeVersions is a listing of configured versions of Kustomize to be made available within ArgoCD. 773 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Kustomize Build Options'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:advanced"} 774 KustomizeVersions []KustomizeVersionSpec `json:"kustomizeVersions,omitempty"` 775 776 // OIDCConfig is the OIDC configuration as an alternative to dex. 777 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="OIDC Config'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:advanced"} 778 OIDCConfig string `json:"oidcConfig,omitempty"` 779 780 // Monitoring defines whether workload status monitoring configuration for this instance. 781 Monitoring ArgoCDMonitoringSpec `json:"monitoring,omitempty"` 782 783 // NodePlacement defines NodeSelectors and Taints for Argo CD workloads 784 NodePlacement *ArgoCDNodePlacementSpec `json:"nodePlacement,omitempty"` 785 786 // Notifications defines whether the Argo CD Notifications controller should be installed. 787 Notifications ArgoCDNotifications `json:"notifications,omitempty"` 788 789 // Prometheus defines the Prometheus server options for ArgoCD. 790 Prometheus ArgoCDPrometheusSpec `json:"prometheus,omitempty"` 791 792 // RBAC defines the RBAC configuration for Argo CD. 793 RBAC ArgoCDRBACSpec `json:"rbac,omitempty"` 794 795 // Redis defines the Redis server options for ArgoCD. 796 Redis ArgoCDRedisSpec `json:"redis,omitempty"` 797 798 // Repo defines the repo server options for Argo CD. 799 Repo ArgoCDRepoSpec `json:"repo,omitempty"` 800 801 // RepositoryCredentials are the Git pull credentials to configure Argo CD with upon creation of the cluster. 802 RepositoryCredentials string `json:"repositoryCredentials,omitempty"` 803 804 // ResourceHealthChecks customizes resource health check behavior. 805 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resource Health Check Customizations'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:advanced"} 806 ResourceHealthChecks []ResourceHealthCheck `json:"resourceHealthChecks,omitempty"` 807 808 // ResourceIgnoreDifferences customizes resource ignore difference behavior. 809 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resource Ignore Difference Customizations'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:advanced"} 810 ResourceIgnoreDifferences *ResourceIgnoreDifference `json:"resourceIgnoreDifferences,omitempty"` 811 812 // ResourceActions customizes resource action behavior. 813 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resource Action Customizations'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:advanced"} 814 ResourceActions []ResourceAction `json:"resourceActions,omitempty"` 815 816 // ResourceExclusions is used to completely ignore entire classes of resource group/kinds. 817 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resource Exclusions'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:advanced"} 818 ResourceExclusions string `json:"resourceExclusions,omitempty"` 819 820 // ResourceInclusions is used to only include specific group/kinds in the 821 // reconciliation process. 822 ResourceInclusions string `json:"resourceInclusions,omitempty"` 823 824 // ResourceTrackingMethod defines how Argo CD should track resources that it manages 825 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resource Tracking Method'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:advanced"} 826 ResourceTrackingMethod string `json:"resourceTrackingMethod,omitempty"` 827 828 // Server defines the options for the ArgoCD Server component. 829 Server ArgoCDServerSpec `json:"server,omitempty"` 830 831 // SourceNamespaces defines the namespaces application resources are allowed to be created in 832 SourceNamespaces []string `json:"sourceNamespaces,omitempty"` 833 834 // SSO defines the Single Sign-on configuration for Argo CD 835 SSO *ArgoCDSSOSpec `json:"sso,omitempty"` 836 837 // StatusBadgeEnabled toggles application status badge feature. 838 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Status Badge Enabled'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch","urn:alm:descriptor:com.tectonic.ui:advanced"} 839 StatusBadgeEnabled bool `json:"statusBadgeEnabled,omitempty"` 840 841 // TLS defines the TLS options for ArgoCD. 842 TLS ArgoCDTLSSpec `json:"tls,omitempty"` 843 844 // UsersAnonymousEnabled toggles anonymous user access. 845 // The anonymous users get default role permissions specified argocd-rbac-cm. 846 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Anonymous Users Enabled'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch","urn:alm:descriptor:com.tectonic.ui:advanced"} 847 UsersAnonymousEnabled bool `json:"usersAnonymousEnabled,omitempty"` 848 849 // Version is the tag to use with the ArgoCD container image for all ArgoCD components. 850 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Version",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:ArgoCD","urn:alm:descriptor:com.tectonic.ui:text"} 851 Version string `json:"version,omitempty"` 852 853 // Banner defines an additional banner to be displayed in Argo CD UI 854 Banner *Banner `json:"banner,omitempty"` 855 } 856 857 // ArgoCDStatus defines the observed state of ArgoCD 858 // +k8s:openapi-gen=true 859 type ArgoCDStatus struct { 860 // ApplicationController is a simple, high-level summary of where the Argo CD application controller component is in its lifecycle. 861 // There are four possible ApplicationController values: 862 // Pending: The Argo CD application controller component has been accepted by the Kubernetes system, but one or more of the required resources have not been created. 863 // Running: All of the required Pods for the Argo CD application controller component are in a Ready state. 864 // Failed: At least one of the Argo CD application controller component Pods had a failure. 865 // Unknown: The state of the Argo CD application controller component could not be obtained. 866 //+operator-sdk:csv:customresourcedefinitions:type=status,displayName="ApplicationController",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} 867 ApplicationController string `json:"applicationController,omitempty"` 868 869 // ApplicationSetController is a simple, high-level summary of where the Argo CD applicationSet controller component is in its lifecycle. 870 // There are four possible ApplicationSetController values: 871 // Pending: The Argo CD applicationSet controller component has been accepted by the Kubernetes system, but one or more of the required resources have not been created. 872 // Running: All of the required Pods for the Argo CD applicationSet controller component are in a Ready state. 873 // Failed: At least one of the Argo CD applicationSet controller component Pods had a failure. 874 // Unknown: The state of the Argo CD applicationSet controller component could not be obtained. 875 //+operator-sdk:csv:customresourcedefinitions:type=status,displayName="ApplicationSetController",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} 876 ApplicationSetController string `json:"applicationSetController,omitempty"` 877 878 // SSO is a simple, high-level summary of where the Argo CD SSO(Dex/Keycloak) component is in its lifecycle. 879 // There are four possible sso values: 880 // Pending: The Argo CD SSO component has been accepted by the Kubernetes system, but one or more of the required resources have not been created. 881 // Running: All of the required Pods for the Argo CD SSO component are in a Ready state. 882 // Failed: At least one of the Argo CD SSO component Pods had a failure. 883 // Unknown: The state of the Argo CD SSO component could not be obtained. 884 //+operator-sdk:csv:customresourcedefinitions:type=status,displayName="SSO",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} 885 SSO string `json:"sso,omitempty"` 886 887 // NotificationsController is a simple, high-level summary of where the Argo CD notifications controller component is in its lifecycle. 888 // There are four possible NotificationsController values: 889 // Pending: The Argo CD notifications controller component has been accepted by the Kubernetes system, but one or more of the required resources have not been created. 890 // Running: All of the required Pods for the Argo CD notifications controller component are in a Ready state. 891 // Failed: At least one of the Argo CD notifications controller component Pods had a failure. 892 // Unknown: The state of the Argo CD notifications controller component could not be obtained. 893 //+operator-sdk:csv:customresourcedefinitions:type=status,displayName="NotificationsController",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} 894 NotificationsController string `json:"notificationsController,omitempty"` 895 896 // Phase is a simple, high-level summary of where the ArgoCD is in its lifecycle. 897 // There are four possible phase values: 898 // Pending: The ArgoCD has been accepted by the Kubernetes system, but one or more of the required resources have not been created. 899 // Available: All of the resources for the ArgoCD are ready. 900 // Failed: At least one resource has experienced a failure. 901 // Unknown: The state of the ArgoCD phase could not be obtained. 902 //+operator-sdk:csv:customresourcedefinitions:type=status,displayName="Phase",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} 903 Phase string `json:"phase,omitempty"` 904 905 // Redis is a simple, high-level summary of where the Argo CD Redis component is in its lifecycle. 906 // There are four possible redis values: 907 // Pending: The Argo CD Redis component has been accepted by the Kubernetes system, but one or more of the required resources have not been created. 908 // Running: All of the required Pods for the Argo CD Redis component are in a Ready state. 909 // Failed: At least one of the Argo CD Redis component Pods had a failure. 910 // Unknown: The state of the Argo CD Redis component could not be obtained. 911 //+operator-sdk:csv:customresourcedefinitions:type=status,displayName="Redis",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} 912 Redis string `json:"redis,omitempty"` 913 914 // Repo is a simple, high-level summary of where the Argo CD Repo component is in its lifecycle. 915 // There are four possible repo values: 916 // Pending: The Argo CD Repo component has been accepted by the Kubernetes system, but one or more of the required resources have not been created. 917 // Running: All of the required Pods for the Argo CD Repo component are in a Ready state. 918 // Failed: At least one of the Argo CD Repo component Pods had a failure. 919 // Unknown: The state of the Argo CD Repo component could not be obtained. 920 //+operator-sdk:csv:customresourcedefinitions:type=status,displayName="Repo",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} 921 Repo string `json:"repo,omitempty"` 922 923 // Server is a simple, high-level summary of where the Argo CD server component is in its lifecycle. 924 // There are four possible server values: 925 // Pending: The Argo CD server component has been accepted by the Kubernetes system, but one or more of the required resources have not been created. 926 // Running: All of the required Pods for the Argo CD server component are in a Ready state. 927 // Failed: At least one of the Argo CD server component Pods had a failure. 928 // Unknown: The state of the Argo CD server component could not be obtained. 929 //+operator-sdk:csv:customresourcedefinitions:type=status,displayName="Server",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} 930 Server string `json:"server,omitempty"` 931 932 // RepoTLSChecksum contains the SHA256 checksum of the latest known state of tls.crt and tls.key in the argocd-repo-server-tls secret. 933 RepoTLSChecksum string `json:"repoTLSChecksum,omitempty"` 934 935 // RedisTLSChecksum contains the SHA256 checksum of the latest known state of tls.crt and tls.key in the argocd-operator-redis-tls secret. 936 RedisTLSChecksum string `json:"redisTLSChecksum,omitempty"` 937 938 // Host is the hostname of the Ingress. 939 Host string `json:"host,omitempty"` 940 } 941 942 // Banner defines an additional banner message to be displayed in Argo CD UI 943 // https://argo-cd.readthedocs.io/en/stable/operator-manual/custom-styles/#banners 944 type Banner struct { 945 // Content defines the banner message content to display 946 Content string `json:"content"` 947 // URL defines an optional URL to be used as banner message link 948 URL string `json:"url,omitempty"` 949 } 950 951 // ArgoCDTLSSpec defines the TLS options for ArgCD. 952 type ArgoCDTLSSpec struct { 953 // CA defines the CA options. 954 CA ArgoCDCASpec `json:"ca,omitempty"` 955 956 // InitialCerts defines custom TLS certificates upon creation of the cluster for connecting Git repositories via HTTPS. 957 InitialCerts map[string]string `json:"initialCerts,omitempty"` 958 } 959 960 type SSHHostsSpec struct { 961 // ExcludeDefaultHosts describes whether you would like to include the default 962 // list of SSH Known Hosts provided by ArgoCD. 963 ExcludeDefaultHosts bool `json:"excludedefaulthosts,omitempty"` 964 965 // Keys describes a custom set of SSH Known Hosts that you would like to 966 // have included in your ArgoCD server. 967 Keys string `json:"keys,omitempty"` 968 } 969 970 // WebhookServerSpec defines the options for the ApplicationSet Webhook Server component. 971 type WebhookServerSpec struct { 972 973 // Host is the hostname to use for Ingress/Route resources. 974 //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Host",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server","urn:alm:descriptor:com.tectonic.ui:text"} 975 Host string `json:"host,omitempty"` 976 977 // Ingress defines the desired state for an Ingress for the Application set webhook component. 978 Ingress ArgoCDIngressSpec `json:"ingress,omitempty"` 979 980 // Route defines the desired state for an OpenShift Route for the Application set webhook component. 981 Route ArgoCDRouteSpec `json:"route,omitempty"` 982 } 983 984 // IsDeletionFinalizerPresent checks if the instance has deletion finalizer 985 func (argocd *ArgoCD) IsDeletionFinalizerPresent() bool { 986 for _, finalizer := range argocd.GetFinalizers() { 987 if finalizer == common.ArgoCDDeletionFinalizer { 988 return true 989 } 990 } 991 return false 992 } 993 994 // WantsAutoTLS returns true if user configured a route with reencryption 995 // termination policy. 996 func (s *ArgoCDServerSpec) WantsAutoTLS() bool { 997 return s.Route.TLS != nil && s.Route.TLS.Termination == routev1.TLSTerminationReencrypt 998 } 999 1000 // WantsAutoTLS returns true if the repository server configuration has set 1001 // the autoTLS toggle to a supported provider. 1002 func (r *ArgoCDRepoSpec) WantsAutoTLS() bool { 1003 return r.AutoTLS == "openshift" 1004 } 1005 1006 // WantsAutoTLS returns true if the redis server configuration has set 1007 // the autoTLS toggle to a supported provider. 1008 func (r *ArgoCDRedisSpec) WantsAutoTLS() bool { 1009 return r.AutoTLS == "openshift" 1010 } 1011 1012 // ApplicationInstanceLabelKey returns either the custom application instance 1013 // label key if set, or the default value. 1014 func (a *ArgoCD) ApplicationInstanceLabelKey() string { 1015 if a.Spec.ApplicationInstanceLabelKey != "" { 1016 return a.Spec.ApplicationInstanceLabelKey 1017 } else { 1018 return common.ArgoCDDefaultApplicationInstanceLabelKey 1019 } 1020 } 1021 1022 // ResourceTrackingMethod represents the Argo CD resource tracking method to use 1023 type ResourceTrackingMethod int 1024 1025 const ( 1026 ResourceTrackingMethodInvalid ResourceTrackingMethod = -1 1027 ResourceTrackingMethodLabel ResourceTrackingMethod = 0 1028 ResourceTrackingMethodAnnotation ResourceTrackingMethod = 1 1029 ResourceTrackingMethodAnnotationAndLabel ResourceTrackingMethod = 2 1030 ) 1031 1032 const ( 1033 stringResourceTrackingMethodLabel string = "label" 1034 stringResourceTrackingMethodAnnotation string = "annotation" 1035 stringResourceTrackingMethodAnnotationAndLabel string = "annotation+label" 1036 ) 1037 1038 // String returns the string representation for a ResourceTrackingMethod 1039 func (r ResourceTrackingMethod) String() string { 1040 switch r { 1041 case ResourceTrackingMethodLabel: 1042 return stringResourceTrackingMethodLabel 1043 case ResourceTrackingMethodAnnotation: 1044 return stringResourceTrackingMethodAnnotation 1045 case ResourceTrackingMethodAnnotationAndLabel: 1046 return stringResourceTrackingMethodAnnotationAndLabel 1047 } 1048 1049 // Default is to use label 1050 return stringResourceTrackingMethodLabel 1051 } 1052 1053 // ParseResourceTrackingMethod parses a string into a resource tracking method 1054 func ParseResourceTrackingMethod(name string) ResourceTrackingMethod { 1055 switch name { 1056 case stringResourceTrackingMethodLabel, "": 1057 return ResourceTrackingMethodLabel 1058 case stringResourceTrackingMethodAnnotation: 1059 return ResourceTrackingMethodAnnotation 1060 case stringResourceTrackingMethodAnnotationAndLabel: 1061 return ResourceTrackingMethodAnnotationAndLabel 1062 } 1063 1064 return ResourceTrackingMethodInvalid 1065 } 1066 1067 // ToLower returns the lower case representation for a SSOProviderType 1068 func (p SSOProviderType) ToLower() SSOProviderType { 1069 str := string(p) 1070 return SSOProviderType(strings.ToLower(str)) 1071 }