Skip to content

Commit

Permalink
fixup: descriptions
Browse files Browse the repository at this point in the history
Signed-off-by: KevFan <[email protected]>
  • Loading branch information
KevFan committed Feb 19, 2025
1 parent dedc10a commit 01a81eb
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 19 deletions.
20 changes: 14 additions & 6 deletions api/v1beta3/auth_config_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,20 @@ type ApiKeyAuthenticationSpec struct {
// +kubebuilder:default:=false
AllNamespaces bool `json:"allNamespaces,omitempty"`

// A Common Expression Language (CEL) expression that evaluates to a list of string keys within the selected Kubernetes
// secret that contain valid API credentials. The keys of the selected Kubernetes secret are available for evaluation
// in the following structure: `{"keys": ["key1", "key2"]}`.
// Authorino will attempt to authenticate using any matching key. If no keys are defined, the default "api_key" will be used.
// If no match is found, the Kubernetes secret is not considered a valid Authorino API Key secret and is ignored.
// String expressions are supported (https://pkg.go.dev/github.com/google/cel-go/ext#Strings).
// A Common Expression Language (CEL) expression that evaluates to a list of string keys, such as `["custom_key1", "custom_key2"]`,
// within the selected Kubernetes secret that contains valid API credentials.
//
// The keys of the selected Kubernetes secret are available for evaluation in the following structure:
// `{"keys": ["api_key", "custom_key1", "custom_key2"]}`.
//
// For example, to select keys that start with "custom", use the following CEL expression:
// `"keys.filter(k, k.startsWith('custom'))"`
//
// Authorino will attempt to authenticate using any matching key. If this field is omitted or empty, the default `["api_key"]` will be used.
// If no match is found, the Kubernetes secret is not considered a valid Authorino API Key secret and will be ignored.
//
// String expressions are supported: https://pkg.go.dev/github.com/google/cel-go/ext#Strings
//
// +optional
KeySelector CelExpression `json:"keySelector,omitempty"`
}
Expand Down
23 changes: 17 additions & 6 deletions install/crd/authorino.kuadrant.io_authconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2395,12 +2395,23 @@ spec:
type: boolean
keySelector:
description: |-
A Common Expression Language (CEL) expression that evaluates to a list of string keys within the selected Kubernetes
secret that contain valid API credentials. The keys of the selected Kubernetes secret are available for evaluation
in the following structure: `{"keys": ["key1", "key2"]}`.
Authorino will attempt to authenticate using any matching key. If no keys are defined, the default "api_key" will be used.
If no match is found, the Kubernetes secret is not considered a valid Authorino API Key secret and is ignored.
String expressions are supported (https://pkg.go.dev/github.com/google/cel-go/ext#Strings).
A Common Expression Language (CEL) expression that evaluates to a list of string keys, such as `["custom_key1", "custom_key2"]`,
within the selected Kubernetes secret that contains valid API credentials.
The keys of the selected Kubernetes secret are available for evaluation in the following structure:
`{"keys": ["api_key", "custom_key1", "custom_key2"]}`.
For example, to select keys that start with "custom", use the following CEL expression:
`"keys.filter(k, k.startsWith('custom'))"`
Authorino will attempt to authenticate using any matching key. If this field is omitted or empty, the default `["api_key"]` will be used.
If no match is found, the Kubernetes secret is not considered a valid Authorino API Key secret and will be ignored.
String expressions are supported: https://pkg.go.dev/github.com/google/cel-go/ext#Strings
type: string
selector:
description: Label selector used by Authorino to match secrets
Expand Down
23 changes: 17 additions & 6 deletions install/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2662,12 +2662,23 @@ spec:
type: boolean
keySelector:
description: |-
A Common Expression Language (CEL) expression that evaluates to a list of string keys within the selected Kubernetes
secret that contain valid API credentials. The keys of the selected Kubernetes secret are available for evaluation
in the following structure: `{"keys": ["key1", "key2"]}`.
Authorino will attempt to authenticate using any matching key. If no keys are defined, the default "api_key" will be used.
If no match is found, the Kubernetes secret is not considered a valid Authorino API Key secret and is ignored.
String expressions are supported (https://pkg.go.dev/github.com/google/cel-go/ext#Strings).
A Common Expression Language (CEL) expression that evaluates to a list of string keys, such as `["custom_key1", "custom_key2"]`,
within the selected Kubernetes secret that contains valid API credentials.
The keys of the selected Kubernetes secret are available for evaluation in the following structure:
`{"keys": ["api_key", "custom_key1", "custom_key2"]}`.
For example, to select keys that start with "custom", use the following CEL expression:
`"keys.filter(k, k.startsWith('custom'))"`
Authorino will attempt to authenticate using any matching key. If this field is omitted or empty, the default `["api_key"]` will be used.
If no match is found, the Kubernetes secret is not considered a valid Authorino API Key secret and will be ignored.
String expressions are supported: https://pkg.go.dev/github.com/google/cel-go/ext#Strings
type: string
selector:
description: Label selector used by Authorino to match secrets
Expand Down
2 changes: 1 addition & 1 deletion pkg/evaluators/identity/api_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func (a *APIKey) getValuesFromSecret(ctx context.Context, secret k8s.Secret) []s
// Convert evaluated result to a slice of strings
selectedKeys, ok := convertToStringSlice(evaluated)
if !ok {
logger.Error(fmt.Errorf("unexpected type for resolved key"), "expected string or []string", "value", evaluated)
logger.Error(fmt.Errorf("unexpected type for resolved key"), "expected []string", "value", evaluated)
return nil
}

Expand Down

0 comments on commit 01a81eb

Please sign in to comment.