Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Fail to write to /var/post_install/kustomization.yaml #1151

Closed
otavio opened this issue Jan 5, 2024 · 5 comments
Closed

Fail to write to /var/post_install/kustomization.yaml #1151

otavio opened this issue Jan 5, 2024 · 5 comments

Comments

@otavio
Copy link
Contributor

otavio commented Jan 5, 2024

          It seems that something is wrong. Please see the details:
module.infra.null_resource.kustomization (remote-exec): Connecting to remote host via SSH...
module.infra.null_resource.kustomization (remote-exec):   Host: xxxx
module.infra.null_resource.kustomization (remote-exec):   User: root
module.infra.null_resource.kustomization (remote-exec):   Password: false
module.infra.null_resource.kustomization (remote-exec):   Private key: false
module.infra.null_resource.kustomization (remote-exec):   Certificate: false
module.infra.null_resource.kustomization (remote-exec):   SSH Agent: true
module.infra.null_resource.kustomization (remote-exec):   Checking Host Key: false
module.infra.null_resource.kustomization (remote-exec):   Target Platform: unix
module.infra.null_resource.kustomization (remote-exec): Connected!
module.infra.null_resource.kustomization: Still creating... [40s elapsed]
module.infra.null_resource.kustomization (remote-exec): + sed -i 's/^- |[0-9]\+$/- |/g' /var/post_install/kustomization.yaml
module.infra.null_resource.kustomization (remote-exec): sed: can't read /var/post_install/kustomization.yaml: Not a directory
╷
│ Error: remote-exec provisioner error
│
│   with module.infra.null_resource.kustomization,
│   on .terraform/modules/infra/init.tf line 288, in resource "null_resource" "kustomization":
│  288:   provisioner "remote-exec" {
│
│ error executing "/tmp/terraform_148135017.sh": Process exited with status 2
╵
% ssh root@xxxx -p 60022
infra-control-plane-vnc:~ # less /var/post_install
infra-control-plane-vnc:~ # ls -l /var/post_install
-rw-r--r--. 1 root root 642 Jan  2 18:16 /var/post_install
infra-control-plane-vnc:~ #

The file /var/post_install should have been a directory instead.

Originally posted by @otavio in #1135 (comment)

@otavio
Copy link
Contributor Author

otavio commented Jan 5, 2024

The sed is at:

# This ugly hack is here, because terraform serializes the
# embedded yaml files with "- |2", when there is more than
# one yamldocument in the embedded file. Kustomize does not understand
# that syntax and tries to parse the blocks content as a file, resulting
# in weird errors. so gnu sed with funny escaping is used to
# replace lines like "- |3" by "- |" (yaml block syntax).
# due to indendation this should not changes the embedded
# manifests themselves
"sed -i 's/^- |[0-9]\\+$/- |/g' /var/post_install/kustomization.yaml",

from:

# Upload kustomization.yaml, containing Hetzner CSI & CSM, as well as kured.
provisioner "file" {
content = local.kustomization_backup_yaml
destination = "/var/post_install/kustomization.yaml"
}

It might be due the create_kustomization = false in kube.tf

@mysticaltech
Copy link
Collaborator

@otavio Thanks for this, but how to reproduce?

@otavio
Copy link
Contributor Author

otavio commented Jan 5, 2024

I have created a node, and it failed.

@mysticaltech
Copy link
Collaborator

@otavio I'm sorry I cannot reproduce, for me it works, even with create_kustomization = false.
Screenshot from 2024-01-05 23-28-07
Screenshot from 2024-01-05 23-28-47
Screenshot from 2024-01-05 23-28-57

@mysticaltech
Copy link
Collaborator

So my conclusion is that you are probably on Windows, and something is up with WSL. Please try from Mac or Linux to confirm. Moving this to a discussion, please don't hesitate to tag me again in the discussion.

@kube-hetzner kube-hetzner locked and limited conversation to collaborators Jan 5, 2024
@mysticaltech mysticaltech converted this issue into discussion #1154 Jan 5, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants