Skip to content

Commit 8b8efe1

Browse files
chore(fargate): Remove deprecated Orchestrator code
1 parent 127a273 commit 8b8efe1

14 files changed

+23
-262
lines changed

sysdig/data_source_sysdig_fargate_ECS_test.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,12 @@ func sortAndCompare(t *testing.T, expected []byte, actual []byte) {
4242
// getKiltRecipe returns the default json Kilt recipe
4343
func getKiltRecipe(t *testing.T) string {
4444
recipeConfig := KiltRecipeConfig{
45-
SysdigAccessKey: "sysdig_access_key",
46-
AgentImage: "workload_agent_image",
47-
OrchestratorHost: "orchestrator_host",
48-
OrchestratorPort: "orchestrator_port",
49-
CollectorHost: "collector_host",
50-
CollectorPort: "collector_port",
51-
SysdigLogging: "sysdig_logging",
52-
Priority: "priority",
45+
SysdigAccessKey: "sysdig_access_key",
46+
AgentImage: "workload_agent_image",
47+
CollectorHost: "collector_host",
48+
CollectorPort: "collector_port",
49+
SysdigLogging: "sysdig_logging",
50+
Priority: "priority",
5351
}
5452

5553
jsonRecipeConfig, err := json.Marshal(&recipeConfig)

sysdig/data_source_sysdig_fargate_workload_agent.go

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ const agentinoKiltDefinition = `build {
2020
entry_point: ["/opt/draios/bin/instrument"]
2121
command: ${?original.entry_point} ${?original.command}
2222
environment_variables: {
23-
"SYSDIG_ORCHESTRATOR": ${config.orchestrator_host}
24-
"SYSDIG_ORCHESTRATOR_PORT": ${config.orchestrator_port}
2523
"SYSDIG_COLLECTOR": ${config.collector_host}
2624
"SYSDIG_COLLECTOR_PORT": ${config.collector_port}
2725
"SYSDIG_ACCESS_KEY": ${config.sysdig_access_key}
@@ -65,16 +63,6 @@ func dataSourceSysdigFargateWorkloadAgent() *schema.Resource {
6563
Description: "registry authentication secret",
6664
Optional: true,
6765
},
68-
"orchestrator_host": {
69-
Type: schema.TypeString,
70-
Description: "the orchestrator host to connect to",
71-
Optional: true,
72-
},
73-
"orchestrator_port": {
74-
Type: schema.TypeString,
75-
Description: "the orchestrator port to connect to",
76-
Optional: true,
77-
},
7866
"collector_host": {
7967
Type: schema.TypeString,
8068
Description: "the collector host to connect to",
@@ -360,15 +348,13 @@ func patchFargateTaskDefinition(ctx context.Context, containerDefinitions string
360348
}
361349

362350
type KiltRecipeConfig struct {
363-
SysdigAccessKey string `json:"sysdig_access_key"`
364-
AgentImage string `json:"agent_image"`
365-
OrchestratorHost string `json:"orchestrator_host"`
366-
OrchestratorPort string `json:"orchestrator_port"`
367-
CollectorHost string `json:"collector_host"`
368-
CollectorPort string `json:"collector_port"`
369-
SysdigLogging string `json:"sysdig_logging"`
370-
Sidecar string `json:"sidecar"`
371-
Priority string `json:"priority"`
351+
SysdigAccessKey string `json:"sysdig_access_key"`
352+
AgentImage string `json:"agent_image"`
353+
CollectorHost string `json:"collector_host"`
354+
CollectorPort string `json:"collector_port"`
355+
SysdigLogging string `json:"sysdig_logging"`
356+
Sidecar string `json:"sidecar"`
357+
Priority string `json:"priority"`
372358
}
373359

374360
type patchOptions struct {
@@ -443,15 +429,13 @@ func dataSourceSysdigFargateWorkloadAgentRead(ctx context.Context, d *schema.Res
443429
}
444430

445431
recipeConfig := KiltRecipeConfig{
446-
SysdigAccessKey: d.Get("sysdig_access_key").(string),
447-
AgentImage: d.Get("workload_agent_image").(string),
448-
OrchestratorHost: d.Get("orchestrator_host").(string),
449-
OrchestratorPort: d.Get("orchestrator_port").(string),
450-
CollectorHost: d.Get("collector_host").(string),
451-
CollectorPort: d.Get("collector_port").(string),
452-
SysdigLogging: d.Get("sysdig_logging").(string),
453-
Sidecar: d.Get("sidecar").(string),
454-
Priority: priority,
432+
SysdigAccessKey: d.Get("sysdig_access_key").(string),
433+
AgentImage: d.Get("workload_agent_image").(string),
434+
CollectorHost: d.Get("collector_host").(string),
435+
CollectorPort: d.Get("collector_port").(string),
436+
SysdigLogging: d.Get("sysdig_logging").(string),
437+
Sidecar: d.Get("sidecar").(string),
438+
Priority: priority,
455439
}
456440

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

sysdig/data_source_sysdig_fargate_workload_agent_test.go

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ import (
1111
"github.com/draios/terraform-provider-sysdig/sysdig"
1212
)
1313

14-
// Direct connection mode has been deprecated in Prod envs
15-
func TestAccSysdigFargateWorkloadAgentDirectConnection(t *testing.T) {
14+
func TestAccSysdigFargateWorkloadAgent(t *testing.T) {
1615
resource.ParallelTest(t, resource.TestCase{
1716
ProviderFactories: map[string]func() (*schema.Provider, error){
1817
"sysdig": func() (*schema.Provider, error) {
@@ -21,13 +20,13 @@ func TestAccSysdigFargateWorkloadAgentDirectConnection(t *testing.T) {
2120
},
2221
Steps: []resource.TestStep{
2322
{
24-
Config: getFargateWorkloadAgentDirectConnection(),
23+
Config: getFargateWorkloadAgent(),
2524
},
2625
},
2726
})
2827
}
2928

30-
func getFargateWorkloadAgentDirectConnection() string {
29+
func getFargateWorkloadAgent() string {
3130
return `
3231
data "sysdig_fargate_workload_agent" "test" {
3332
container_definitions = "[]"
@@ -41,31 +40,3 @@ data "sysdig_fargate_workload_agent" "test" {
4140
}
4241
`
4342
}
44-
45-
func TestAccSysdigFargateWorkloadAgentOrchestrated(t *testing.T) {
46-
resource.ParallelTest(t, resource.TestCase{
47-
ProviderFactories: map[string]func() (*schema.Provider, error){
48-
"sysdig": func() (*schema.Provider, error) {
49-
return sysdig.Provider(), nil
50-
},
51-
},
52-
Steps: []resource.TestStep{
53-
{
54-
Config: getFargateWorkloadAgentOrchestrated(),
55-
},
56-
},
57-
})
58-
}
59-
60-
func getFargateWorkloadAgentOrchestrated() string {
61-
return `
62-
data "sysdig_fargate_workload_agent" "test" {
63-
container_definitions = "[]"
64-
65-
orchestrator_host = "sysdig.orchestrator.agent.com"
66-
orchestrator_port = 6667
67-
workload_agent_image = "quay.io/sysdig/workload-agent:latest"
68-
sysdig_logging = "info"
69-
}
70-
`
71-
}

sysdig/testfiles/ECSInstrumented.json

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@
3535
"Name": "pmet",
3636
"Value": "temp"
3737
},
38-
{
39-
"Name": "SYSDIG_ORCHESTRATOR",
40-
"Value": "orchestrator_host"
41-
},
42-
{
43-
"Name": "SYSDIG_ORCHESTRATOR_PORT",
44-
"Value": "orchestrator_port"
45-
},
4638
{
4739
"Name": "SYSDIG_COLLECTOR",
4840
"Value": "collector_host"
@@ -110,14 +102,6 @@
110102
"Name": "pmet",
111103
"Value": "temp"
112104
},
113-
{
114-
"Name": "SYSDIG_ORCHESTRATOR",
115-
"Value": "orchestrator_host"
116-
},
117-
{
118-
"Name": "SYSDIG_ORCHESTRATOR_PORT",
119-
"Value": "orchestrator_port"
120-
},
121105
{
122106
"Name": "SYSDIG_COLLECTOR",
123107
"Value": "collector_host"

sysdig/testfiles/fargate_bare_pdig_expected.json

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
"/bin/test"
1010
],
1111
"Environment": [
12-
{
13-
"Name": "SYSDIG_ORCHESTRATOR_PORT",
14-
"Value": "orchestrator_port"
15-
},
1612
{
1713
"Name": "SYSDIG_COLLECTOR",
1814
"Value": "collector_host"
@@ -37,10 +33,6 @@
3733
"Name": "SYSDIG_SIDECAR",
3834
"Value": ""
3935
},
40-
{
41-
"Name": "SYSDIG_ORCHESTRATOR",
42-
"Value": "orchestrator_host"
43-
},
4436
{
4537
"Name": "GIMME",
4638
"Value": "friedChicken"
@@ -74,10 +66,6 @@
7466
"/bin/test"
7567
],
7668
"Environment": [
77-
{
78-
"Name": "SYSDIG_ORCHESTRATOR_PORT",
79-
"Value": "orchestrator_port"
80-
},
8169
{
8270
"Name": "SYSDIG_COLLECTOR",
8371
"Value": "collector_host"
@@ -102,10 +90,6 @@
10290
"Name": "SYSDIG_SIDECAR",
10391
"Value": ""
10492
},
105-
{
106-
"Name": "SYSDIG_ORCHESTRATOR",
107-
"Value": "orchestrator_host"
108-
},
10993
{
11094
"Name": "GIMME",
11195
"Value": "friedChicken"
@@ -160,10 +144,6 @@
160144
"CredentialsParameter": "image_auth_secret"
161145
},
162146
"Environment": [
163-
{
164-
"Name": "SYSDIG_ORCHESTRATOR_PORT",
165-
"Value": "orchestrator_port"
166-
},
167147
{
168148
"Name": "SYSDIG_COLLECTOR",
169149
"Value": "collector_host"
@@ -188,10 +168,6 @@
188168
"Name": "SYSDIG_SIDECAR",
189169
"Value": ""
190170
},
191-
{
192-
"Name": "SYSDIG_ORCHESTRATOR",
193-
"Value": "orchestrator_host"
194-
},
195171
{
196172
"Name": "GIMME",
197173
"Value": "friedChicken"

sysdig/testfiles/fargate_cmd_test_expected.json

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
"test-arg-value"
1313
],
1414
"Environment": [
15-
{
16-
"Name": "SYSDIG_ORCHESTRATOR_PORT",
17-
"Value": "orchestrator_port"
18-
},
1915
{
2016
"Name": "SYSDIG_COLLECTOR",
2117
"Value": "collector_host"
@@ -39,10 +35,6 @@
3935
{
4036
"Name": "SYSDIG_SIDECAR",
4137
"Value": ""
42-
},
43-
{
44-
"Name": "SYSDIG_ORCHESTRATOR",
45-
"Value": "orchestrator_host"
4638
}
4739
],
4840
"LinuxParameters": {
@@ -69,10 +61,6 @@
6961
"CredentialsParameter": "image_auth_secret"
7062
},
7163
"Environment": [
72-
{
73-
"Name": "SYSDIG_ORCHESTRATOR_PORT",
74-
"Value": "orchestrator_port"
75-
},
7664
{
7765
"Name": "SYSDIG_COLLECTOR",
7866
"Value": "collector_host"
@@ -96,10 +84,6 @@
9684
{
9785
"Name": "SYSDIG_SIDECAR",
9886
"Value": ""
99-
},
100-
{
101-
"Name": "SYSDIG_ORCHESTRATOR",
102-
"Value": "orchestrator_host"
10387
}
10488
]
10589
}

sysdig/testfiles/fargate_combined_test_expected.json

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
"test-arg-value"
1313
],
1414
"Environment": [
15-
{
16-
"Name": "SYSDIG_ORCHESTRATOR_PORT",
17-
"Value": "orchestrator_port"
18-
},
1915
{
2016
"Name": "SYSDIG_COLLECTOR",
2117
"Value": "collector_host"
@@ -40,10 +36,6 @@
4036
"Name": "SYSDIG_SIDECAR",
4137
"Value": ""
4238
},
43-
{
44-
"Name": "SYSDIG_ORCHESTRATOR",
45-
"Value": "orchestrator_host"
46-
},
4739
{
4840
"Name": "TMP",
4941
"Value": "temporary"
@@ -81,10 +73,6 @@
8173
"CredentialsParameter": "image_auth_secret"
8274
},
8375
"Environment": [
84-
{
85-
"Name": "SYSDIG_ORCHESTRATOR_PORT",
86-
"Value": "orchestrator_port"
87-
},
8876
{
8977
"Name": "SYSDIG_COLLECTOR",
9078
"Value": "collector_host"
@@ -109,10 +97,6 @@
10997
"Name": "SYSDIG_SIDECAR",
11098
"Value": ""
11199
},
112-
{
113-
"Name": "SYSDIG_ORCHESTRATOR",
114-
"Value": "orchestrator_host"
115-
},
116100
{
117101
"Name": "TMP",
118102
"Value": "temporary"

sysdig/testfiles/fargate_entrypoint_test_expected.json

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
"/bin/test"
1010
],
1111
"Environment": [
12-
{
13-
"Name": "SYSDIG_ORCHESTRATOR_PORT",
14-
"Value": "orchestrator_port"
15-
},
1612
{
1713
"Name": "SYSDIG_COLLECTOR",
1814
"Value": "collector_host"
@@ -36,10 +32,6 @@
3632
{
3733
"Name": "SYSDIG_SIDECAR",
3834
"Value": ""
39-
},
40-
{
41-
"Name": "SYSDIG_ORCHESTRATOR",
42-
"Value": "orchestrator_host"
4335
}
4436
],
4537
"LinuxParameters": {
@@ -66,10 +58,6 @@
6658
"CredentialsParameter": "image_auth_secret"
6759
},
6860
"Environment": [
69-
{
70-
"Name": "SYSDIG_ORCHESTRATOR_PORT",
71-
"Value": "orchestrator_port"
72-
},
7361
{
7462
"Name": "SYSDIG_COLLECTOR",
7563
"Value": "collector_host"
@@ -93,10 +81,6 @@
9381
{
9482
"Name": "SYSDIG_SIDECAR",
9583
"Value": ""
96-
},
97-
{
98-
"Name": "SYSDIG_ORCHESTRATOR",
99-
"Value": "orchestrator_host"
10084
}
10185
]
10286
}

0 commit comments

Comments
 (0)