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

Use kustomize edit fix to remove deprecated constructs (patchesJson6902 and other fixes) #1938

Conversation

ddelnano
Copy link
Member

@ddelnano ddelnano commented Jun 1, 2024

Summary: Use kustomize edit fix to remove deprecated constructs (patchesJson6902 and other fixes)

Relevant Issues: N/A

Type of change: /kind cleanup

Test Plan: Modified these files with kustomize edit fix and verified the following:

  • yaml is equivalent before and after except for a minor reordering of containers in a single prod and staging deployment
output
# Generate list from commits
(ddelnano/update-deprecated-patches-strategic-merge) $ git diff HEAD~1 --name-only > files

# Generate yaml from new and old versions
(ddelnano/update-deprecated-patches-strategic-merge) $ cat files  | xargs -I{} dirname {} | sort -u | xargs -I{} bash -c "kustomize build {} > {}/new"
# Warning: 'vars' is deprecated. Please use 'replacements' instead. [EXPERIMENTAL] 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: 'vars' is deprecated. Please use 'replacements' instead. [EXPERIMENTAL] 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: 'vars' is deprecated. Please use 'replacements' instead. [EXPERIMENTAL] Run 'kustomize edit fix' to update your Kustomization automatically.

(master) $ cat files | xargs -I{} bash -c "sha256sum {}/new; sha256 {}/old"
# Warning: 'patchesStrategicMerge' is deprecated. Please use 'patches' 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: 'patchesStrategicMerge' is deprecated. Please use 'patches' 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: 'patchesStrategicMerge' is deprecated. Please use 'patches' 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: '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: '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: '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: '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: 'patchesStrategicMerge' is deprecated. Please use 'patches' instead. Run 'kustomize edit fix' to update your Kustomization automatically.


# Diff files and see that only differences are due to a container reordering in prod and staging
$ cat dirs | xargs -I{} bash -c "echo 'Testing {}'; diff {}/new {}/old"
Testing k8s/cloud/dev
Testing k8s/cloud/prod
835a836,849
>       - command:
>         - /cloud_sql_proxy
>         - -instances=pixie-prod:us-west1:pixie-cloud-prod-db-pg13=tcp:5432
>         - -ip_address_types=PRIVATE
>         - -credential_file=/secrets/cloudsql/db_service_account.json
>         image: gcr.io/cloudsql-docker/gce-proxy:1.14@sha256:96689ad665bffc521fc9ac3cbcaa90f7d543a3fc6f1c84f81e4148a22ffa66e0
>         name: cloudsql-proxy
>         securityContext:
>           allowPrivilegeEscalation: false
>           runAsUser: 2
>         volumeMounts:
>         - mountPath: /secrets/cloudsql
>           name: pl-db-secrets
>           readOnly: true
943,956d956
<       - command:
<         - /cloud_sql_proxy
<         - -instances=pixie-prod:us-west1:pixie-cloud-prod-db-pg13=tcp:5432
<         - -ip_address_types=PRIVATE
<         - -credential_file=/secrets/cloudsql/db_service_account.json
<         image: gcr.io/cloudsql-docker/gce-proxy:1.14@sha256:96689ad665bffc521fc9ac3cbcaa90f7d543a3fc6f1c84f81e4148a22ffa66e0
<         name: cloudsql-proxy
<         securityContext:
<           allowPrivilegeEscalation: false
<           runAsUser: 2
<         volumeMounts:
<         - mountPath: /secrets/cloudsql
<           name: pl-db-secrets
<           readOnly: true
Testing k8s/cloud/public/base
Testing k8s/cloud/staging
Testing k8s/cloud/testing
829a830,843
>       - command:
>         - /cloud_sql_proxy
>         - -instances=pl-pixies:us-west1:pixie-cloud-testing-db-pg13=tcp:5432
>         - -ip_address_types=PRIVATE
>         - -credential_file=/secrets/cloudsql/db_service_account.json
>         image: gcr.io/cloudsql-docker/gce-proxy:1.14@sha256:96689ad665bffc521fc9ac3cbcaa90f7d543a3fc6f1c84f81e4148a22ffa66e0
>         name: cloudsql-proxy
>         securityContext:
>           allowPrivilegeEscalation: false
>           runAsUser: 2
>         volumeMounts:
>         - mountPath: /secrets/cloudsql
>           name: pl-db-secrets
>           readOnly: true
937,950d950
<       - command:
<         - /cloud_sql_proxy
<         - -instances=pl-pixies:us-west1:pixie-cloud-testing-db-pg13=tcp:5432
<         - -ip_address_types=PRIVATE
<         - -credential_file=/secrets/cloudsql/db_service_account.json
<         image: gcr.io/cloudsql-docker/gce-proxy:1.14@sha256:96689ad665bffc521fc9ac3cbcaa90f7d543a3fc6f1c84f81e4148a22ffa66e0
<         name: cloudsql-proxy
<         securityContext:
<           allowPrivilegeEscalation: false
<           runAsUser: 2
<         volumeMounts:
<         - mountPath: /secrets/cloudsql
<           name: pl-db-secrets
<           readOnly: true
Testing k8s/cloud_deps/dev/nats
Testing k8s/cloud_deps/prod/nats
Testing k8s/cloud_deps/public/nats
Testing k8s/cloud_deps/staging/nats
Testing k8s/cloud_deps/testing/nats
Testing k8s/vizier/sanitizer

…02 and other fixes)

Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
@ddelnano ddelnano requested a review from a team as a code owner June 1, 2024 16:09
k8s/cloud/dev/kustomization.yaml Outdated Show resolved Hide resolved
k8s/cloud/testing/kustomization.yaml Outdated Show resolved Hide resolved
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
@ddelnano ddelnano merged commit 6436120 into pixie-io:main Jun 1, 2024
20 checks passed
@ddelnano ddelnano deleted the ddelnano/update-deprecated-patches-strategic-merge branch June 1, 2024 21:00
ddelnano added a commit that referenced this pull request Jun 7, 2024
#1944)

Summary: Reorder kustomization patches to keep consistent ordering
between envs

This reordering was introduced in
#1938. Note how the testing
performed on that PR required looking at how the yaml was reordered for
a few cases. This change fixes that reordering.

Relevant Issues: N/A

Type of change: /kind cleanup

Test Plan: Verified with `kustomize build k8s/cloud/prod` and `kustomize
build k8s/cloud/testing` that the yaml before #1938 and after this fix
match exactly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants