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

🐛 Refactor alpha config-gen to use embed from go 1.16 #2204

Merged
merged 1 commit into from
Jun 8, 2021

Conversation

pwittrock
Copy link
Contributor

@pwittrock pwittrock commented Jun 6, 2021

Update the version of kyaml to use the latest framework. This switches to embed (go 1.16) from pkgr for embedding template files into the binary.

No testdata should change as part of this PR to ensure it is a pure refactoring.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 6, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pwittrock

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 6, 2021
@pwittrock pwittrock changed the title Refactor alpha config-gen to use embed from go 1.16 🐛 Refactor alpha config-gen to use embed from go 1.16 Jun 6, 2021
@pwittrock pwittrock force-pushed the config-gen branch 3 times, most recently from 20ae9bc to 5e91c7d Compare June 7, 2021 15:31
@Birdrock
Copy link
Contributor

Birdrock commented Jun 7, 2021

Looks good to me. Happy to see extracting logic into a function over baking it into the Cobra command.

&framework.ResourcePatchTemplate{
Selector: &framework.Selector{
Kinds: []string{"Deployment"},
Names: []string{"controller-manager"},
Copy link

Choose a reason for hiding this comment

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

This used to also have a namespace selector. Is that no longer needed? Since this is no longer in a closure itself, you'd need to use a template string.

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

@@ -31,35 +33,33 @@ type API struct {
// Advanced function for transforming kubebuilder output by looking at the resources and modifying them.
func main() {
api := &API{}
c := framework.TemplateProcessor{
Copy link

Choose a reason for hiding this comment

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

It looks like this one doesn't actually use any templates. Unless I'm missing something, it could use SimpleProcessor instead: https://pkg.go.dev/sigs.k8s.io/kustomize/kyaml/fn/framework#SimpleProcessor

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


import (
_ "sigs.k8s.io/controller-runtime"
_ "sigs.k8s.io/controller-runtime/pkg/scheme"
Copy link

Choose a reason for hiding this comment

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

Why does the framework upgrade make this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

@KnVerey
Copy link

KnVerey commented Jun 7, 2021

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 7, 2021
@pwittrock
Copy link
Contributor Author

/override

@k8s-ci-robot
Copy link
Contributor

@pwittrock: /override requires a failed status context to operate on, but none was given

In response to this:

/override

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.

@pwittrock
Copy link
Contributor Author

/override APIDiff

@k8s-ci-robot
Copy link
Contributor

@pwittrock: /override requires a failed status context to operate on.
The following unknown contexts were given:

  • APIDiff

Only the following contexts were expected:

  • netlify/kubebuilder/deploy-preview
  • pull-kubebuilder-e2e-k8s-1-14-10
  • pull-kubebuilder-e2e-k8s-1-15-12
  • pull-kubebuilder-e2e-k8s-1-16-15
  • pull-kubebuilder-e2e-k8s-1-17-11
  • pull-kubebuilder-e2e-k8s-1-18-8
  • pull-kubebuilder-e2e-k8s-1-19-4
  • pull-kubebuilder-test
  • tide

In response to this:

/override APIDiff

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.

@pwittrock
Copy link
Contributor Author

/override tide

@DirectXMan12
Copy link
Contributor

/override Verify API differences

@k8s-ci-robot
Copy link
Contributor

@DirectXMan12: /override requires a failed status context to operate on.
The following unknown contexts were given:

  • Verify API differences

Only the following contexts were expected:

  • netlify/kubebuilder/deploy-preview
  • pull-kubebuilder-e2e-k8s-1-14-10
  • pull-kubebuilder-e2e-k8s-1-15-12
  • pull-kubebuilder-e2e-k8s-1-16-15
  • pull-kubebuilder-e2e-k8s-1-17-11
  • pull-kubebuilder-e2e-k8s-1-18-8
  • pull-kubebuilder-e2e-k8s-1-19-4
  • pull-kubebuilder-test
  • tide

In response to this:

/override Verify API differences

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
Copy link
Contributor

@pwittrock: Overrode contexts on behalf of pwittrock: tide

In response to this:

/override tide

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.

@pwittrock
Copy link
Contributor Author

Seems like prow is not merging this. Any concerns with me manually merging?

@camilamacedo86 @estroz @Adirio

@pwittrock
Copy link
Contributor Author

/override Verify API differences

@k8s-ci-robot
Copy link
Contributor

@pwittrock: /override requires a failed status context to operate on.
The following unknown contexts were given:

  • Verify API differences

Only the following contexts were expected:

  • netlify/kubebuilder/deploy-preview
  • pull-kubebuilder-e2e-k8s-1-14-10
  • pull-kubebuilder-e2e-k8s-1-15-12
  • pull-kubebuilder-e2e-k8s-1-16-15
  • pull-kubebuilder-e2e-k8s-1-17-11
  • pull-kubebuilder-e2e-k8s-1-18-8
  • pull-kubebuilder-e2e-k8s-1-19-4
  • pull-kubebuilder-test
  • tide

In response to this:

/override Verify API differences

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.

@pwittrock pwittrock merged commit e4ae397 into kubernetes-sigs:master Jun 8, 2021
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants