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

✨ (kustomize/v2-alpha) fixes in the scaffold to follow the changes in the MAJOR release of kustomize #2750

Merged

Conversation

camilamacedo86
Copy link
Member

@camilamacedo86 camilamacedo86 commented Jun 18, 2022

Description

  • Replace every instance of $(SOMETHING) with any arbitrary placeholder value.
  • Replace: bases: with resources:
  • Replace:
#  someName: someValue

With:

#labels:
#- includeSelectors: true
#  pairs:
#    someName: someValue

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 18, 2022
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 18, 2022
@camilamacedo86
Copy link
Member Author

/test all

@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 Jun 18, 2022
@camilamacedo86
Copy link
Member Author

/test all

@camilamacedo86 camilamacedo86 force-pushed the update-samples-kustom branch from 1613219 to 9e86e1e Compare June 18, 2022 09:05
@camilamacedo86
Copy link
Member Author

/test all

@camilamacedo86 camilamacedo86 force-pushed the update-samples-kustom branch from 9e86e1e to d7ec8b6 Compare June 18, 2022 10:11
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 18, 2022
@camilamacedo86 camilamacedo86 force-pushed the update-samples-kustom branch 2 times, most recently from a740c9b to 3b0b86f Compare June 18, 2022 10:18
@camilamacedo86 camilamacedo86 changed the title WIP ✨ (kustomize/v2-alpha) fixes in the scaffold accordinly with the v4 recommendations Jun 18, 2022
@camilamacedo86 camilamacedo86 marked this pull request as ready for review June 18, 2022 10:22
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 18, 2022
@camilamacedo86 camilamacedo86 added this to the 3.5.0 milestone Jun 18, 2022
@camilamacedo86 camilamacedo86 changed the title ✨ (kustomize/v2-alpha) fixes in the scaffold accordinly with the v4 recommendations ✨ (kustomize/v2-alpha) fixes in the scaffold to follow the changes in the MAJOR release of kustomize Jun 18, 2022
@@ -60,10 +60,10 @@ metadata:
name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml
namespace: system
spec:
# $(SERVICE_NAME) and $(SERVICE_NAMESPACE) will be substituted by kustomize
# SERVICE_NAME_PLACEHOLDER and SERVICE_NAMESPACE_PLACEHOLDER will be substituted by kustomize
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO the suffix _PLACEHOLDER is not needed. The all-caps style is easily recognized as var-syntax style IMO.

But I wonder if this change really work? Have you tested the resulting scaffolding @camilamacedo86? If you are trying to migrate from using vars to replacements, I think there is a bit more to be done, ref. https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/vars/#more-complex-migration-example

Copy link
Member Author

@camilamacedo86 camilamacedo86 Jun 18, 2022

Choose a reason for hiding this comment

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

Hi @erikgb this changes are for the new alpha plugin. (alpha and not in the default scaffild)

The changes from vars to replacements are done here: https://github.com/kubernetes-sigs/kubebuilder/blob/master/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/kustomization.go#L92-L190
In this follow-up pr, I am just trying to adjust the rest of the places.

Why did I change the var by the placeholders? The doc says:

Replace every instance of $(SOME_SECRET_NAME) with any arbitrary placeholder value.

Anyway, if we do not do this replacement it still working because as you can see in the kustomize config where the replacements are used we are working with positions.

The kustomize changes on the alpha one have been tested in the e2e here : https://github.com/kubernetes-sigs/kubebuilder/blob/master/test/e2e/v3/plugin_cluster_test.go#L132-L151

However, we will still be needing other follow-ups and address further changes to the new alpha plugin ONLY.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I understand that the migration to replacements has started. Good! But I would just stick with the existing names SERVICE_NAME \ SERVICE_NAMESPACE and drop the _PLACEHOLDER postfix. It still looks like a placeholder IMO.

Copy link
Member Author

@camilamacedo86 camilamacedo86 Jun 19, 2022

Choose a reason for hiding this comment

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

@erikgb : If we run kustomize edit fix --vars to help you move forward with the new changes for 4.x they suggest PLACEHOLDER word to make clear for users that it is just a PLACEHOLDER so because of that I kept as suggested but yep I think we can remove the word

@camilamacedo86 camilamacedo86 modified the milestone: 3.5.0 Jun 18, 2022
@camilamacedo86 camilamacedo86 force-pushed the update-samples-kustom branch from 3b0b86f to e004455 Compare June 19, 2022 11:13
@camilamacedo86 camilamacedo86 force-pushed the update-samples-kustom branch from e004455 to 9aa57e0 Compare June 19, 2022 11:15
Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86, everettraven

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

@camilamacedo86
Copy link
Member Author

Moving forward since the @erikgb suggestions are addressed and we have also another LGTM.

@camilamacedo86 camilamacedo86 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 19, 2022
@k8s-ci-robot k8s-ci-robot merged commit 2577d1c into kubernetes-sigs:master Jun 19, 2022
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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants