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

Fix warnings in kustomization file #2073

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

Conversation

priyanshikhetwani
Copy link

@priyanshikhetwani priyanshikhetwani commented Nov 27, 2024

What this PR does / why we need it: Fix Warnings in Kustomization file

make release

# Warning: 'bases' is deprecated. Please use 'resources' instead. Run 'kustomize edit fix' to update your Kustomization automatically.
# Warning: 'commonLabels' is deprecated. Please use 'labels' instead. Run 'kustomize edit fix' to update your Kustomization automatically.
# Warning: 'patchesStrategicMerge' is deprecated. Please use 'patches' instead. Run 'kustomize edit fix' to update your Kustomization automatically.
# Warning: 'vars' is deprecated. Please use 'replacements' instead. [EXPERIMENTAL] Run 'kustomize edit fix' to update your Kustomization automatically.
# Warning: 'commonLabels' is deprecated. Please use 'labels' instead. Run 'kustomize edit fix' to update your Kustomization automatically.
# Warning: 'patchesStrategicMerge' is deprecated. Please use 'patches' instead. Run 'kustomize edit fix' to update your Kustomization automatically.

Description:

  1. Replace bases with resources
    Diff:
    bases (deprecated): This field was used to reference other directories or resources (e.g., CRDs, namespaces, etc.) as "bases" from which resources would be pulled.
    resources (recommended): The resources field is now used to include external files or resources directly. Kustomize now uses resources instead of bases for the same purpose.
    Migration Approach:
    Replacing the bases field with resources, using the same paths.
    Before:
bases:
  - ../crd
  - ../rbac

After:

resources:
  - ../crd
  - ../rbac
  1. Replace commonLabels with labels
    Diff:
    commonLabels (deprecated): The commonLabels field was used to apply common labels to all resources within the kustomization.
    labels (recommended): The labels field now serves the same purpose as commonLabels, but with more flexibility and consistent behavior.
    Migration Approach:
    Replacing the commonLabels field with labels, ensuring that the structure matches the new format for labels.
    Before:
commonLabels:
  cluster.x-k8s.io/v1beta1: v1beta1_v1beta2

After:

labels:
  cluster.x-k8s.io/v1beta1: v1beta1_v1beta2
  1. Replace patchesStrategicMerge with patches
    Diff:
    patchesStrategicMerge (deprecated): This field was used to apply strategic merge patches to the resources defined in the Kustomization.
    patches (recommended): The patches field is now used to apply patches (both strategic and JSON patch) to resources. The main difference is that patches supports both strategicMerge and jsonPatch types.
    Migration Approach:
    Replacing the patchesStrategicMerge field with the patches field. The structure of the patches will stay mostly the same, but now it supports a wider variety of patch types.

Before:

[patchesStrategicMerge:

  • patches/webhook_in_ibmvpcclusters.yaml

After:

patches:
  - path: patches/webhook_in_ibmvpcclusters.yaml
  1. Replace vars with replacements
    Diff:
    vars (deprecated): The vars field was used to define variables that could be used for substitution throughout the Kustomization file.
    replacements (recommended): The replacements field provides a more explicit way to define variable substitutions. It allows you to specify where the values are coming from (source) and where they should be applied (target).
    Migration Approach:
    For each variable defined in vars, create a replacements entry. This involves specifying the source field and the target field for the substitution.

Before:

vars:
- name: SERVICE_NAMESPACE # namespace of the service
  objref:
    kind: Service
    version: v1
    name: webhook-service
  fieldref:
    fieldpath: metadata.namespace
- name: SERVICE_NAME
  objref:
    kind: Service
    version: v1
    name: webhook-service

After:

replacements:
- source:
    fieldPath: metadata.name
    kind: Service
    name: webhook-service
  targets:
  - fieldPaths:
    - spec.dnsNames.0
    - spec.dnsNames.1
    options:
      delimiter: .
    select:
      kind: Certificate
      name: serving-cert
- source:
    fieldPath: metadata.namespace
    kind: Service
    name: webhook-service
  targets:
  - fieldPaths:
    - spec.dnsNames.0
    - spec.dnsNames.1
    options:
      delimiter: .
      index: 1
    select:
      kind: Certificate
      name: serving-cert

Test:

kustomize build . --stack-trace > sample.yaml

Screenshot 2024-11-29 at 3 24 07 AM

Which issue(s) this PR fixes:
Fixes #2061

Special notes for your reviewer:

/area provider/ibmcloud

  1. Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

Release note:


@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. area/provider/ibmcloud Issues or PRs related to ibmcloud provider labels Nov 27, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: priyanshikhetwani
Once this PR has been reviewed and has the lgtm label, please assign mkumatag 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. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 27, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @priyanshikhetwani. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 27, 2024
Copy link

netlify bot commented Nov 27, 2024

Deploy Preview for kubernetes-sigs-cluster-api-ibmcloud ready!

Name Link
🔨 Latest commit b591a65
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-ibmcloud/deploys/67494bf8e278c60008af57ca
😎 Deploy Preview https://deploy-preview-2073--kubernetes-sigs-cluster-api-ibmcloud.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Amulyam24
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 27, 2024
@priyanshikhetwani priyanshikhetwani force-pushed the remove-kustomization-warnings branch from dcbdb46 to 61f0361 Compare November 28, 2024 21:56
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 28, 2024
@priyanshikhetwani priyanshikhetwani force-pushed the remove-kustomization-warnings branch from 61f0361 to 506478e Compare November 29, 2024 04:59
@priyanshikhetwani priyanshikhetwani force-pushed the remove-kustomization-warnings branch from 506478e to b591a65 Compare November 29, 2024 05:07
@priyanshikhetwani priyanshikhetwani changed the title WIP: fix warnings in kustomization file Fix warnings in kustomization file Nov 29, 2024
@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 Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/provider/ibmcloud Issues or PRs related to ibmcloud provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

Warnings in the Kustomization
3 participants