Skip to content

Conversation

adfost
Copy link
Contributor

@adfost adfost commented Apr 16, 2021

No description provided.

@adfost adfost requested review from bexsoft, Alevsk and dvaldivia and removed request for bexsoft and Alevsk April 16, 2021 20:40
Copy link
Collaborator

@dvaldivia dvaldivia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also change the title and description of the PR to better reflect what's being introduced and the task at hand?

Copy link
Collaborator

@dvaldivia dvaldivia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read comments above

const ADGroupBaseDN = fields.identityProvider.ADGroupBaseDN;
const ADGroupSearchFilter = fields.identityProvider.ADGroupSearchFilter;
const ADNameAttribute = fields.identityProvider.ADNameAttribute;
const accesskeys = fields.identityProvider.accesskeys;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to always use camel case variables:

Suggested change
const accesskeys = fields.identityProvider.accesskeys;
const accessKeys = fields.identityProvider.accesskeys;

const ADGroupSearchFilter = fields.identityProvider.ADGroupSearchFilter;
const ADNameAttribute = fields.identityProvider.ADNameAttribute;
const accesskeys = fields.identityProvider.accesskeys;
const secretkeys = fields.identityProvider.secretkeys;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same case:

Suggested change
const secretkeys = fields.identityProvider.secretkeys;
const secretKeys = fields.identityProvider.secretkeys;

interface IIdentityProviderProps {
classes: any;
idpSelection: string;
accesskeys: string[];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
accesskeys: string[];
accessKeys: string[];

classes: any;
idpSelection: string;
accesskeys: string[];
secretkeys: string[];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
secretkeys: string[];
secretKeys: string[];

const IdentityProvider = ({
classes,
idpSelection,
accesskeys,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
accesskeys,
accessKeys,

classes,
idpSelection,
accesskeys,
secretkeys,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
secretkeys,
secretKeys,

key={`csv-secretkey-${index.toString()}`}
/>
</div>
<button
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to use the component from material-ui, you can see examples in the create tenants files

MinIO supports both OpenID and Active Directory
</Grid>

<button
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same case with button

Copy link
Collaborator

@bexsoft bexsoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also please remember to do make assets

@adfost adfost force-pushed the api-bucket-policy branch 2 times, most recently from 17224a8 to ed8a562 Compare April 19, 2021 22:26
@adfost adfost changed the title Api bucket policy Adding create keys to tenant creation wizard Apr 19, 2021
@adfost adfost force-pushed the api-bucket-policy branch from e5d093a to b0939be Compare April 20, 2021 01:23
Alevsk
Alevsk previously requested changes Apr 20, 2021
if err != nil {
return nil, prepareError(errorGeneric, nil, err)
}
minInst.Spec.Users = []*corev1.LocalObjectReference{{Name: consoleUserSecretName}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Existing code here will create an additional user in MinIO, we need to discuss whats the desired behavior because if the user decided to add, lets say, 5 users via the create tenant wizard he will ned having 6 users on his system and I'm sure he will ask why

Comment on lines +642 to +645
if len(tenantReq.Idp.Keys) > 0 {
minInst.Spec.Users = users
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this variable assignation happening here? I see below we are iterating over tenantReq.Idp.Keys and assigning more objects to minInst.Spec.Users

Comment on lines 790 to 808
if len(tenantReq.Idp.Keys) > 0 {
for i := 0; i < len(tenantReq.Idp.Keys); i++ {
userSecretName := fmt.Sprintf("%s-%d-user-secret", tenantName, i)
userSecretData := map[string][]byte{
"CONSOLE_ACCESS_KEY": []byte(*tenantReq.Idp.Keys[i].AccessKey),
"CONSOLE_SECRET_KEY": []byte(*tenantReq.Idp.Keys[i].SecretKey),
}
_, err := createOrReplaceSecrets(ctx, &k8sClient, ns, []tenantSecret{{Name: userSecretName, Content: userSecretData}}, tenantName)
if err != nil {
return nil, prepareError(errorGeneric, nil, err)
}
minInst.Spec.Users = append(minInst.Spec.Users, &corev1.LocalObjectReference{Name: userSecretName})
}

}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this repeated code? I think we already iterate over all tenantReq.Idp.Keys, created k8s and populated the users array in line 577

"CONSOLE_SECRET_KEY": []byte(*tenantReq.Idp.Keys[i].SecretKey),
},
}
_, err := clientSet.CoreV1().Secrets(ns).Create(ctx, &instanceSecret, metav1.CreateOptions{})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the createOrReplaceSecrets function here

@dvaldivia
Copy link
Collaborator

can you also do make assets and git add anything in portal-ui/build ?

make assets
git add portal-ui/build

@dvaldivia
Copy link
Collaborator

I tested this PR creating 3 users with short names like test1 but the operator fails with the following error

E0420 20:45:24.243118       1 main-controller.go:742] error syncing 'ns-1/adam': secret key must be minimum 8 or more characters long
E0420 20:46:24.302097       1 main-controller.go:742] error syncing 'ns-1/adam': secret key must be minimum 8 or more characters long
E0420 20:47:24.800068       1 main-controller.go:742] error syncing 'ns-1/adam': secret key must be minimum 8 or more characters long

Please introduce a restriction on the UI to ensure the user and password are at least 8 characters long

Copy link
Collaborator

@bexsoft bexsoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix conflicts

@adfost adfost force-pushed the api-bucket-policy branch from 57c9dcd to d004f7d Compare April 21, 2021 06:01
error={validationErrors[`secretkey-${index.toString()}`] || ""}
/>
</div>
<Button
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to place this button as an icon in the secret key, please look for examples of overlayIcon in InputBoxWrapper component

@adfost adfost force-pushed the api-bucket-policy branch 3 times, most recently from c7196d1 to 300a737 Compare April 22, 2021 20:14
Signed-off-by: Adam Stafford <adam@minio.io>
@adfost adfost force-pushed the api-bucket-policy branch from 42b1971 to 5c42455 Compare April 22, 2021 20:41
@bexsoft bexsoft requested a review from Alevsk April 22, 2021 20:46
@dvaldivia dvaldivia dismissed Alevsk’s stale review April 22, 2021 21:18

concerns addressed

@dvaldivia dvaldivia merged commit ca742b7 into minio:master Apr 22, 2021
@Alevsk
Copy link
Contributor

Alevsk commented Apr 22, 2021

Screen Shot 2021-04-22 at 15 30 59

This is being rendered like this on my screen, also how can i remove an access/secret keypair once added? we should have a delete button, you can take a look at how we implemented the keypair certificates on the encryption section of the add tenant wizard

@Alevsk
Copy link
Contributor

Alevsk commented Apr 22, 2021

Screen Shot 2021-04-22 at 15 32 44

I think length policy only applies to secret key, access key can be less than 8 characters (via mc admin user add I can create users with access key alevsk), need to confirm this with @harshavardhana

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants