Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
int128 committed Nov 2, 2024
1 parent 2f0206f commit af17748
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkg/credentialplugin/reader/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ type Interface interface {

type Reader struct{}

// Read parses the environment variable KUBERNETES_EXEC_INFO.
// If the environment variable is not given by kubectl, Read returns a zero value.
func (r Reader) Read() (credentialplugin.Input, error) {
execInfo := os.Getenv("KUBERNETES_EXEC_INFO")
if execInfo == "" {
Expand Down
1 change: 1 addition & 0 deletions pkg/credentialplugin/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package credentialplugin
import "time"

// Input represents an input object of the credential plugin.
// This may be a zero value if the input is not available.
type Input struct {
ClientAuthenticationAPIVersion string
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/credentialplugin/writer/credential_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (w *Writer) Write(out credentialplugin.Output) error {

func generateExecCredential(out credentialplugin.Output) (any, error) {
switch out.ClientAuthenticationAPIVersion {
// Default to v1beta1 if KUBERNETES_EXEC_INFO is not available
// If the API version is not available, fall back to v1beta1.
case clientauthenticationv1beta1.SchemeGroupVersion.String(), "":
return &clientauthenticationv1beta1.ExecCredential{
TypeMeta: metav1.TypeMeta{
Expand Down

0 comments on commit af17748

Please sign in to comment.