fixup! fixup! fixup! fixup! General improvements

This commit is contained in:
2025-01-10 12:30:58 +00:00
parent 23345c56c6
commit a7273d688f
3 changed files with 10 additions and 7 deletions
+2 -2
View File
@@ -10,9 +10,9 @@ description: |
type: application type: application
version: 0.2.27 version: 0.2.29
appVersion: "0.2.27" appVersion: "0.2.29"
home: https://github.com/lukaszraczylo/kubernetes-images-sync-operator home: https://github.com/lukaszraczylo/kubernetes-images-sync-operator
+1 -1
View File
@@ -12,7 +12,7 @@ sa:
- ALL - ALL
image: image:
repository: ghcr.io/lukaszraczylo/kubernetes-images-sync-operator repository: ghcr.io/lukaszraczylo/kubernetes-images-sync-operator
tag: 0.2.27 tag: 0.2.29
resources: resources:
limits: limits:
cpu: 500m cpu: 500m
+6 -3
View File
@@ -24,7 +24,10 @@ def get_s3_client(use_role=False, role_name=None, aws_access_key_id=None, aws_se
client_kwargs['aws_access_key_id'] = credentials['AccessKeyId'] client_kwargs['aws_access_key_id'] = credentials['AccessKeyId']
client_kwargs['aws_secret_access_key'] = credentials['SecretAccessKey'] client_kwargs['aws_secret_access_key'] = credentials['SecretAccessKey']
client_kwargs['aws_session_token'] = credentials['SessionToken'] client_kwargs['aws_session_token'] = credentials['SessionToken']
return boto3.client('s3', **client_kwargs) return boto3.client('s3', **client_kwargs)
else:
# Use the current role/credentials from the environment
return boto3.client('s3', **client_kwargs)
elif aws_access_key_id and aws_secret_access_key: elif aws_access_key_id and aws_secret_access_key:
client_kwargs['aws_access_key_id'] = aws_access_key_id client_kwargs['aws_access_key_id'] = aws_access_key_id
client_kwargs['aws_secret_access_key'] = aws_secret_access_key client_kwargs['aws_secret_access_key'] = aws_secret_access_key
@@ -57,8 +60,8 @@ def validate_args(args, parser):
Validate command-line arguments Validate command-line arguments
""" """
if args.destination.startswith('s3://'): if args.destination.startswith('s3://'):
if args.use_role and (args.aws_access_key_id or args.aws_secret_access_key or args.endpoint_url): if args.use_role and (args.aws_access_key_id or args.aws_secret_access_key):
parser.error("When using IAM role (--use_role), access key, secret, and endpoint URL should not be specified.") parser.error("When using IAM role (--use_role), access key and secret should not be specified.")
if (args.aws_access_key_id or args.aws_secret_access_key) and not (args.aws_access_key_id and args.aws_secret_access_key): if (args.aws_access_key_id or args.aws_secret_access_key) and not (args.aws_access_key_id and args.aws_secret_access_key):
parser.error("Both --aws_access_key_id and --aws_secret_access_key must be provided when using access key authentication.") parser.error("Both --aws_access_key_id and --aws_secret_access_key must be provided when using access key authentication.")