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

Not all apis removed from release #110

Open
olegtrautvein opened this issue Apr 4, 2023 · 1 comment
Open

Not all apis removed from release #110

olegtrautvein opened this issue Apr 4, 2023 · 1 comment

Comments

@olegtrautvein
Copy link

Hello.
We are using helm v3.7.2 + mapkubeapis v0.4.1
k8s node v1.24.9 (where old release version deployed) and v1.25.6 (where plugin executed)

On some releases plugin removes all removed apis, but one of this has removed only 4 of 5 apiVersion: policy/v1beta1\nkind: PodSecurityPolicy\n

There are logs of that execution:

/tmp $ helm-v3.7.2 mapkubeapis project-monitoring --namespace project 
2023/04/04 21:09:34 Release 'project-monitoring' will be checked for deprecated or removed Kubernetes APIs and will be updated if necessary to supported API versions.
2023/04/04 21:09:34 Get release 'project-monitoring' latest version.
2023/04/04 21:09:34 Check release 'project-monitoring' for deprecated or removed APIs...
2023/04/04 21:09:34 Found 4 instances of deprecated or removed Kubernetes API:
"apiVersion: policy/v1beta1
kind: PodSecurityPolicy
"
No supported API equivalent
2023/04/04 21:09:34 Finished checking release 'project-monitoring' for deprecated or removed APIs.
2023/04/04 21:09:34 Deprecated or removed APIs exist, updating release: project-monitoring.
2023/04/04 21:09:34 Set status of release version 'project-monitoring.v1' to 'superseded'.
2023/04/04 21:09:35 Release version 'project-monitoring.v1' updated successfully.
2023/04/04 21:09:35 Add release version 'project-monitoring.v2' with updated supported APIs.
2023/04/04 21:09:35 Release version 'project-monitoring.v2' added successfully.
2023/04/04 21:09:35 Release 'project-monitoring' with deprecated or removed APIs updated successfully to new version.
2023/04/04 21:09:35 Map of release 'project-monitoring' deprecated or removed APIs to supported versions, completed successfully.

I used the following command to get secret manifests:
kubectl get secret -n project sh.helm.release.v1.project-monitoring.v1 --template={{.data.release}} | base64 -d | base64 -d | gzip -d | jq -r .manifest > before.json

Please find before.yaml and after.yaml attached. I left only the beginning of the files where there are differents

May be it will useful information: release where plugin removed all three 'wrong' apis has exported secret size 71kb, but release where removed 4 of 5 has exported secret size 477kb and 3.2mb of decoded unzipped manifest field.

@olegtrautvein
Copy link
Author

olegtrautvein commented Apr 5, 2023

Hello. I found that one of subchart uses windows-style caret return. So, adding of instruction should help as urgent method, but it is better to support it in mapkubeapis plugin.
Removed API record to resolve this problem:

 - deprecatedAPI: "apiVersion: policy/v1beta1\r\nkind: PodSecurityPolicy\r\n"
    removedInVersion: "v1.25" 

Bad chart is victoria-metrics-cluster v0.9.46, it contains template 'app-monitoring/charts/vmcluster/templates/podsecuritypolicy.yaml' which not deleted by plugin

Adding the following code here

var origManifest = releaseToMap.Manifest
should help:

        origManifest = strings.Replace(releaseToMap.Manifest, "\r\n", "\n", -1)

kamikazechaser added a commit to kamikazechaser/helm-mapkubeapis that referenced this issue Apr 13, 2024
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

No branches or pull requests

1 participant