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

feat: support multiple document yaml files #143

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

crandles
Copy link

@crandles crandles commented Oct 7, 2024

What type of PR is this?

/kind bug

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #123

Special notes for your reviewer:

  • (Option 1) This introduces a breaking change in the output, in the initial draft. Something needs to represent the additional detail.
{
    "/tmp/foo.yaml": [
        [
            { // doc one
                "metadata": {},
                "status": "Success"
            }
        ],
        [
            { // doc two
                "metadata": {},
                "status": "Failure",
  • (Option 2) An alternative would be to ensure that the "metadata" of the status object includes the right detail:
example
{
    "/tmp/foo.yaml": [
            { // doc one
                "kind": "...",
                "apiVersion": "...",
                "name": "...",
                "status": "Success"
                "details": {
                  "name: "..."
                }
            },
            { // doc two
                "kind": "...",
                "apiVersion": "...",
                "name": "...",
                "status": "Failure",
                "details": {
                  "name: "...",
                  // ...
                }

I think the second option might be nicer, I'll follow up with that shortly for comparison.

The above appear to be existing fields in the status we could populate.

On closer look, name is already in use, so that won't work as first thought, nor do I think it would work with generated names well.

  • (Option 3) Extend the json "key" to include additional metadata
{
    "/tmp/foo.yaml:$(documentNumber}": [

or

{
    "/tmp/foo.yaml:$(gvk}:$(name}": [

Potentially, we could make it so that the key is returned in the prior format if there is only 1 document in a file?

  • (Option 4) Alter the return type: map[string][]metav1.Status{} -> map[string][]NewType{}

As this doesn't break the general structure of the output and simply extends it, I'm inclined to try this out:

{
  "document":0, // document index
  // ... current metava1.Status fields, inline
}

Does this PR introduce a user-facing change?

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/bug Categorizes issue or PR as related to a bug. labels Oct 7, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: crandles
Once this PR has been reviewed and has the lgtm label, please assign alexzielenski for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/bug Categorizes issue or PR as related to a bug. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't validate multiple Objects in a Single Manifest
2 participants