aws-controllers-k8s/community

Cloudfront controller - fails to create **distribution**

bala151187 opened this issue · 1 comments

Describe the bug
Distribution fail to be created and erroring out with a message - s3 bucket has been deleted
since s3 bucket takes couple of sec to be created . cloudfront distribution getting failed with that message ..
Either i have make the ack cloudfront controller to restart to make this error go away (or) update a parameter of cloudfront distribution and re-apply to make error go away

Any help appreciated

Steps to reproduce
Create s3 bucket and distribution

# Source: version-manager-ui/templates/cloudfront.yaml
apiVersion: s3.services.k8s.aws/v1alpha1
kind: Bucket
metadata:
  name: dev-atat-version-manager
  annotations:
    services.k8s.aws/deletion-policy: retain
spec:
  name: dev-atat-version-manager
  publicAccessBlock: 
    blockPublicACLs: true
    blockPublicPolicy: true
    ignorePublicACLs: true
    restrictPublicBuckets: true
  policy: >
    {
        "Version": "2008-10-17",
        "Id": "PublicReadGetObjectForCloudFront",
        "Statement": [
            {
                "Sid": "AllowCloudFrontServicePrincipal",
                "Effect": "Allow",
                "Principal": {
                    "Service": "cloudfront.amazonaws.com"
                },
                "Action": "s3:GetObject",
                "Resource": "arn:aws:s3:::dev-atat-version-manager/*"
            }
        ]
      }
  website: 
    errorDocument: 
      key: error.html
    indexDocument: 
      suffix: index.html
  tagging: 
    tagSet:
    - key: app-service
      value: version-manager-ui
    - key: app-platform
      value: atat
    - key: app-environment
      value: DEV
    - key: subProduct
      value: version-manager-ui
    - key: Product
      value: k8s
    - key: Environment
      value: DEV
---
# Source: version-manager-ui/templates/cloudfront.yaml
apiVersion: cloudfront.services.k8s.aws/v1alpha1
kind: Distribution
metadata:
  name: version-manager-ui
  annotations:
    services.k8s.aws/deletion-policy: retain
spec:
  distributionConfig:
    aliases:
      items:
      - version-manager.google.com
    viewerCertificate:
      acmCertificateARN: arn:aws:acm:us-east-1:xyz:certificate/47ce83b0-4a18-474f-97df-b55a15a6d493
      minimumProtocolVersion: TLSv1
      sslSupportMethod: sni-only
    cacheBehaviors:
      minTTL: 500
      maxTTL: 1000
    comment: Version Manager UI
    customErrorResponses: {}
    enabled: true
    defaultCacheBehavior:
      targetOriginID: dev-atat-version-manager
      viewerProtocolPolicy: allow-all
      minTTL: 500
      forwardedValues:
        queryString: false
        cookies:
          forward: "none"
    defaultRootObject: index.html
    origins:
      items:
      - id: dev-atat-version-manager        
        domainName: dev-atat-version-manager.s3.amazonaws.com
        originAccessControlID: EBSNWM0FK0BY8
        s3OriginConfig: 
          originAccessIdentity: ''
        customHeaders: {}
        originPath: ''
        originShield:
          enabled: false

Expected outcome
s3 bucket & cloudfront

Environment

  • Kubernetes version
  • Using EKS (yes/no), if so version? - 130.0
  • AWS service targeted (S3, RDS, etc.) - s3 & cloudfront