Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference TaskDefinition ARN if resolvable #826

Closed
wants to merge 1 commit into from
Closed

Reference TaskDefinition ARN if resolvable #826

wants to merge 1 commit into from

Conversation

mhoshi-vm
Copy link
Contributor

Description of your changes

Fix idea for #825

I have:

  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

Run this code and execute terraform plan from target directory.
No change was detected.

% terraform plan
aws_ecs_service.test2-ecs-ns1: Refreshing state... [id=arn:aws:ecs:us-west-2:XXXXX:service/hoge/test2-ecs-ns1]

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.

@Upbound-CLA
Copy link

Upbound-CLA commented Aug 12, 2023

CLA assistant check
All committers have signed the CLA.

@turkenf
Copy link
Collaborator

turkenf commented Aug 15, 2023

/test-examples="examples/ecs/taskdefinition.yaml"

@turkenf
Copy link
Collaborator

turkenf commented Aug 31, 2023

/test-examples="examples/ecs/taskdefinition.yaml"

@turkenf
Copy link
Collaborator

turkenf commented Aug 31, 2023

Hi @mhoshi-vm,

Thank you for your contribution.
It would be nice if you could add a screenshot or logs of testing the Service.ecs resource using the task Definition Selector, please see: #523 (comment)

@mhoshi-vm
Copy link
Contributor Author

@turkenf sorry to be late.

It would be nice if you could add a screenshot or logs of testing the Service.ecs resource using the task Definition Selector, please see: #523 (comment)

Summary output

machih@machih6MD6R ~ % kubectl get taskdefinitions,service.ecs.aws.upbound.io
W0918 23:35:22.367043   62924 warnings.go:70] Use tokens from the TokenRequest API or manually created secret-based tokens instead of auto-generated secret-based tokens.
Warning: Use tokens from the TokenRequest API or manually created secret-based tokens instead of auto-generated secret-based tokens.
I0918 23:35:24.347435   62922 request.go:665] Waited for 1.193308298s due to client-side throttling, not priority and fairness, request: GET:https://abf4265abcc944143a0787afa245d4fa-935042956.us-west-2.elb.amazonaws.com/apis/sources.knative.dev/v1beta2?timeout=32s
NAME                                              READY   SYNCED   EXTERNAL-NAME                                                         AGE
taskdefinition.ecs.aws.upbound.io/test2-ecs-ns1   True    True     arn:aws:ecs:us-west-2:XXXXXXXXXX:task-definition/test2-ecs-ns1:63   25m

NAME                                       READY   SYNCED   EXTERNAL-NAME   AGE
service.ecs.aws.upbound.io/test2-ecs-ns1   True    True     test2-ecs-ns1   21m

Text output of -o yaml

machih@machih6MD6R ~ % kubectl get taskdefinitions,service.ecs.aws.upbound.io -o yaml
Warning: Use tokens from the TokenRequest API or manually created secret-based tokens instead of auto-generated secret-based tokens.
I0918 23:31:08.359456   61128 request.go:665] Waited for 1.198454583s due to client-side throttling, not priority and fairness, request: GET:https://abf4265abcc944143a0787afa245d4fa-935042956.us-west-2.elb.amazonaws.com/apis/kpack.io/v1alpha2?timeout=32s
apiVersion: v1
items:
- apiVersion: ecs.aws.upbound.io/v1beta1
  kind: TaskDefinition
  metadata:
    annotations:
      boot.spring.io/version: 3.1.2
      conventions.carto.run/applied-conventions: |-
        appliveview-sample/app-live-view-appflavour-check
        spring-boot-convention/auto-configure-actuators-check
        spring-boot-convention/spring-boot
        spring-boot-convention/spring-boot-graceful-shutdown
        spring-boot-convention/spring-boot-web
        spring-boot-convention/spring-boot-actuator
        spring-boot-convention/spring-boot-actuator-probes
        spring-boot-convention/app-live-view-appflavour-check
        spring-boot-convention/app-live-view-connector-boot
        spring-boot-convention/app-live-view-appflavours-boot
      crossplane.io/external-create-succeeded: "2023-09-18T14:09:40Z"
      crossplane.io/external-name: arn:aws:ecs:us-west-2:XXXXXXXXXXXX:task-definition/test2-ecs-ns1:63
      developer.conventions/target-containers: workload
      kapp.k14s.io/change-group: base
      kapp.k14s.io/identity: v1;/ecs.aws.upbound.io/TaskDefinition/test2-ecs-ns1;ecs.aws.upbound.io/v1beta1
      kapp.k14s.io/original: '{"apiVersion":"ecs.aws.upbound.io/v1beta1","kind":"TaskDefinition","metadata":{"annotations":{"boot.spring.io/version":"3.1.2","conventions.carto.run/applied-conventions":"appliveview-sample/app-live-view-appflavour-check\nspring-boot-convention/auto-configure-actuators-check\nspring-boot-convention/spring-boot\nspring-boot-convention/spring-boot-graceful-shutdown\nspring-boot-convention/spring-boot-web\nspring-boot-convention/spring-boot-actuator\nspring-boot-convention/spring-boot-actuator-probes\nspring-boot-convention/app-live-view-appflavour-check\nspring-boot-convention/app-live-view-connector-boot\nspring-boot-convention/app-live-view-appflavours-boot","developer.conventions/target-containers":"workload","kapp.k14s.io/change-group":"base","kapp.k14s.io/update-strategy":"always-replace"},"labels":{"app.kubernetes.io/component":"run","app.kubernetes.io/part-of":"ecs-test","apps.tanzu.vmware.com/has-tests":"true","apps.tanzu.vmware.com/workload-type":"ecs","carto.run/workload-name":"test2","kapp.k14s.io/app":"1694654951003852103","kapp.k14s.io/association":"v1.6bec2216eb3801939220210faba266ae"},"name":"test2-ecs-ns1"},"spec":{"deletionPolicy":"Delete","forProvider":{"containerDefinitions":"[\n   {\n      \"cpu\":
        0,\n      \"environment\": [\n         {\n            \"name\": \"JAVA_TOOL_OPTIONS\",\n            \"value\":
        \"-Dmanagement.endpoint.health.probes.add-additional-paths=\\\"true\\\" -Dmanagement.health.probes.enabled=\\\"true\\\"
        -Dserver.port=\\\"8080\\\" -Dserver.shutdown.grace-period=\\\"24s\\\"\"\n         }\n      ],\n      \"essential\":
        true,\n      \"image\": \"ghcr.io/mhoshi-vm/tap/workloads/test2-ecs-ns1@sha256:aecbaa1c127f2a0859a84e0e7ad4d3ce223d8d0670da50a5fffdfc86fc95b004\",\n      \"mountPoints\":
        [],\n      \"name\": \"workload\",\n      \"portMappings\": [\n         {\n            \"containerPort\":
        8080,\n            \"hostPort\": 8080,\n            \"protocol\": \"tcp\"\n         }\n      ],\n      \"user\":
        \"1000\",\n      \"volumesFrom\": []\n   }\n]","cpu":"512","family":"test2-ecs-ns1","memory":"1024","networkMode":"awsvpc","region":"us-west-2","requiresCompatibilities":["FARGATE"]},"initProvider":{},"managementPolicies":["*"],"providerConfigRef":{"name":"aws-provider"}}}'
      kapp.k14s.io/original-diff-md5: 58e0494c51d30eb3494f7c9198986bb9
      kapp.k14s.io/update-strategy: always-replace
      upjet.crossplane.io/provider-meta: '{"schema_version":"1"}'
    creationTimestamp: "2023-09-18T14:09:36Z"
    finalizers:
    - finalizer.managedresource.crossplane.io
    generation: 2
    labels:
      app.kubernetes.io/component: run
      app.kubernetes.io/part-of: ecs-test
      apps.tanzu.vmware.com/has-tests: "true"
      apps.tanzu.vmware.com/workload-type: ecs
      carto.run/workload-name: test2
      kapp.k14s.io/app: "1694654951003852103"
      kapp.k14s.io/association: v1.6bec2216eb3801939220210faba266ae
    name: test2-ecs-ns1
    resourceVersion: "10987629"
    uid: 364f418c-d280-41c1-b493-fbf5e3af4280
  spec:
    deletionPolicy: Delete
    forProvider:
      containerDefinitions: |-
        [
           {
              "cpu": 0,
              "environment": [
                 {
                    "name": "JAVA_TOOL_OPTIONS",
                    "value": "-Dmanagement.endpoint.health.probes.add-additional-paths=\"true\" -Dmanagement.health.probes.enabled=\"true\" -Dserver.port=\"8080\" -Dserver.shutdown.grace-period=\"24s\""
                 }
              ],
              "essential": true,
              "image": "ghcr.io/mhoshi-vm/tap/workloads/test2-ecs-ns1@sha256:aecbaa1c127f2a0859a84e0e7ad4d3ce223d8d0670da50a5fffdfc86fc95b004",
              "mountPoints": [],
              "name": "workload",
              "portMappings": [
                 {
                    "containerPort": 8080,
                    "hostPort": 8080,
                    "protocol": "tcp"
                 }
              ],
              "user": "1000",
              "volumesFrom": []
           }
        ]
      cpu: "512"
      family: test2-ecs-ns1
      memory: "1024"
      networkMode: awsvpc
      region: us-west-2
      requiresCompatibilities:
      - FARGATE
      tags:
        crossplane-kind: taskdefinition.ecs.aws.upbound.io
        crossplane-name: test2-ecs-ns1
        crossplane-providerconfig: aws-provider
    initProvider: {}
    managementPolicies:
    - '*'
    providerConfigRef:
      name: aws-provider
  status:
    atProvider:
      arn: arn:aws:ecs:us-west-2:XXXXXXXXXXXX:task-definition/test2-ecs-ns1:63
      arnWithoutRevision: arn:aws:ecs:us-west-2:XXXXXXXXXXXX:task-definition/test2-ecs-ns1
      containerDefinitions: '[{"cpu":0,"environment":[{"name":"JAVA_TOOL_OPTIONS","value":"-Dmanagement.endpoint.health.probes.add-additional-paths=\"true\"
        -Dmanagement.health.probes.enabled=\"true\" -Dserver.port=\"8080\" -Dserver.shutdown.grace-period=\"24s\""}],"essential":true,"image":"ghcr.io/mhoshi-vm/tap/workloads/test2-ecs-ns1@sha256:aecbaa1c127f2a0859a84e0e7ad4d3ce223d8d0670da50a5fffdfc86fc95b004","mountPoints":[],"name":"workload","portMappings":[{"containerPort":8080,"hostPort":8080,"protocol":"tcp"}],"user":"1000","volumesFrom":[]}]'
      cpu: "512"
      executionRoleArn: ""
      family: test2-ecs-ns1
      id: test2-ecs-ns1
      ipcMode: ""
      memory: "1024"
      networkMode: awsvpc
      pidMode: ""
      requiresCompatibilities:
      - FARGATE
      revision: 63
      skipDestroy: false
      tags:
        crossplane-kind: taskdefinition.ecs.aws.upbound.io
        crossplane-name: test2-ecs-ns1
        crossplane-providerconfig: aws-provider
      tagsAll:
        crossplane-kind: taskdefinition.ecs.aws.upbound.io
        crossplane-name: test2-ecs-ns1
        crossplane-providerconfig: aws-provider
      taskRoleArn: ""
    conditions:
    - lastTransitionTime: "2023-09-18T14:09:56Z"
      reason: Available
      status: "True"
      type: Ready
    - lastTransitionTime: "2023-09-18T14:09:40Z"
      reason: ReconcileSuccess
      status: "True"
      type: Synced
    - lastTransitionTime: "2023-09-18T14:09:43Z"
      reason: Success
      status: "True"
      type: LastAsyncOperation
    - lastTransitionTime: "2023-09-18T14:09:43Z"
      reason: Finished
      status: "True"
      type: AsyncOperation
- apiVersion: ecs.aws.upbound.io/v1beta1
  kind: Service
  metadata:
    annotations:
      boot.spring.io/version: 3.1.2
      conventions.carto.run/applied-conventions: |-
        appliveview-sample/app-live-view-appflavour-check
        spring-boot-convention/auto-configure-actuators-check
        spring-boot-convention/spring-boot
        spring-boot-convention/spring-boot-graceful-shutdown
        spring-boot-convention/spring-boot-web
        spring-boot-convention/spring-boot-actuator
        spring-boot-convention/spring-boot-actuator-probes
        spring-boot-convention/app-live-view-appflavour-check
        spring-boot-convention/app-live-view-connector-boot
        spring-boot-convention/app-live-view-appflavours-boot
      crossplane.io/external-create-succeeded: "2023-09-18T14:17:57Z"
      crossplane.io/external-name: test2-ecs-ns1
      developer.conventions/target-containers: workload
      kapp.k14s.io/change-rule.delete: delete before upserting lb
      kapp.k14s.io/change-rule.update: upsert after upserting lb
      kapp.k14s.io/identity: v1;/ecs.aws.upbound.io/Service/test2-ecs-ns1;ecs.aws.upbound.io/v1beta1
      kapp.k14s.io/original: '{"apiVersion":"ecs.aws.upbound.io/v1beta1","kind":"Service","metadata":{"annotations":{"boot.spring.io/version":"3.1.2","conventions.carto.run/applied-conventions":"appliveview-sample/app-live-view-appflavour-check\nspring-boot-convention/auto-configure-actuators-check\nspring-boot-convention/spring-boot\nspring-boot-convention/spring-boot-graceful-shutdown\nspring-boot-convention/spring-boot-web\nspring-boot-convention/spring-boot-actuator\nspring-boot-convention/spring-boot-actuator-probes\nspring-boot-convention/app-live-view-appflavour-check\nspring-boot-convention/app-live-view-connector-boot\nspring-boot-convention/app-live-view-appflavours-boot","developer.conventions/target-containers":"workload","kapp.k14s.io/change-rule.delete":"delete
        before upserting lb","kapp.k14s.io/change-rule.update":"upsert after upserting
        lb","kapp.k14s.io/update-strategy":"always-replace"},"labels":{"app.kubernetes.io/component":"run","app.kubernetes.io/part-of":"ecs-test","apps.tanzu.vmware.com/has-tests":"true","apps.tanzu.vmware.com/workload-type":"ecs","carto.run/workload-name":"test2","kapp.k14s.io/app":"1694654951003852103","kapp.k14s.io/association":"v1.10b1f7b7a81cea368bca8a10fdde250a"},"name":"test2-ecs-ns1"},"spec":{"deletionPolicy":"Delete","forProvider":{"cluster":"hoge","deploymentCircuitBreaker":[{"enable":false,"rollback":false}],"deploymentController":[{"type":"ECS"}],"deploymentMaximumPercent":200,"deploymentMinimumHealthyPercent":100,"desiredCount":1,"forceNewDeployment":true,"launchType":"FARGATE","loadBalancer":[{"containerName":"workload","containerPort":8080,"targetGroupArnRef":{"name":"test2-ecs-ns1"}}],"networkConfiguration":[{"securityGroupRefs":[{"name":"ecs-test2-ecs-ns1"}],"subnets":["subnet-ZZZZZZZZZZZ","subnet-YYYYYYYYYYYY"]}],"platformVersion":"LATEST","propagateTags":"NONE","region":"us-west-2","schedulingStrategy":"REPLICA","taskDefinitionRef":{"name":"test2-ecs-ns1","policy":{"resolution":"Required","resolve":"Always"}}},"initProvider":{},"managementPolicies":["*"],"providerConfigRef":{"name":"aws-provider"}}}'
      kapp.k14s.io/original-diff-md5: 58e0494c51d30eb3494f7c9198986bb9
      kapp.k14s.io/update-strategy: always-replace
      upjet.crossplane.io/provider-meta: '{"e2bfb730-ecaa-11e6-8f88-34363bc7c4c0":{"create":1200000000000,"delete":1200000000000,"update":1200000000000}}'
    creationTimestamp: "2023-09-18T14:13:53Z"
    finalizers:
    - finalizer.managedresource.crossplane.io
    generation: 4
    labels:
      app.kubernetes.io/component: run
      app.kubernetes.io/part-of: ecs-test
      apps.tanzu.vmware.com/has-tests: "true"
      apps.tanzu.vmware.com/workload-type: ecs
      carto.run/workload-name: test2
      kapp.k14s.io/app: "1694654951003852103"
      kapp.k14s.io/association: v1.10b1f7b7a81cea368bca8a10fdde250a
    name: test2-ecs-ns1
    resourceVersion: "11002013"
    uid: 8f81ec02-d8c6-44a9-a6ee-30f064e4ddb7
  spec:
    deletionPolicy: Delete
    forProvider:
      cluster: hoge
      deploymentCircuitBreaker:
      - enable: false
        rollback: false
      deploymentController:
      - type: ECS
      deploymentMaximumPercent: 200
      deploymentMinimumHealthyPercent: 100
      desiredCount: 1
      forceNewDeployment: true
      iamRole: /aws-service-role/ecs.amazonaws.com/AWSServiceRoleForECS
      launchType: FARGATE
      loadBalancer:
      - containerName: workload
        containerPort: 8080
        targetGroupArn: arn:aws:elasticloadbalancing:us-west-2:XXXXXXXXXXXX:targetgroup/test2-ecs-ns1/4b58312430cd2ea7
        targetGroupArnRef:
          name: test2-ecs-ns1
      networkConfiguration:
      - securityGroupRefs:
        - name: ecs-test2-ecs-ns1
        securityGroups:
        - sg-07f21d5ea10f4f02f
        subnets:
        - subnet-ZZZZZZZZZZZ
        - subnet-YYYYYYYYYYYY
      platformVersion: LATEST
      propagateTags: NONE
      region: us-west-2
      schedulingStrategy: REPLICA
      tags:
        crossplane-kind: service.ecs.aws.upbound.io
        crossplane-name: test2-ecs-ns1
        crossplane-providerconfig: aws-provider
      taskDefinition: arn:aws:ecs:us-west-2:XXXXXXXXXXXX:task-definition/test2-ecs-ns1:63
      taskDefinitionRef:
        name: test2-ecs-ns1
        policy:
          resolution: Required
          resolve: Always
    initProvider: {}
    managementPolicies:
    - '*'
    providerConfigRef:
      name: aws-provider
  status:
    atProvider:
      cluster: hoge
      deploymentCircuitBreaker:
      - enable: false
        rollback: false
      deploymentController:
      - type: ECS
      deploymentMaximumPercent: 200
      deploymentMinimumHealthyPercent: 100
      desiredCount: 1
      enableEcsManagedTags: false
      enableExecuteCommand: false
      forceNewDeployment: true
      healthCheckGracePeriodSeconds: 0
      iamRole: /aws-service-role/ecs.amazonaws.com/AWSServiceRoleForECS
      id: arn:aws:ecs:us-west-2:XXXXXXXXXXXX:service/hoge/test2-ecs-ns1
      launchType: FARGATE
      loadBalancer:
      - containerName: workload
        containerPort: 8080
        elbName: ""
        targetGroupArn: arn:aws:elasticloadbalancing:us-west-2:XXXXXXXXXXXX:targetgroup/test2-ecs-ns1/4b58312430cd2ea7
      networkConfiguration:
      - assignPublicIp: false
        securityGroups:
        - sg-07f21d5ea10f4f02f
        subnets:
        - subnet-YYYYYYYYYYYY
        - subnet-ZZZZZZZZZZZ
      platformVersion: LATEST
      propagateTags: NONE
      schedulingStrategy: REPLICA
      tags:
        crossplane-kind: service.ecs.aws.upbound.io
        crossplane-name: test2-ecs-ns1
        crossplane-providerconfig: aws-provider
      tagsAll:
        crossplane-kind: service.ecs.aws.upbound.io
        crossplane-name: test2-ecs-ns1
        crossplane-providerconfig: aws-provider
      taskDefinition: arn:aws:ecs:us-west-2:XXXXXXXXXXXX:task-definition/test2-ecs-ns1:63
      waitForSteadyState: false
    conditions:
    - lastTransitionTime: "2023-09-18T14:18:13Z"
      reason: Available
      status: "True"
      type: Ready
    - lastTransitionTime: "2023-09-18T14:17:57Z"
      reason: ReconcileSuccess
      status: "True"
      type: Synced
    - lastTransitionTime: "2023-09-18T14:18:00Z"
      reason: Success
      status: "True"
      type: LastAsyncOperation
    - lastTransitionTime: "2023-09-18T14:18:00Z"
      reason: Finished
      status: "True"
      type: AsyncOperation
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""

@turkenf
Copy link
Collaborator

turkenf commented Sep 27, 2023

/test-examples="examples/ecs/taskdefinition.yaml"

@turkenf
Copy link
Collaborator

turkenf commented Sep 27, 2023

@mhoshi-vm, could you please update the Service.ecs resource: If it does not require manual intervention and is created and deleted properly, can you remove this line?

@turkenf
Copy link
Collaborator

turkenf commented Oct 23, 2023

@mhoshi-vm, we will release a new version this week(Oct. 26), if you want to include this, please check the comments.

@turkenf
Copy link
Collaborator

turkenf commented Nov 28, 2023

Since there is no progress I am closing this PR, feel free to open it again if you want to continue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants