Skip to content

feat(1765): remove useless keys from the output yml#1775

Merged
k8s-ci-robot merged 2 commits intokubernetes:mainfrom
martinjirku:1758-remove-useless-keys-in-output
Jan 3, 2024
Merged

feat(1765): remove useless keys from the output yml#1775
k8s-ci-robot merged 2 commits intokubernetes:mainfrom
martinjirku:1758-remove-useless-keys-in-output

Conversation

@martinjirku
Copy link
Copy Markdown
Contributor

@martinjirku martinjirku commented Dec 7, 2023

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR transforms yaml output by removing map[string]interfaces{} with no keys, or the nil fields. This PR utilizes the current implementation of the yaml transformation process in the "kompose" (1) object -> (2) []byte (json) -> (3) interface{} -> (4) []byte (yaml). Between steps 3 and 4, there is a chance to clean the data structure by removing any empty fields.

Which issue(s) this PR fixes:

Fixes #1758

Special notes for your reviewer:

IMHO, The empty artifacts (such as strategy {} , resources: {},...) are present because we have e.g. in the DeploymentSpec.Strategy struct not the reference (a pointer) to the struct, since this change would be outside of the kompose scope and I am not sure if it is feasible, I've decided to fix it by removing all empty fields.

Is this correct approach I should proceed with, or should I open (or search if a ticket exists) in the k8s/kubernetes repo for change in the API app types?

Signed-off-by: Martin Jirku <martin@jirku.sk>
@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 7, 2023
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Welcome @martinjirku!

It looks like this is your first PR to kubernetes/kompose 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kompose has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot requested review from cdrage and sebgoa December 7, 2023 07:54
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 7, 2023
@martinjirku
Copy link
Copy Markdown
Contributor Author

I did not update docker tests, I will update it in next commit

@AhmedGrati
Copy link
Copy Markdown
Contributor

@martinjirku any updates on this?

@martinjirku
Copy link
Copy Markdown
Contributor Author

@AhmedGrati I've got much at work before Christmas. Still working... I've updated cca 40 tests sofar.

…veEmptyInterfaces algo

Signed-off-by: Martin Jirku <martin@jirku.sk>
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 1, 2024
@cdrage
Copy link
Copy Markdown
Member

cdrage commented Jan 3, 2024

AMAZING work! Thank you so much 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉

LGTM!

@cdrage
Copy link
Copy Markdown
Member

cdrage commented Jan 3, 2024

/lgtm

@cdrage
Copy link
Copy Markdown
Member

cdrage commented Jan 3, 2024

/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 3, 2024
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cdrage, martinjirku

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

The pull request process is described here

Details 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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 3, 2024
@k8s-ci-robot k8s-ci-robot merged commit bd568ba into kubernetes:main Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove other useless keys in output

4 participants