Skip to content

Commit

Permalink
remove pointer from Users field (minio#1892)
Browse files Browse the repository at this point in the history
Signed-off-by: pjuarezd <pjuarezd@users.noreply.github.com>
  • Loading branch information
pjuarezd authored Nov 28, 2023
1 parent 42749b8 commit eaf5f0c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 20 deletions.
10 changes: 5 additions & 5 deletions api/tenant-add-handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func createTenant(ctx context.Context, params operator_api.CreateTenantParams, c

accessKey, secretKey := getTenantCredentials(tenantReq.AccessKey, tenantReq.SecretKey)
tenantName := *tenantReq.Name
var users []*corev1.LocalObjectReference
var users []corev1.LocalObjectReference

// delete secrets created if an errors occurred during tenant creation,
defer func() {
Expand Down Expand Up @@ -387,7 +387,7 @@ func deleteSecretsIfTenantCreationFails(ctx context.Context, mError *models.Erro
}
}

func setTenantActiveDirectoryConfig(ctx context.Context, clientSet K8sClientI, tenantReq *models.CreateTenantRequest, tenantConfigurationENV map[string]string, users []*corev1.LocalObjectReference) (map[string]string, []*corev1.LocalObjectReference, error) {
func setTenantActiveDirectoryConfig(ctx context.Context, clientSet K8sClientI, tenantReq *models.CreateTenantRequest, tenantConfigurationENV map[string]string, users []corev1.LocalObjectReference) (map[string]string, []corev1.LocalObjectReference, error) {
imm := true
serverAddress := *tenantReq.Idp.ActiveDirectory.URL
tlsSkipVerify := tenantReq.Idp.ActiveDirectory.SkipTLSVerification
Expand Down Expand Up @@ -427,7 +427,7 @@ func setTenantActiveDirectoryConfig(ctx context.Context, clientSet K8sClientI, t
// Attach the list of LDAP user DNs that will be administrator for the Tenant
for i, userDN := range tenantReq.Idp.ActiveDirectory.UserDNS {
userSecretName := fmt.Sprintf("%s-user-%d", *tenantReq.Name, i)
users = append(users, &corev1.LocalObjectReference{Name: userSecretName})
users = append(users, corev1.LocalObjectReference{Name: userSecretName})

userSecret := corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -466,11 +466,11 @@ func setTenantOIDCConfig(tenantReq *models.CreateTenantRequest, tenantConfigurat
return tenantConfigurationENV
}

func setTenantBuiltInUsers(ctx context.Context, clientSet K8sClientI, tenantReq *models.CreateTenantRequest, users []*corev1.LocalObjectReference) ([]*corev1.LocalObjectReference, error) {
func setTenantBuiltInUsers(ctx context.Context, clientSet K8sClientI, tenantReq *models.CreateTenantRequest, users []corev1.LocalObjectReference) ([]corev1.LocalObjectReference, error) {
imm := true
for i := 0; i < len(tenantReq.Idp.Keys); i++ {
userSecretName := fmt.Sprintf("%s-user-%d", *tenantReq.Name, i)
users = append(users, &corev1.LocalObjectReference{Name: userSecretName})
users = append(users, corev1.LocalObjectReference{Name: userSecretName})
userSecret := corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: userSecretName,
Expand Down
2 changes: 1 addition & 1 deletion kubectl-minio/cmd/resources/tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func NewTenant(opts *TenantOptions, userSecret *v1.Secret) (*miniov2.Tenant, err
Mountpath: helpers.MinIOMountPath,
KES: tenantKESConfig(opts.Name, opts.KmsSecret, opts.KesImage),
ImagePullSecret: v1.LocalObjectReference{Name: opts.ImagePullSecret},
Users: []*v1.LocalObjectReference{
Users: []v1.LocalObjectReference{
{
Name: userSecret.Name,
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/minio.min.io/v2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ type TenantSpec struct {
//
// The Operator creates each user with the `consoleAdmin` policy by default. You can change the assigned policy after the Tenant starts. +
// +optional
Users []*corev1.LocalObjectReference `json:"users,omitempty"`
Users []corev1.LocalObjectReference `json:"users,omitempty"`
// *Optional* +
//
// Create buckets when creating a new tenant. Skip if bucket with given name already exists
Expand Down
10 changes: 2 additions & 8 deletions pkg/apis/minio.min.io/v2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions pkg/client/applyconfiguration/minio.min.io/v2/tenantspec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit eaf5f0c

Please sign in to comment.