Skip to content

the 'console' create failed. #114

Closed

Description

@feiyuyitiao

operator got error when apply console.yaml

2022-07-12T10:58:11.493Z        ERROR   controller.console-controller   Reconciler error        {"name": "console", "namespace": "mq", 
"error": "Deployment.apps \"console\" is invalid: spec.template.metadata.labels: Invalid value: map[string]string(nil): `selector` does not match template `labels`"}

Activity

  1. caigy commented on Jul 12, 2022

    @caigy
    Contributor

    @feiyuyitiao Is spec.template.metadata.labels defined in console.yaml?

  2. feiyuyitiao commented on Jul 13, 2022

    @feiyuyitiao
    Author

    fix by change code: pkg/controller/console/console_controller.go:201

    //Labels: cr.Spec.ConsoleDeployment.Spec.Template.ObjectMeta.Labels,
      Labels: cr.Spec.ConsoleDeployment.Spec.Selector.MatchLabels,  
    
  3. ccctask commented on Jul 14, 2022

    @ccctask

    same issue with me 😯

  4. ccctask commented on Jul 14, 2022

    @ccctask

    rocketmq-operator/example/rocketmq_v1alpha1_rocketmq_cluster.yaml with example resources define

    apiVersion: rocketmq.apache.org/v1alpha1
    kind: Console
    metadata:
      name: console
    spec:
      # nameServers is the [ip:port] list of name service
      nameServers: ""
      # consoleDeployment define the console deployment
      consoleDeployment:
        apiVersion: apps/v1
        kind: Deployment
        metadata:
          labels:
            app: rocketmq-console
        spec:
          replicas: 1
          selector:
            matchLabels:
              app: rocketmq-console
          template:
            metadata:
              labels:
                app: rocketmq-console
            spec:
              containers:
                - name: console
                  image: apacherocketmq/rocketmq-console:2.0.0
                  ports:
                    - containerPort: 8080
  5. ccctask commented on Jul 14, 2022

    @ccctask

    fix by change code: pkg/controller/console/console_controller.go:201

    //Labels: cr.Spec.ConsoleDeployment.Spec.Template.ObjectMeta.Labels,
      Labels: cr.Spec.ConsoleDeployment.Spec.Selector.MatchLabels,  
    

    :-) This solves the problem, but causes the deployment to rely on its own selector label, not the templates's label

  6. caigy commented on Jul 15, 2022

    @caigy
    Contributor

    spec.template.metadata.labels was nil, maybe you can kubectl describe the console resource to check the actual definition of this resource, also check the console crd is correct or not.

  7. added
    bug
    on Jul 20, 2022
  8. added a commit that references this issue on Jul 20, 2022
  9. added this to the 0.3.0 milestone on Jul 20, 2022
  10. RockteMQ-AI commented on Aug 22, 2026

    @RockteMQ-AI

    Issue Evaluation

    Category: bug | Status: Likely Valid

    The error indicates the Console controller creates a Deployment where spec.selector does not match spec.template.metadata.labels. This is a Kubernetes validation error — the Deployment spec requires the selector to match the pod template labels.

    Root cause hypothesis: The controller generates the Deployment object with a nil or mismatched label selector, likely because the Console CR does not propagate labels correctly to the generated Deployment spec.

    Note: Filed July 2022. Please verify against the current operator version.


    Automated evaluation by RockteMQ-AI

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions