Skip to content

Add a new generator config to append an Age printcolumn #84

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

Merged
merged 1 commit into from
Jun 16, 2021

Conversation

a-hilaly
Copy link
Member

@a-hilaly a-hilaly commented Jun 8, 2021

Issue: aws-controllers-k8s/community#822

Since All kubernetes resources have a .metadata.creationTimestamp field,
we need a way to instruct the code generator to generate kubebuilder
marker comments that will append the AGE field the kubectl get
response.

This patch extends Resource.PrintConfig to allow configuring the
ack-generate to generate such marker comments.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ack-bot ack-bot requested review from jaypipes and vijtrip2 June 8, 2021 14:16
@a-hilaly
Copy link
Member Author

a-hilaly commented Jun 8, 2021

Waiting for rebase after #83 and #82
/hold

@ack-bot ack-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 8, 2021
@a-hilaly a-hilaly force-pushed the resource-print-age branch from 72e19ef to 66d727c Compare June 8, 2021 15:02
Since All kubernetes resources have a `.metadata.creationTimestamp` field,
we need a way to instruct the code generator to generate kubebuilder
marker comments that will append the AGE field the `kubectl get`
response.

This patch extends `Resource.PrintConfig` to allow configuring the
`ack-generate` to generate such marker comments.
@a-hilaly a-hilaly force-pushed the resource-print-age branch from 66d727c to 538402c Compare June 9, 2021 11:43
@a-hilaly
Copy link
Member Author

/unhold

@ack-bot ack-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 10, 2021
@@ -50,6 +50,9 @@ type {{ .CRD.Kind }}Status struct {
{{- range $column := .CRD.AdditionalPrinterColumns }}
// +kubebuilder:printcolumn:name="{{$column.Name}}",type={{$column.Type}},JSONPath=`{{$column.JSONPath}}`
{{- end }}
{{- if .CRD.PrintAgeColumn }}
// +kubebuilder:printcolumn:name="Age",type="date",priority=0,JSONPath=".metadata.creationTimestamp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Priority 0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's also the default for all the builtin types (pods, services..)

@vijtrip2
Copy link
Contributor

/approve

@jaypipes
Copy link
Collaborator

/lgtm

@ack-bot ack-bot added the lgtm Indicates that a PR is ready to be merged. label Jun 16, 2021
@ack-bot
Copy link
Collaborator

ack-bot commented Jun 16, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: A-Hilaly, jaypipes, RedbackThomson, vijtrip2

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [A-Hilaly,RedbackThomson,jaypipes,vijtrip2]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ack-bot ack-bot merged commit 878da89 into aws-controllers-k8s:main Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants