Skip to main content

Module file

Module file 

Source
Expand description

Port of internal/kubeconfig/file.go: resolves, reads, and atomically rewrites a kubeconfig file on disk, keeping a rolling backup.

Enums§

FileError
Errors from resolving, reading, or writing a kubeconfig file.

Constants§

BACKUP_SUFFIX
Port of the backupSuffix, fileMode, dirMode constants.
DIR_MODE
FILE_MODE

Functions§

read
Port of kubeconfig.Read. Returns Ok(None) when the file does not exist yet, matching Go’s nil, nil return.
target_path
Port of kubeconfig.TargetPath. The precedence mirrors kubectl config set-*: an explicit override wins, otherwise the first entry of KUBECONFIG (kubectl writes to the first file in the list, not all of them), otherwise ~/.kube/config.
write
Port of kubeconfig.Write. Returns the backup path, empty when there was nothing to back up.