bottlerocket-os / bottlerocket

An operating system designed for hosting containers
https://bottlerocket.dev
Other
8.78k stars 519 forks source link

Port ecs settings extension #3984

Closed mgsharm closed 5 months ago

mgsharm commented 5 months ago

Issue number:

Closes #3662

Description of changes:

Testing done:

[ssm-user@control]$ apiclient set --json '{"settings": {"ecs": {"cluster":"test-cluster","instance-attributes":{"attribute1":"value1","attribute2":"value2"},"allow-privileged-containers":true,"logging-drivers":["json-file","awslogs"],"loglevel":"info","enable-spot-instance-draining":true,"image-pull-behavior":"always","container-stop-timeout":"30s","task-cleanup-wait":"1h","metadata-service-rps":50,"metadata-service-burst":100,"reserved-memory":512,"image-cleanup-wait":"1h","image-cleanup-delete-per-cycle":2,"image-cleanup-enabled":true,"image-cleanup-age":"1h","backend-host":"ecs.us-east-1.amazonaws.com","awsvpc-block-imds":true,"enable-container-metadata":true}}}'
[ssm-user@control]$ apiclient get settings.ecs
{
  "settings": {
    "ecs": {
      "allow-privileged-containers": true,
      "awsvpc-block-imds": true,
      "backend-host": "ecs.us-east-1.amazonaws.com",
      "cluster": "test-cluster",
      "container-stop-timeout": "30s",
      "enable-container-metadata": true,
      "enable-spot-instance-draining": true,
      "image-cleanup-age": "1h",
      "image-cleanup-delete-per-cycle": 2,
      "image-cleanup-enabled": true,
      "image-cleanup-wait": "1h",
      "image-pull-behavior": "always",
      "instance-attributes": {
        "attribute1": "value1",
        "attribute2": "value2"
      },
      "logging-drivers": [
        "json-file",
        "awslogs"
      ],
      "loglevel": "info",
      "metadata-service-burst": 100,
      "metadata-service-rps": 50,
      "reserved-memory": 512,
      "task-cleanup-wait": "1h"
    }
  }
}
> cargo run proto1 set --setting-version v1 --value '{"cluster":"test-cluster","instance-attributes":{"attribute1":"value1","attribute2":"value2"},"allow-privileged-containers":true,"logging-drivers":["json-file","awslogs"],"loglevel":"info","enable-spot-instance-draining":true,"image-pull-behavior":"always","container-stop-timeout":"30s","task-cleanup-wait":"1h","metadata-service-rps":50,"metadata-service-burst":100,"reserved-memory":512,"image-cleanup-wait":"1h","image-cleanup-delete-per-cycle":2,"image-cleanup-enabled":true,"image-cleanup-age":"1h","backend-host":"ecs.us-east-1.amazonaws.com","awsvpc-block-imds":true,"enable-container-metadata":true}'
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.96s
     Running `/Users/mgsharm/bottlerocket/bottlerocket/sources/target/debug/settings-extension-ecs proto1 set --setting-version v1 --value '{"cluster":"test-cluster","instance-attributes":{"attribute1":"value1","attribute2":"value2"},"allow-privileged-containers":true,"logging-drivers":["json-file","awslogs"],"loglevel":"info","enable-spot-instance-draining":true,"image-pull-behavior":"always","container-stop-timeout":"30s","task-cleanup-wait":"1h","metadata-service-rps":50,"metadata-service-burst":100,"reserved-memory":512,"image-cleanup-wait":"1h","image-cleanup-delete-per-cycle":2,"image-cleanup-enabled":true,"image-cleanup-age":"1h","backend-host":"ecs.us-east-1.amazonaws.com","awsvpc-block-imds":true,"enable-container-metadata":true}'`

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.