-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Label selectors for the AuthConfig
#179
Conversation
…tFilter and relying on apimachinery label selectors for the implemenation
8565925
to
2fb301c
Compare
2fb301c
to
d5e243f
Compare
So, let me explain what I understand to check if I understood correctly. Atuhorino will have a deployment time env var called When I (as a authorino client) create an A) create the secret with labels matching spec:
identity:
- apiKey: {}
credentials:
in: authorization_header
keySelector: APIKEY
name: MyAPIKey Note that I do not specify the label selector in the B) create the secret with my own labels, i.e. spec:
identity:
- apiKey:
labelSelectors:
MYAPP: MYLABEL
credentials:
in: authorization_header
keySelector: APIKEY
name: MyAPIKey With option A, any change done in the secret will be reconciled and authorino will enforce new api keys (provided the value in the secret changed). Am I right? |
The code LGTM |
Almost 100%, but not quite 🙂 Let me try to explain...
Correct.
Incorrect.
Correct. It is right here: https://github.com/Kuadrant/authorino-operator/blob/6bd2a13104ecb99841dbdf9f040717d29d669fd6/api/v1beta1/authorino_types.go#L78 The
As before, we should use A priori,
What happens if I have
Incorrect.
Correct.
The recommended option is always a mix of option A and option B. As long as you understand what To be safe, I'd look for the following configuration:
To be even safer and have more flexibility with the sets of
|
Super clear, thanks. I was thinking then that this statement should be in documentation (maybe it is and I missed it):
I will make sure that kuadrant-controller works accordingly. |
Filters
AuthConfig
-related events by labels of the resource.Labels selectors for the instance can be set via newly introduced
AUTH_CONFIG_LABEL_SELECTOR
environment variable, in the format ofzero or more
,parseable Kubernetes label selectors.expected-label=expected-value
key-value pairs, separated by anything that qualifies as a space in Unicode (i.e.\t
,\n
,\v
,\f
,\r
,0x85
,0xA0
)All the following are valid examples of
AuthConfig
label selector filters:By default, no label is required in the
AuthConfig
s for them to be watched by the Authorino controller – i.e.AUTH_CONFIG_LABEL_SELECTOR
is empty and therefore the controller will reconcile allAuthConfig
s in the watched space.Breaking changes:
The environment variable
AUTHORINO_SECRET_LABEL_KEY
, used to specify labels required inSecret
s to be watched by Authorino, was renamed toSECRET_LABEL_SELECTOR
and now also expects the same format of zero or more key-value pairs asAUTH_CONFIG_LABEL_SELECTOR
.The name of
ConfigMap
created to handle the leader election is now determined by the value ofAUTH_CONFIG_LABEL_SELECTOR
.Bug fixes:
The PR also fixes a bug in the label filter of the
Secret
controller that caused removed required labels from existingSecret
s not to trigger the reconciliation of theSecret
and relatedAuthConfig
.The PR also fixes a bug in the selection of
AuthConfig
s related toSecret
s reconciliated, to trigger the reconciliation of theAuthConfig
s. Now the sets of labels expected in theSecret
and matchingspec.identity.apiKey.labelSelectors
do not have to be identical (checked before withreflect.DeepEqual
), but to match as in regular label selector matches performed by Kubernetes, like when theSecret
s are listed and added to cache of valid credentials of an identity config:authorino/pkg/config/identity/api_key.go
Line 56 in 6e741f7
As as consequence of the above, the default label selectors used to filter
Secret
-related events to the reconciler no longer has to be mentioned inspec.identity.apiKey.labelSelectors
.Logging:
Adds a new debug log entry to print instance configuration options during bootstrap, and fixes other log entries related to the reconciliation of
AuthConfig
s,Secret
s andAuthConfig
status updates, especially when skipped due to non-watched resource.Doc updates:
Description of the API key feature in the examples and Architecture page updated to reflect the default label selectors used to filter
Secret
-related events to the reconciler no longer needed to be mentioned inspec.identity.apiKey.labelSelectors
.Closes #174