Skip to content

Conversation

a-hilaly
Copy link
Member

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

Issue N/A

Initially we used to have one config field ("is_printable") under
ackconfig.FieldConfig to instruct the code generator to generate
kubebuilder marker comments in order to include the field in kubectl get
response.

Time passed and we are in a situation where want to tune more the way
we print these fields and extend the kubebuilder:printcolumns comment
markers to include options like priority, order and default columns.

This patch reworks the field configuration structure and prepare the
laying ground for future print config fields.

This patch will simplify the realization of the following issues:

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

@a-hilaly
Copy link
Member Author

a-hilaly commented Jun 8, 2021

@jaypipes @RedbackThomson i'm aware that this is a breaking change, but TBH this is necessary to minimize damage (very verbose and non-understandable config files) in the future.
I made a research and it looks like only sagemaker-controller uses "is_printable" field - i'll make sure to make the necessary changes there.

name: DeploymentConfig
Description:
is_printable: true
print: {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not a huge fan of this, as I feel it is overly verbose and easy to mess up :)

How about we just remove the IsPrintable field and keep the PrintName field, but make it a *string instead of string and just require any printable column to have PrintName set to a string value (even if that string value is the same name as the field).

Copy link
Member Author

@a-hilaly a-hilaly Jun 8, 2021

Choose a reason for hiding this comment

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

The problem is that there are other configuration we want to add the PrinterColumn generator. Like order, priority, type and probably more in the future.

So long term, instead of having something like:

resources:
  Deployment:
    fields:
      DeploymentGroupName:
        is_printable: true
        print_name: DeploymentGroup
        print_order: 3
        print_priority: 1
      DeploymentConfigName:
        is_printable: true
        print_name: DeploymentConfig
        print_order: 2
        print_priority: 1
        print_type: string

we can have something like:

resources:
  Deployment:
    fields:
      DeploymentGroupName:
        print:
          name: DeploymentGroup
          order: 3
          priority: 1
      DeploymentConfigName:
        print:
          name: DeploymentConfig
          order: 2
          priority: 1
          type: string

The second option is way less verbose and easier/clearer to read/understand IMO.

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK, you convinced me. :)

Initially we used to have one config field under "is_printable" under
`ackconfig.FieldConfig` to instruct the code generator to generate
kubebuilder marker comments in order to include the field in `kubectl
get` response.

Time passed and we are in a situation where want to tune more the way
we print these fields and extend the `kubebuilder:printcolumns` comment
markers to include options like `priority`, `order` and default columns.

This patch reworks the field configuration structure and prepare the
laying ground for future print config fields.

This patch will simplify the realization of the following issues:
* aws-controllers-k8s/community#821
* aws-controllers-k8s/community#822
* aws-controllers-k8s/community#823
@a-hilaly a-hilaly requested a review from jaypipes June 8, 2021 14:52
name: DeploymentConfig
Description:
is_printable: true
print: {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

OK, you convinced me. :)

@jaypipes
Copy link
Collaborator

jaypipes commented Jun 8, 2021

/lgtm

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

ack-bot commented Jun 8, 2021

[APPROVALNOTIFIER] This PR is APPROVED

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

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:

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 5d5ae05 into aws-controllers-k8s:main Jun 8, 2021
a-hilaly added a commit to a-hilaly/ack-sagemaker-controller that referenced this pull request Jun 10, 2021
Recently we merged a PR that changed `is_printable` field types to struct
types, mainly to allow users to set other printing parameters: like
type, priority and order.

Ref: aws-controllers-k8s/code-generator#82
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.

3 participants