Skip to content

[v13] Fixes crash when writing kubeconfig with tctl auth sign --tar#34822

Merged
tcsc merged 2 commits intobranch/v13from
tcsc/branch/v13/tar-writer-support-remove
Nov 21, 2023
Merged

[v13] Fixes crash when writing kubeconfig with tctl auth sign --tar#34822
tcsc merged 2 commits intobranch/v13from
tcsc/branch/v13/tar-writer-support-remove

Conversation

@tcsc
Copy link
Copy Markdown
Contributor

@tcsc tcsc commented Nov 21, 2023

Backports #34612

Prior this patch, using the --format=kubernetes option with
tctl auth sign --tar would crash due to the filesystem abstraction
used to capture the tctl output files did not support removing or
stating files.

In addition, the kubeconfig file writer did not use the filesystem
abstraction given to the identity file writer, but would only write
files out to the host filesystem. This means that any kubeconfig
file oututs would not be included in the output tarfile stream.

This patch:

  • Updates the tarfile filesystem abstraction to buffer files created
    by tctl until the write is complete, and then stream the archive
    out at the end. This gives sensible semabtics to the remove and
    stat operations.
  • Updates the kubeconfig writer to take a filesystem abstraction
    compatible with the one used by the identity file writer, so that
    the kubeconfg file output is correctly caught by the tarfile writer.

Fixes: #34371
Changelog: Fixes crash when writing kubeconfig with tctl auth sign --tar

Backports #34612

Prior this patch, using the `--format=kubernetes` option with
`tctl auth sign --tar` would crash due to the filesystem abstraction
used to capture the `tctl` output files did not support removing or
`stat`ing files.

In addition, the kubeconfig file writer did not use the filesystem
abstraction given to the identity file writer, but would only write
files out to the host filesystem. This means that any kubeconfig
file oututs would not be included in the output tarfile stream.

This patch:
 * Updates the tarfile filesystem abstraction to buffer files created
   by `tctl` until the write is complete, and then stream the archive
   out at the end. This gives sensible semabtics to the remove and
   stat operations.
 * Updates the kubeconfig writer to take a filesystem abstraction
   compatible with the one used by the identity file writer, so that
   the kubeconfg file output is correctly caught by the tarfile writer.

Fixes: #34371
Changelog: Fixes crash when writing kubeconfig with `tctl auth sign --tar`
@tcsc tcsc added this pull request to the merge queue Nov 21, 2023
Merged via the queue into branch/v13 with commit 121b3d9 Nov 21, 2023
@tcsc tcsc deleted the tcsc/branch/v13/tar-writer-support-remove branch November 21, 2023 10:03
@fheinecke fheinecke mentioned this pull request Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants