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

Localize HelmChartInflationGenerator #5007

Merged

Conversation

annasong20
Copy link
Contributor

This PR localizes the HelmChartInflationGenerator custom transformer. If chart home isn't specified, the default home is copied.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 30, 2023
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 30, 2023
Comment on lines -455 to 461
const readmeErr = `mapping values are not allowed in this context`
fileErr := fmt.Sprintf(`invalid resource at file "%s": MalformedYAMLError:`, repo)
fileErr := fmt.Sprintf(`invalid resource at file "%s": MalformedYAMLError`, repo)
rootErr := fmt.Sprintf(`unable to localize root "%s": unable to find one of 'kustomization.yaml', 'kustomization.yml' or 'Kustomization'`, repo)
var actualErr PathLocalizeError
require.ErrorAs(t, err, &actualErr)
require.Equal(t, repo, actualErr.Path)
require.ErrorContains(t, actualErr.FileError, readmeErr)
require.ErrorContains(t, actualErr.FileError, fileErr)
require.ErrorContains(t, actualErr.RootError, rootErr)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the readmeErr that's specific to the contents of the kustomize repo README.md and irrelevant to our test, which just expects that the README is invalid yaml.

The over-specificity of this test previously failed the ci pipeline on master: https://github.com/kubernetes-sigs/kustomize/actions/runs/4018832421/jobs/6904935339

func TestLocalizeGeneratorsHelm(t *testing.T) {
files := map[string]string{
"kustomization.yaml": `generators:
- default.yaml
Copy link
Contributor

@natasha41575 natasha41575 Jan 30, 2023

Choose a reason for hiding this comment

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

Does localize currently handle generators defined inline? This is not required for alpha imo, but if it already handled, can we add a test? If not, can we add a TODO?

Adding an example in case it's unclear what I'm referring to:

generators:
- |-
  apiVersion: builtin
  kind: HelmChartInflationGenerator
...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Yes, we handle inline generators and I added a test.

Copy link
Contributor

@natasha41575 natasha41575 left a comment

Choose a reason for hiding this comment

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

lgtm, just a small comment above

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: annasong20, natasha41575

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

@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 30, 2023
@k8s-ci-robot
Copy link
Contributor

This PR has multiple commits, and the default merge method is: merge.
You can request commits to be squashed using the label: tide/merge-method-squash

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 30, 2023
@annasong20
Copy link
Contributor Author

/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jan 30, 2023
Copy link
Contributor

@natasha41575 natasha41575 left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 30, 2023
@k8s-ci-robot k8s-ci-robot merged commit 361154d into kubernetes-sigs:master Jan 30, 2023
@annasong20 annasong20 deleted the localize-generators-helm branch January 30, 2023 21:16
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants