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

new(serverless-agent): support sidecar mode (disabled by default) #460

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions sysdig/data_source_sysdig_fargate_workload_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const agentinoKiltDefinition = `build {
"SYSDIG_COLLECTOR_PORT": ${config.collector_port}
"SYSDIG_ACCESS_KEY": ${config.sysdig_access_key}
"SYSDIG_LOGGING": ${config.sysdig_logging}
"SYSDIG_SIDECAR": ${config.sidecar}
}
capabilities: ["SYS_PTRACE"]
mount: [
Expand Down Expand Up @@ -125,6 +126,12 @@ func dataSourceSysdigFargateWorkloadAgent() *schema.Resource {
Description: "the instrumentation logging level",
Optional: true,
},
"sidecar": {
Type: schema.TypeString,
Description: "Sidecar mode: auto/force/(empty string)",
Default: "", // we will want to change this to "auto" eventually
Optional: true,
},
"output_container_definitions": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -300,6 +307,7 @@ type KiltRecipeConfig struct {
CollectorHost string `json:"collector_host"`
CollectorPort string `json:"collector_port"`
SysdigLogging string `json:"sysdig_logging"`
Sidecar string `json:"sidecar"`
}

type patchOptions struct {
Expand Down Expand Up @@ -347,6 +355,7 @@ func dataSourceSysdigFargateWorkloadAgentRead(ctx context.Context, d *schema.Res
CollectorHost: d.Get("collector_host").(string),
CollectorPort: d.Get("collector_port").(string),
SysdigLogging: d.Get("sysdig_logging").(string),
Sidecar: d.Get("sidecar").(string),
}

jsonConf, err := json.Marshal(&recipeConfig)
Expand Down
8 changes: 8 additions & 0 deletions sysdig/testfiles/ECSInstrumented.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ENDPOINT",
"Value": "value"
Expand Down Expand Up @@ -86,6 +90,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ENDPOINT",
"Value": "value"
Expand Down
12 changes: 12 additions & 0 deletions sysdig/testfiles/fargate_bare_pdig_expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down Expand Up @@ -86,6 +90,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down Expand Up @@ -164,6 +172,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down
8 changes: 8 additions & 0 deletions sysdig/testfiles/fargate_cmd_test_expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down Expand Up @@ -81,6 +85,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down
8 changes: 8 additions & 0 deletions sysdig/testfiles/fargate_combined_test_expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down Expand Up @@ -93,6 +97,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down
8 changes: 8 additions & 0 deletions sysdig/testfiles/fargate_entrypoint_test_expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down Expand Up @@ -78,6 +82,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down
8 changes: 8 additions & 0 deletions sysdig/testfiles/fargate_env_test_expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down Expand Up @@ -86,6 +90,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down
12 changes: 12 additions & 0 deletions sysdig/testfiles/fargate_field_case_test_expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down Expand Up @@ -78,6 +82,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down Expand Up @@ -127,6 +135,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down Expand Up @@ -92,6 +96,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down
8 changes: 8 additions & 0 deletions sysdig/testfiles/fargate_linuxparameters_test_expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down Expand Up @@ -81,6 +85,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down
8 changes: 8 additions & 0 deletions sysdig/testfiles/fargate_log_group_expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down Expand Up @@ -90,6 +94,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down
8 changes: 8 additions & 0 deletions sysdig/testfiles/fargate_volumesfrom_test_expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down Expand Up @@ -85,6 +89,10 @@
"Name": "SYSDIG_LOGGING",
"Value": "sysdig_logging"
},
{
"Name": "SYSDIG_SIDECAR",
"Value": ""
},
{
"Name": "SYSDIG_ORCHESTRATOR",
"Value": "orchestrator_host"
Expand Down
Loading