forked from hashicorp/vault-plugin-auth-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
impr: add base construct for selector definition in roles
Implements: hashicorp#155
- Loading branch information
Showing
4 changed files
with
192 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package kubeauth | ||
|
||
import ( | ||
"context" | ||
"net/http" | ||
) | ||
|
||
// This exists so we can use a mock namespace validation when running tests | ||
type namespaceValidator interface { | ||
ValidateLabels(context.Context, *http.Client, string, map[string]string) (bool, error) | ||
} | ||
|
||
type namespaceValidatorFactory func(*kubeConfig) namespaceValidator | ||
|
||
// This is the real implementation that calls the kubernetes API | ||
type namespaceValidatorAPI struct { | ||
config *kubeConfig | ||
} | ||
|
||
func namespaceValidatorAPIFactory(config *kubeConfig) namespaceValidator { | ||
return &namespaceValidatorAPI{ | ||
config: config, | ||
} | ||
} | ||
|
||
func (t *namespaceValidatorAPI) ValidateLabels(ctx context.Context, client *http.Client, name string, labels map[string]string) (bool, error) { | ||
return true, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters