Skip to content

Commit e2c38f5

Browse files
committed
Add check for AZURE_FEDERATED_TOKEN_FILE environment variable in Velero deployment test
Signed-off-by: Tiger Kaovilai <[email protected]>
1 parent e3ca4a1 commit e2c38f5

File tree

13 files changed

+1946
-8
lines changed

13 files changed

+1946
-8
lines changed

api/v1alpha1/cloudstorage_types.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ type CloudStorageSpec struct {
4242
// region for the bucket to be in, will be us-east-1 if not set.
4343
Region string `json:"region,omitempty"`
4444
// provider is the provider of the cloud storage
45-
// +kubebuilder:validation:Enum=aws
45+
// +kubebuilder:validation:Enum=aws;azure;gcp
4646
Provider CloudStorageProvider `json:"provider"`
47+
// config is provider-specific configuration options
48+
// +kubebuilder:validation:Optional
49+
Config map[string]string `json:"config,omitempty"`
4750

4851
// https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/[email protected]#section-readme
4952
// azure blob primary endpoint

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/manifests/oadp.openshift.io_cloudstorages.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ spec:
3939
type: object
4040
spec:
4141
properties:
42+
config:
43+
additionalProperties:
44+
type: string
45+
description: config is provider-specific configuration options
46+
type: object
4247
creationSecret:
4348
description: creationSecret is the secret that is needed to be used
4449
while creating the bucket.
@@ -75,6 +80,8 @@ spec:
7580
description: provider is the provider of the cloud storage
7681
enum:
7782
- aws
83+
- azure
84+
- gcp
7885
type: string
7986
region:
8087
description: region for the bucket to be in, will be us-east-1 if

config/crd/bases/oadp.openshift.io_cloudstorages.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ spec:
3939
type: object
4040
spec:
4141
properties:
42+
config:
43+
additionalProperties:
44+
type: string
45+
description: config is provider-specific configuration options
46+
type: object
4247
creationSecret:
4348
description: creationSecret is the secret that is needed to be used
4449
while creating the bucket.
@@ -75,6 +80,8 @@ spec:
7580
description: provider is the provider of the cloud storage
7681
enum:
7782
- aws
83+
- azure
84+
- gcp
7885
type: string
7986
region:
8087
description: region for the bucket to be in, will be us-east-1 if

docs/standardized-flow-implementation.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,13 +539,15 @@ This enhancement eliminates the need to manually configure the region in the sec
539539
### Azure Workload Identity Implementation
540540

541541
#### Azure Environment Variables
542+
542543
```go
543544
ClientIDEnvKey = "AZURE_CLIENT_ID" // Azure managed identity client ID
544545
TenantIDEnvKey = "AZURE_TENANT_ID" // Azure tenant ID
545546
SubscriptionIDEnvKey = "AZURE_SUBSCRIPTION_ID" // Azure subscription ID
546547
```
547548

548549
#### Azure Prerequisites
550+
549551
1. **OpenShift cluster with Azure Workload Identity enabled**
550552
- Cluster must be installed with manual credentials mode
551553
- Reference: [Installing a cluster on Azure with short-term credentials](https://docs.redhat.com/en/documentation/openshift_container_platform/latest/html-single/installing_on_azure/#installing-azure-with-short-term-creds_installing-azure-customizations)
@@ -585,6 +587,7 @@ The OADP operator automatically patches the Azure credentials secret with the `A
585587
**Important**: The standardized flow only supports the first BSL configuration. Additional BSLs with different resource groups require separate credentials and should not use the standardized flow secret.
586588

587589
#### Azure DPA Configuration
590+
588591
```yaml
589592
apiVersion: oadp.openshift.io/v1alpha1
590593
kind: DataProtectionApplication
@@ -615,6 +618,7 @@ spec:
615618
### GCP Workload Identity Federation Implementation
616619

617620
#### GCP Environment Variables
621+
618622
```go
619623
ProjectNumberEnvKey = "PROJECT_NUMBER" // GCP project number
620624
PoolIDEnvKey = "POOL_ID" // Workload identity pool ID
@@ -623,6 +627,7 @@ ServiceAccountEmailEnvKey = "SERVICE_ACCOUNT_EMAIL" // Service account email to
623627
```
624628

625629
#### GCP Prerequisites
630+
626631
1. **OpenShift cluster with GCP Workload Identity Federation enabled**
627632
- Cluster must be installed with manual credentials mode
628633
- Workload Identity Pool and Provider must be configured
@@ -674,6 +679,7 @@ ServiceAccountEmailEnvKey = "SERVICE_ACCOUNT_EMAIL" // Service account email to
674679
```
675680

676681
#### GCP Secret Creation
682+
677683
The `CreateOrUpdateSTSGCPSecret` function creates a Secret with the required GCP WIF configuration:
678684

679685
```go
@@ -701,11 +707,13 @@ func CreateOrUpdateSTSGCPSecret(setupLog logr.Logger, serviceAccountEmail, proje
701707
```
702708

703709
#### GCP Secret Format
710+
704711
- **Secret Name**: `cloud-credentials-gcp`
705712
- **Secret Key**: `service_account.json`
706713
- **Content**: GCP external account JSON following Google's external account format
707714

708715
#### GCP DPA Configuration
716+
709717
```yaml
710718
apiVersion: oadp.openshift.io/v1alpha1
711719
kind: DataProtectionApplication

internal/controller/velero_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2579,6 +2579,9 @@ func TestDPAReconciler_buildVeleroDeploymentWithAzureWorkloadIdentity(t *testing
25792579
if !foundClientIDEnvVar {
25802580
t.Errorf("Expected AZURE_CLIENT_ID environment variable to be set")
25812581
}
2582+
if !foundTokenFileEnvVar {
2583+
t.Errorf("Expected AZURE_FEDERATED_TOKEN_FILE environment variable to be set")
2584+
}
25822585
} else {
25832586
}
25842587
})

pkg/bucket/aws.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,6 @@ func (a awsBucketClient) getS3Client() (s3iface.S3API, error) {
147147
return s3.New(s), nil
148148
}
149149

150-
func (a awsBucketClient) ForceCredentialRefresh() error {
151-
return fmt.Errorf("force credential refresh is not yet implemented")
152-
}
153-
154150
func (a awsBucketClient) Delete() (bool, error) {
155151
s3Client, err := a.getS3Client()
156152
if err != nil {

0 commit comments

Comments
 (0)