-
Notifications
You must be signed in to change notification settings - Fork 138
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
Add support for single token #404
Conversation
- token validation now works with only 1 apiToken - if only the apiToken is provided, a copy of the token is saved in the paasToken field of the secret
return dtc, updateCR, nil | ||
} | ||
|
||
func (r *DynatraceClientReconciler) getTokensFromSecret(ctx context.Context, instance *dynatracev1beta1.DynaKube) (*corev1.Secret, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't only get the tokens from the secret
maybe splitting this into loading the secret and then assigning the tokens in a separate stuff would improve readability here
@@ -36,8 +36,6 @@ func TestReconcileDynatraceClient_TokenValidation(t *testing.T) { | |||
rec := &DynatraceClientReconciler{ | |||
Client: c, | |||
DynatraceClientFunc: StaticDynatraceClient(dtcMock), | |||
UpdatePaaSToken: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could use a test to make sure the apiToken
is used when the paasToken
is missing
func TestReconcile_RemoveRoutingIfDisabled(t *testing.T) { | ||
mockClient := &dtclient.MockDynatraceClient{} | ||
// replacing is possible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replacing what?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was just a hint for me during development, will be removed
@@ -9,6 +9,7 @@ CONNECTION_NAME="" | |||
CLUSTER_NAME="" | |||
CLUSTER_NAME_REGEX="^[-_a-zA-Z0-9][-_\.a-zA-Z0-9]*$" | |||
CLUSTER_NAME_LENGTH=256 | |||
USES_API_AS_PAAS_TOKEN=false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the install.sh
needs to be updated, but having it can't hurt...
- If there is only one token then only one condition field of dynakube should be used - ApiToken in secret should not be copied
If the apiToken has the scope "InstallerDownload" and "DataExport", the paas token can be omitted