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