defaultClient returns the default Deployment definition for the S3 client.
(namespace string)
| 428 | |
| 429 | // defaultClient returns the default Deployment definition for the S3 client. |
| 430 | func defaultClient(namespace string) appsv1.Deployment { |
| 431 | seccompProfile := &corev1.SeccompProfile{ |
| 432 | Type: corev1.SeccompProfileTypeRuntimeDefault, |
| 433 | } |
| 434 | labels := map[string]string{"run": "s3-client"} |
| 435 | |
| 436 | clientDeployment := appsv1.Deployment{ |
| 437 | ObjectMeta: metav1.ObjectMeta{ |
| 438 | Namespace: namespace, |
| 439 | Name: "s3-client", |
| 440 | Labels: labels, |
| 441 | }, |
| 442 | Spec: appsv1.DeploymentSpec{ |
| 443 | Replicas: ptr.To(int32(1)), |
| 444 | Selector: &metav1.LabelSelector{ |
| 445 | MatchLabels: labels, |
| 446 | }, |
| 447 | Template: corev1.PodTemplateSpec{ |
| 448 | ObjectMeta: metav1.ObjectMeta{ |
| 449 | Labels: labels, |
| 450 | }, |
| 451 | Spec: corev1.PodSpec{ |
| 452 | Containers: []corev1.Container{ |
| 453 | { |
| 454 | Name: "s3-client", |
| 455 | Image: awsCliImage, |
| 456 | Env: []corev1.EnvVar{ |
| 457 | { |
| 458 | Name: "AWS_ENDPOINT_URL", |
| 459 | Value: "http://object-store.object-store:9000", |
| 460 | }, |
| 461 | { |
| 462 | Name: "AWS_ACCESS_KEY_ID", |
| 463 | Value: AccessKeyID, |
| 464 | }, |
| 465 | { |
| 466 | Name: "AWS_SECRET_ACCESS_KEY", |
| 467 | Value: SecretAccessKey, |
| 468 | }, |
| 469 | { |
| 470 | Name: "AWS_DEFAULT_REGION", |
| 471 | Value: "us-east-1", |
| 472 | }, |
| 473 | // The CRC-based default checksums introduced in |
| 474 | // AWS CLI 2.23 are not supported by every |
| 475 | // S3-compatible object store |
| 476 | { |
| 477 | Name: "AWS_REQUEST_CHECKSUM_CALCULATION", |
| 478 | Value: "when_required", |
| 479 | }, |
| 480 | { |
| 481 | Name: "AWS_RESPONSE_CHECKSUM_VALIDATION", |
| 482 | Value: "when_required", |
| 483 | }, |
| 484 | }, |
| 485 | SecurityContext: &corev1.SecurityContext{ |
| 486 | AllowPrivilegeEscalation: ptr.To(false), |
| 487 | SeccompProfile: seccompProfile, |