Skip to content
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

Fail to add defualt label to console #2047

Closed
TZ-zzz opened this issue Mar 27, 2024 · 1 comment · Fixed by #2049
Closed

Fail to add defualt label to console #2047

TZ-zzz opened this issue Mar 27, 2024 · 1 comment · Fixed by #2049

Comments

@TZ-zzz
Copy link

TZ-zzz commented Mar 27, 2024

Expected Behavior

The operator should add a default label to service xxx-console.

Current Behavior

If we apply a CR that omits consoleServiceLabels field under spec.serviceMetadata, operator will create a service called xxx-console without default label. However, if we apply a CR that has the field consoleServiceLabels with an empty dictionary, the operator will add the default label to the service.

Possible Solution

https://github.com/minio/operator/blob/master/pkg/resources/services/service.go#L90C1-L91C1 At this line, internalLabels are added to the varaible labels only when Spec.ServiceMetadata.ConsoleServiceLabels != nil. There should be an else statement like https://github.com/minio/operator/blob/master/pkg/resources/services/service.go#L38 in the NewClusterIPForMinIO function. That is add the following code right after line 91

else {
		labels = internalLabels
	}

Steps to Reproduce (for bugs)

  1. Simply apply this CR
apiVersion: minio.min.io/v2
kind: Tenant
metadata:
  name: test-cluster
  namespace: minio-operator
  labels:
    app: minio
spec:
  features:
    bucketDNS: false
  users:
    - name: storage-user
  podManagementPolicy: Parallel
  configuration:
    name: storage-configuration
  env: [ ]
  serviceMetadata: {}
    # if you add consoleServiceLabels : {} here, the operator will add the default label correctly 
  image: quay.io/minio/minio:RELEASE.2024-02-09T21-25-16Z
  mountPath: /export
  pools:
    - servers: 1
      name: pool-0
      volumesPerServer: 4
      volumeClaimTemplate:
        apiVersion: v1
        kind: persistentvolumeclaims
        metadata: { }
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 2Gi
          storageClassName: standard
        status: {}
  requestAutoCert: true

This will create a service without default label in my case test-cluster-console without label v1.min.io/console": "test-cluster-console.

Your Environment

  • Version used (minio-operator): 5.0.11
  • Environment name and version (e.g. kubernetes v1.17.2): kubernetes v1.29.2
@TZ-zzz
Copy link
Author

TZ-zzz commented Mar 27, 2024

This bug is automatically found by Acto, an end-to-end testing tool for Kubernetes operators/controllers. Here is the link to the tool https://github.com/xlab-uiuc/acto

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

Successfully merging a pull request may close this issue.

1 participant