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

Bug 2182233: Enforcing ssh secret name to be 51 chars or less #1219

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export const updateSSHKeyObject = (
updateTabsData: WizardVMContextType['updateTabsData'],
sshkey: string,
) => {
const sshSecretName = `${vm.metadata.name}-ssh-key-${getRandomChars()}`;
// secret name must be under 51 chars, or machine will fail starting. substring vm name to 37.
const sshSecretName = `${vm?.metadata?.name.substring(0, 37)}-sshkey-${getRandomChars()}`;

updateTabsData((draftTabs) => {
if (!draftTabs.additionalObjects) draftTabs.additionalObjects = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export const updateSSHKeyObject = (
sshKeySecretObject.data.key = sshKey;
} else {
const vm = getTemplateVirtualMachineObject(template);

const sshSecretName = `${vm?.metadata?.name}-sshkey-${getRandomChars()}`;
// secret name must be under 51 chars, or machine will fail starting. substring vm name to 37.
const sshSecretName = `${vm?.metadata?.name.substring(0, 37)}-sshkey-${getRandomChars()}`;

updateSecretName(template, sshSecretName);

Expand Down