Skip to content

Commit 2e7756d

Browse files
fix: add the parameter sysdig_logging to the fargate_workload_agent (#186)
1 parent 24cbc8a commit 2e7756d

14 files changed

+24
-11
lines changed

.github/workflows/ci-pull-request.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ jobs:
7575
- name: Get dependencies
7676
run: |
7777
go get -u -v github.com/onsi/ginkgo/ginkgo
78+
go mod tidy
7879
7980
- name: Test
8081
run: make test

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.15
44

55
require (
66
cloud.google.com/go/storage v1.13.0 // indirect
7-
github.com/Jeffail/gabs/v2 v2.6.1 // indirect
7+
github.com/Jeffail/gabs/v2 v2.6.1
88
github.com/agext/levenshtein v1.2.3 // indirect
99
github.com/apparentlymart/go-cidr v1.1.0 // indirect
1010
github.com/aws/aws-sdk-go v1.42.32
@@ -28,8 +28,9 @@ require (
2828
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
2929
github.com/oklog/run v1.1.0 // indirect
3030
github.com/opencontainers/image-spec v1.0.2 // indirect
31-
github.com/rs/zerolog v1.26.1 // indirect
31+
github.com/rs/zerolog v1.26.1
3232
github.com/spf13/cast v1.4.1
33+
github.com/stretchr/testify v1.7.0
3334
github.com/ulikunitz/xz v0.5.10 // indirect
3435
github.com/zclconf/go-cty v1.10.0 // indirect
3536
golang.org/x/net v0.0.0-20220111093109-d55c255bac03 // indirect

sysdig/data_source_sysdig_fargate_ECS_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var (
2020
OrchestratorPort: "orchestrator_port",
2121
CollectorHost: "collector_host",
2222
CollectorPort: "collector_port",
23+
SysdigLogging: "sysdig_logging",
2324
}
2425

2526
testContainerDefinitionFiles = []string{
@@ -67,6 +68,7 @@ func TestECStransformation(t *testing.T) {
6768
OrchestratorPort: "orchestrator_port",
6869
CollectorHost: "collector_host",
6970
CollectorPort: "collector_port",
71+
SysdigLogging: "sysdig_logging",
7072
}
7173

7274
jsonConf, err := json.Marshal(&recipeConfig)

sysdig/data_source_sysdig_fargate_workload_agent.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const agentinoKiltDefinition = `build {
2424
"SYSDIG_COLLECTOR": ${config.collector_host}
2525
"SYSDIG_COLLECTOR_PORT": ${config.collector_port}
2626
"SYSDIG_ACCESS_KEY": ${config.sysdig_access_key}
27-
"SYSDIG_LOGGING": ""
27+
"SYSDIG_LOGGING": ${config.sysdig_logging}
2828
}
2929
mount: [
3030
{
@@ -106,6 +106,11 @@ func dataSourceSysdigFargateWorkloadAgent() *schema.Resource {
106106
},
107107
},
108108
},
109+
"sysdig_logging": {
110+
Type: schema.TypeString,
111+
Description: "the instrumentation logging level",
112+
Optional: true,
113+
},
109114
"output_container_definitions": {
110115
Type: schema.TypeString,
111116
Computed: true,
@@ -236,6 +241,7 @@ type KiltRecipeConfig struct {
236241
OrchestratorPort string `json:"orchestrator_port"`
237242
CollectorHost string `json:"collector_host"`
238243
CollectorPort string `json:"collector_port"`
244+
SysdigLogging string `json:"sysdig_logging"`
239245
}
240246

241247
func dataSourceSysdigFargateWorkloadAgentRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
@@ -246,6 +252,7 @@ func dataSourceSysdigFargateWorkloadAgentRead(ctx context.Context, d *schema.Res
246252
OrchestratorPort: d.Get("orchestrator_port").(string),
247253
CollectorHost: d.Get("collector_host").(string),
248254
CollectorPort: d.Get("collector_port").(string),
255+
SysdigLogging: d.Get("sysdig_logging").(string),
249256
}
250257

251258
jsonConf, err := json.Marshal(&recipeConfig)

sysdig/data_source_sysdig_fargate_workload_agent_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ data "sysdig_fargate_workload_agent" "test" {
3434
collector_port = 1234
3535
sysdig_access_key = "abcdef"
3636
workload_agent_image = "busybox"
37+
sysdig_logging = "info"
3738
}
3839
`
3940
}

sysdig/testfiles/ECSInstrumented.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
{
1919
"Name": "SYSDIG_LOGGING",
20-
"Value": ""
20+
"Value": "sysdig_logging"
2121
},
2222
{
2323
"Name": "SYSDIG_ENDPOINT",

sysdig/testfiles/fargate_cmd_test_expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
},
3131
{
3232
"Name": "SYSDIG_LOGGING",
33-
"Value": ""
33+
"Value": "sysdig_logging"
3434
},
3535
{
3636
"Name": "SYSDIG_ORCHESTRATOR",

sysdig/testfiles/fargate_combined_test_expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
},
3131
{
3232
"Name": "SYSDIG_LOGGING",
33-
"Value": ""
33+
"Value": "sysdig_logging"
3434
},
3535
{
3636
"Name": "SYSDIG_ORCHESTRATOR",

sysdig/testfiles/fargate_entrypoint_test_expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
{
2929
"Name": "SYSDIG_LOGGING",
30-
"Value": ""
30+
"Value": "sysdig_logging"
3131
},
3232
{
3333
"Name": "SYSDIG_ORCHESTRATOR",

sysdig/testfiles/fargate_env_test_expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
{
2929
"Name": "SYSDIG_LOGGING",
30-
"Value": ""
30+
"Value": "sysdig_logging"
3131
},
3232
{
3333
"Name": "SYSDIG_ORCHESTRATOR",

0 commit comments

Comments
 (0)