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

Show status of fargate profile in get command. #2886

Merged
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
8 changes: 7 additions & 1 deletion pkg/apis/eksctl.io/v1alpha5/assets/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,11 @@
"description": "define the rules to select workload to schedule onto Fargate.",
"x-intellij-html-description": "define the rules to select workload to schedule onto Fargate."
},
"status": {
"type": "string",
"description": "The current status of the Fargate profile.",
"x-intellij-html-description": "The current status of the Fargate profile."
},
"subnets": {
"items": {
"type": "string"
Expand All @@ -616,7 +621,8 @@
"podExecutionRoleARN",
"selectors",
"subnets",
"tags"
"tags",
"status"
],
"additionalProperties": false,
"description": "defines the settings used to schedule workload onto Fargate.",
Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/eksctl.io/v1alpha5/schema.go

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions pkg/apis/eksctl.io/v1alpha5/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,9 @@ type FargateProfile struct {
// Used to tag the AWS resources
// +optional
Tags map[string]string `json:"tags,omitempty"`

// The current status of the Fargate profile.
Status string `json:"status"`
}

// FargateProfileSelector defines rules to select workload to schedule onto Fargate.
Expand Down
1 change: 1 addition & 0 deletions pkg/fargate/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ func toFargateProfile(in *eks.FargateProfile) *api.FargateProfile {
PodExecutionRoleARN: strings.EmptyIfNil(in.PodExecutionRoleArn),
Subnets: strings.ToValuesArray(in.Subnets),
Tags: strings.ToValuesMap(in.Tags),
Status: *in.Status,
}
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/fargate/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ func createProfileWithoutTag() *api.FargateProfile {
},
},
},
Status: "ACTIVE",
}
}

Expand Down Expand Up @@ -350,6 +351,7 @@ func apiFargateProfile(name string) *api.FargateProfile {
},
Subnets: []string{},
Tags: map[string]string{},
Status: "ACTIVE",
}
}

Expand Down
5 changes: 5 additions & 0 deletions pkg/fargate/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type row struct {
Subnets []string
Selector api.FargateProfileSelector
Tags map[string]string
Status string
}

func toTable(profiles []*api.FargateProfile) []*row {
Expand All @@ -47,6 +48,7 @@ func toTable(profiles []*api.FargateProfile) []*row {
Subnets: profile.Subnets,
Selector: selector,
Tags: profile.Tags,
Status: profile.Status,
})
}
}
Expand Down Expand Up @@ -75,4 +77,7 @@ func addFargateProfileColumns(printer *printers.TablePrinter) {
printer.AddColumn("TAGS", func(r *row) string {
return labels.FormatLabels(r.Tags)
})
printer.AddColumn("STATUS", func(r *row) string {
return r.Status
})
}
18 changes: 12 additions & 6 deletions pkg/fargate/print_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ var _ = Describe("fargate", func() {
})
})

const expectedTable = `NAME SELECTOR_NAMESPACE SELECTOR_LABELS POD_EXECUTION_ROLE_ARN SUBNETS TAGS
fp-prod prod env=prod arn:aws:iam::123:role/root subnet-prod,subnet-d34dc0w <none>
fp-test default <none> arn:aws:iam::123:role/root <none> app=my-app,env=test
fp-test kube-system app=my-app,env=test arn:aws:iam::123:role/root <none> app=my-app,env=test
const expectedTable = `NAME SELECTOR_NAMESPACE SELECTOR_LABELS POD_EXECUTION_ROLE_ARN SUBNETS TAGS STATUS
fp-prod prod env=prod arn:aws:iam::123:role/root subnet-prod,subnet-d34dc0w <none> ACTIVE
fp-test default <none> arn:aws:iam::123:role/root <none> app=my-app,env=test ACTIVE
fp-test kube-system app=my-app,env=test arn:aws:iam::123:role/root <none> app=my-app,env=test ACTIVE
`

const expectedYAML = `- name: fp-test
Expand All @@ -60,6 +60,7 @@ const expectedYAML = `- name: fp-test
env: test
namespace: kube-system
- namespace: default
status: ACTIVE
tags:
app: my-app
env: test
Expand All @@ -69,6 +70,7 @@ const expectedYAML = `- name: fp-test
- labels:
env: prod
namespace: prod
status: ACTIVE
subnets:
- subnet-prod
- subnet-d34dc0w
Expand All @@ -93,7 +95,8 @@ const expectedJSON = `[
"tags": {
"app": "my-app",
"env": "test"
}
},
"status": "ACTIVE"
},
{
"name": "fp-prod",
Expand All @@ -109,7 +112,8 @@ const expectedJSON = `[
"subnets": [
"subnet-prod",
"subnet-d34dc0w"
]
],
"status": "ACTIVE"
}
]`

Expand All @@ -134,6 +138,7 @@ func sampleProfiles() []*api.FargateProfile {
"app": "my-app",
"env": "test",
},
Status: "ACTIVE",
},
{
Name: "fp-prod",
Expand All @@ -147,6 +152,7 @@ func sampleProfiles() []*api.FargateProfile {
},
},
PodExecutionRoleARN: "arn:aws:iam::123:role/root",
Status: "ACTIVE",
},
}
}