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

Truncate pre-delete-controller Job name to 63 characters #506

Merged
merged 6 commits into from
Dec 19, 2023

Conversation

kschoche
Copy link
Contributor

@kschoche kschoche commented Dec 7, 2023

Truncate pre-delete-cleanup-controller to 63 characters

Fixes #260
Closes #476
Closes #499 as duplicate

@kschoche kschoche self-assigned this Dec 7, 2023
@kschoche kschoche added the bug Something isn't working label Dec 7, 2023
@kschoche kschoche added this to the v0.4.2 milestone Dec 7, 2023
@kschoche kschoche marked this pull request as ready for review December 7, 2023 19:58
@kschoche kschoche requested a review from a team as a code owner December 7, 2023 19:58
@benashz benashz modified the milestones: v0.4.2, v0.4.3 Dec 7, 2023
@benashz benashz self-requested a review December 7, 2023 20:16
@kschoche kschoche force-pushed the VAULT-22198/truncate-resource-names-v2 branch from 1e14a8d to 5fabe07 Compare December 19, 2023 16:30
@kschoche kschoche changed the title Truncate release name to 27 characters and resource name to 63 Truncate pre-delete-controller Job name to 63 characters Dec 19, 2023
Copy link
Collaborator

@benashz benashz left a comment

Choose a reason for hiding this comment

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

Only had a few minor nits/suggestions - otherwise looks great!

@@ -17,13 +17,13 @@ If release name contains chart name it will be used as a full name.
*/}}
{{- define "vso.chart.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- .Values.fullnameOverride | trunc 27 | trimSuffix "-" }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

The doc string above should probably be updated, since we are only allowing a release name of 27.

@@ -7,7 +7,7 @@
Expand the name of the chart.
*/}}
{{- define "vso.chart.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- default .Chart.Name .Values.nameOverride | trunc 27 | trimSuffix "-" }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did we double check that 27 chars was enough, relative to the recently added viewer/editor role resources?

yq 'select(.kind == "Job") | .metadata' | tee /dev/stderr)

local actual=$(echo "$object" | yq '.name' | tee /dev/stderr)
[ "${actual}" = "pdcc-abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdef" ]
Copy link
Collaborator

Choose a reason for hiding this comment

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

cool, I wonder if we could also assert the length of $actual as well:

Something like:

   [ "${#actual}" -eq 63 ]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oooo, nice! thx, have included it in d51cefc

yq 'select(.kind == "Job") | .metadata' | tee /dev/stderr)

local actual=$(echo "$object" | yq '.name' | tee /dev/stderr)
[ "${actual}" = "pdcc-release-name-vault-secrets-operator" ]
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: extra leading whitespace

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in d51cefc

yq 'select(.kind == "Job") | .metadata' | tee /dev/stderr)

local actual=$(echo "$object" | yq '.name' | tee /dev/stderr)
[ "${actual}" = "pdcc-abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdef" ]
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: extra leading whitespace

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in d51cefc

@kschoche kschoche merged commit bfdf827 into main Dec 19, 2023
39 checks passed
@kschoche kschoche deleted the VAULT-22198/truncate-resource-names-v2 branch December 19, 2023 20:24
adrianmoisey pushed a commit to adrianmoisey/vault-secrets-operator that referenced this pull request Jan 16, 2024
* truncate pre-delete controller job name to 63 chars
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Chart] Pre-delete hook name can be >63 chars
2 participants