add new api version
diff --git a/deploy/crds/rocketmq_v1alpha1_broker_cr.yaml b/deploy/crds/rocketmq_v1alpha1_broker_cr.yaml
new file mode 100644
index 0000000..686c570
--- /dev/null
+++ b/deploy/crds/rocketmq_v1alpha1_broker_cr.yaml
@@ -0,0 +1,7 @@
+apiVersion: rocketmq.apache.org/v1alpha1
+kind: Broker
+metadata:
+  name: example-broker
+spec:
+  # Add fields here
+  size: 3
diff --git a/deploy/crds/rocketmq_v1alpha1_broker_crd.yaml b/deploy/crds/rocketmq_v1alpha1_broker_crd.yaml
new file mode 100644
index 0000000..66eb2a5
--- /dev/null
+++ b/deploy/crds/rocketmq_v1alpha1_broker_crd.yaml
@@ -0,0 +1,38 @@
+apiVersion: apiextensions.k8s.io/v1beta1
+kind: CustomResourceDefinition
+metadata:
+  name: brokers.rocketmq.apache.org
+spec:
+  group: rocketmq.apache.org
+  names:
+    kind: Broker
+    listKind: BrokerList
+    plural: brokers
+    singular: broker
+  scope: Namespaced
+  subresources:
+    status: {}
+  validation:
+    openAPIV3Schema:
+      properties:
+        apiVersion:
+          description: 'APIVersion defines the versioned schema of this representation
+            of an object. Servers should convert recognized schemas to the latest
+            internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
+          type: string
+        kind:
+          description: 'Kind is a string value representing the REST resource this
+            object represents. Servers may infer this from the endpoint the client
+            submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
+          type: string
+        metadata:
+          type: object
+        spec:
+          type: object
+        status:
+          type: object
+  version: v1alpha1
+  versions:
+  - name: v1alpha1
+    served: true
+    storage: true
diff --git a/deploy/crds/rocketmq_v1alpha1_nameservice_cr.yaml b/deploy/crds/rocketmq_v1alpha1_nameservice_cr.yaml
new file mode 100644
index 0000000..7d5e22c
--- /dev/null
+++ b/deploy/crds/rocketmq_v1alpha1_nameservice_cr.yaml
@@ -0,0 +1,7 @@
+apiVersion: rocketmq.apache.org/v1alpha1
+kind: NameService
+metadata:
+  name: example-nameservice
+spec:
+  # Add fields here
+  size: 3
diff --git a/deploy/crds/rocketmq_v1alpha1_nameservice_crd.yaml b/deploy/crds/rocketmq_v1alpha1_nameservice_crd.yaml
new file mode 100644
index 0000000..29d33cd
--- /dev/null
+++ b/deploy/crds/rocketmq_v1alpha1_nameservice_crd.yaml
@@ -0,0 +1,38 @@
+apiVersion: apiextensions.k8s.io/v1beta1
+kind: CustomResourceDefinition
+metadata:
+  name: nameservices.rocketmq.apache.org
+spec:
+  group: rocketmq.apache.org
+  names:
+    kind: NameService
+    listKind: NameServiceList
+    plural: nameservices
+    singular: nameservice
+  scope: Namespaced
+  subresources:
+    status: {}
+  validation:
+    openAPIV3Schema:
+      properties:
+        apiVersion:
+          description: 'APIVersion defines the versioned schema of this representation
+            of an object. Servers should convert recognized schemas to the latest
+            internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
+          type: string
+        kind:
+          description: 'Kind is a string value representing the REST resource this
+            object represents. Servers may infer this from the endpoint the client
+            submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
+          type: string
+        metadata:
+          type: object
+        spec:
+          type: object
+        status:
+          type: object
+  version: v1alpha1
+  versions:
+  - name: v1alpha1
+    served: true
+    storage: true
diff --git a/deploy/role.yaml b/deploy/role.yaml
index 5dc243e..a6d4419 100644
--- a/deploy/role.yaml
+++ b/deploy/role.yaml
@@ -1,18 +1,3 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
 apiVersion: rbac.authorization.k8s.io/v1
 kind: Role
 metadata:
@@ -73,3 +58,10 @@
   - '*'
   verbs:
   - '*'
+- apiGroups:
+  - rocketmq.apache.org
+  resources:
+  - '*'
+  - brokers
+  verbs:
+  - '*'
diff --git a/pkg/apis/addtoscheme_rocketmq_v1alpha1.go b/pkg/apis/addtoscheme_rocketmq_v1alpha1.go
index fed371c..96edad6 100644
--- a/pkg/apis/addtoscheme_rocketmq_v1alpha1.go
+++ b/pkg/apis/addtoscheme_rocketmq_v1alpha1.go
@@ -1,20 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
 package apis
 
 import (
diff --git a/pkg/apis/rocketmq/v1alpha1/broker_types.go b/pkg/apis/rocketmq/v1alpha1/broker_types.go
new file mode 100644
index 0000000..7c64c95
--- /dev/null
+++ b/pkg/apis/rocketmq/v1alpha1/broker_types.go
@@ -0,0 +1,67 @@
+package v1alpha1
+
+import (
+	corev1 "k8s.io/api/core/v1"
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+)
+
+// EDIT THIS FILE!  THIS IS SCAFFOLDING FOR YOU TO OWN!
+// NOTE: json tags are required.  Any new fields you add must have json tags for the fields to be serialized.
+
+// BrokerSpec defines the desired state of Broker
+// +k8s:openapi-gen=true
+type BrokerSpec struct {
+	// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
+	// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
+	// Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html
+	Size int32 `json:"size"`
+	// NameServers defines the name service list e.g. 192.168.1.1:9876;192.168.1.2:9876
+	NameServers string `json:"nameServers,omitempty"`
+	// ReplicationMode is SYNC or ASYNC
+	ReplicationMode string `json:"replicationMode,omitempty"`
+	// ReplicaPerGroup each broker cluster's replica number
+	ReplicaPerGroup int `json:"replicaPerGroup"`
+	// BaseImage is the broker image to use for the Pods.
+	BrokerImage string `json:"brokerImage"`
+	// ImagePullPolicy defines how the image is pulled.
+	ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy"`
+	// AllowRestart defines whether allow pod restart
+	AllowRestart bool `json:"allowRestart"`
+	// VolumeClaimTemplates defines the StorageClass
+	VolumeClaimTemplates []corev1.PersistentVolumeClaim `json:"volumeClaimTemplates"`
+}
+
+// BrokerStatus defines the observed state of Broker
+// +k8s:openapi-gen=true
+type BrokerStatus struct {
+	// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
+	// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
+	// Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html
+	Nodes []string `json:"nodes"`
+}
+
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+
+// Broker is the Schema for the brokers API
+// +k8s:openapi-gen=true
+// +kubebuilder:subresource:status
+type Broker struct {
+	metav1.TypeMeta   `json:",inline"`
+	metav1.ObjectMeta `json:"metadata,omitempty"`
+
+	Spec   BrokerSpec   `json:"spec,omitempty"`
+	Status BrokerStatus `json:"status,omitempty"`
+}
+
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+
+// BrokerList contains a list of Broker
+type BrokerList struct {
+	metav1.TypeMeta `json:",inline"`
+	metav1.ListMeta `json:"metadata,omitempty"`
+	Items           []Broker `json:"items"`
+}
+
+func init() {
+	SchemeBuilder.Register(&Broker{}, &BrokerList{})
+}
diff --git a/pkg/apis/rocketmq/v1alpha1/nameservice_types.go b/pkg/apis/rocketmq/v1alpha1/nameservice_types.go
new file mode 100644
index 0000000..9678548
--- /dev/null
+++ b/pkg/apis/rocketmq/v1alpha1/nameservice_types.go
@@ -0,0 +1,61 @@
+package v1alpha1
+
+import (
+	corev1 "k8s.io/api/core/v1"
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+)
+
+// EDIT THIS FILE!  THIS IS SCAFFOLDING FOR YOU TO OWN!
+// NOTE: json tags are required.  Any new fields you add must have json tags for the fields to be serialized.
+
+// NameServiceSpec defines the desired state of NameService
+// +k8s:openapi-gen=true
+type NameServiceSpec struct {
+	// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
+	// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
+	// Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html
+	// Size is the number of the name service Pod
+	Size int32 `json:"size"`
+	//MetaServiceImage is the name service image
+	MetaServiceImage string `json:"metaServiceImage"`
+	// ImagePullPolicy defines how the image is pulled.
+	ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy"`
+	// VolumeClaimTemplates defines the StorageClass
+	VolumeClaimTemplates []corev1.PersistentVolumeClaim `json:"volumeClaimTemplates"`
+}
+
+// NameServiceStatus defines the observed state of NameService
+// +k8s:openapi-gen=true
+type NameServiceStatus struct {
+	// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
+	// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
+	// Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html
+	// MetaServers is the name service ip list
+	MetaServers []string `json:"metaServers"`
+}
+
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+
+// NameService is the Schema for the nameservices API
+// +k8s:openapi-gen=true
+// +kubebuilder:subresource:status
+type NameService struct {
+	metav1.TypeMeta   `json:",inline"`
+	metav1.ObjectMeta `json:"metadata,omitempty"`
+
+	Spec   NameServiceSpec   `json:"spec,omitempty"`
+	Status NameServiceStatus `json:"status,omitempty"`
+}
+
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+
+// NameServiceList contains a list of NameService
+type NameServiceList struct {
+	metav1.TypeMeta `json:",inline"`
+	metav1.ListMeta `json:"metadata,omitempty"`
+	Items           []NameService `json:"items"`
+}
+
+func init() {
+	SchemeBuilder.Register(&NameService{}, &NameServiceList{})
+}
diff --git a/pkg/controller/add_nameservice.go b/pkg/controller/add_nameservice.go
new file mode 100644
index 0000000..29d1be6
--- /dev/null
+++ b/pkg/controller/add_nameservice.go
@@ -0,0 +1,10 @@
+package controller
+
+import (
+	"github.com/operator-sdk-samples/rocketmq-operator/pkg/controller/nameservice"
+)
+
+func init() {
+	// AddToManagerFuncs is a list of functions to create controllers and add them to a manager.
+	AddToManagerFuncs = append(AddToManagerFuncs, nameservice.Add)
+}
diff --git a/pkg/controller/nameservice/nameservice_controller.go b/pkg/controller/nameservice/nameservice_controller.go
new file mode 100644
index 0000000..7900b18
--- /dev/null
+++ b/pkg/controller/nameservice/nameservice_controller.go
@@ -0,0 +1,153 @@
+package nameservice
+
+import (
+	"context"
+
+	rocketmqv1alpha1 "github.com/operator-sdk-samples/rocketmq-operator/pkg/apis/rocketmq/v1alpha1"
+	corev1 "k8s.io/api/core/v1"
+	"k8s.io/apimachinery/pkg/api/errors"
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	"k8s.io/apimachinery/pkg/runtime"
+	"k8s.io/apimachinery/pkg/types"
+	"sigs.k8s.io/controller-runtime/pkg/client"
+	"sigs.k8s.io/controller-runtime/pkg/controller"
+	"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
+	"sigs.k8s.io/controller-runtime/pkg/handler"
+	"sigs.k8s.io/controller-runtime/pkg/manager"
+	"sigs.k8s.io/controller-runtime/pkg/reconcile"
+	logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
+	"sigs.k8s.io/controller-runtime/pkg/source"
+)
+
+var log = logf.Log.WithName("controller_nameservice")
+
+/**
+* USER ACTION REQUIRED: This is a scaffold file intended for the user to modify with their own Controller
+* business logic.  Delete these comments after modifying this file.*
+ */
+
+// Add creates a new NameService Controller and adds it to the Manager. The Manager will set fields on the Controller
+// and Start it when the Manager is Started.
+func Add(mgr manager.Manager) error {
+	return add(mgr, newReconciler(mgr))
+}
+
+// newReconciler returns a new reconcile.Reconciler
+func newReconciler(mgr manager.Manager) reconcile.Reconciler {
+	return &ReconcileNameService{client: mgr.GetClient(), scheme: mgr.GetScheme()}
+}
+
+// add adds a new Controller to mgr with r as the reconcile.Reconciler
+func add(mgr manager.Manager, r reconcile.Reconciler) error {
+	// Create a new controller
+	c, err := controller.New("nameservice-controller", mgr, controller.Options{Reconciler: r})
+	if err != nil {
+		return err
+	}
+
+	// Watch for changes to primary resource NameService
+	err = c.Watch(&source.Kind{Type: &rocketmqv1alpha1.NameService{}}, &handler.EnqueueRequestForObject{})
+	if err != nil {
+		return err
+	}
+
+	// TODO(user): Modify this to be the types you create that are owned by the primary resource
+	// Watch for changes to secondary resource Pods and requeue the owner NameService
+	err = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{
+		IsController: true,
+		OwnerType:    &rocketmqv1alpha1.NameService{},
+	})
+	if err != nil {
+		return err
+	}
+
+	return nil
+}
+
+// blank assignment to verify that ReconcileNameService implements reconcile.Reconciler
+var _ reconcile.Reconciler = &ReconcileNameService{}
+
+// ReconcileNameService reconciles a NameService object
+type ReconcileNameService struct {
+	// This client, initialized using mgr.Client() above, is a split client
+	// that reads objects from the cache and writes to the apiserver
+	client client.Client
+	scheme *runtime.Scheme
+}
+
+// Reconcile reads that state of the cluster for a NameService object and makes changes based on the state read
+// and what is in the NameService.Spec
+// TODO(user): Modify this Reconcile function to implement your Controller logic.  This example creates
+// a Pod as an example
+// Note:
+// The Controller will requeue the Request to be processed again if the returned error is non-nil or
+// Result.Requeue is true, otherwise upon completion it will remove the work from the queue.
+func (r *ReconcileNameService) Reconcile(request reconcile.Request) (reconcile.Result, error) {
+	reqLogger := log.WithValues("Request.Namespace", request.Namespace, "Request.Name", request.Name)
+	reqLogger.Info("Reconciling NameService")
+
+	// Fetch the NameService instance
+	instance := &rocketmqv1alpha1.NameService{}
+	err := r.client.Get(context.TODO(), request.NamespacedName, instance)
+	if err != nil {
+		if errors.IsNotFound(err) {
+			// Request object not found, could have been deleted after reconcile request.
+			// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.
+			// Return and don't requeue
+			return reconcile.Result{}, nil
+		}
+		// Error reading the object - requeue the request.
+		return reconcile.Result{}, err
+	}
+
+	// Define a new Pod object
+	pod := newPodForCR(instance)
+
+	// Set NameService instance as the owner and controller
+	if err := controllerutil.SetControllerReference(instance, pod, r.scheme); err != nil {
+		return reconcile.Result{}, err
+	}
+
+	// Check if this Pod already exists
+	found := &corev1.Pod{}
+	err = r.client.Get(context.TODO(), types.NamespacedName{Name: pod.Name, Namespace: pod.Namespace}, found)
+	if err != nil && errors.IsNotFound(err) {
+		reqLogger.Info("Creating a new Pod", "Pod.Namespace", pod.Namespace, "Pod.Name", pod.Name)
+		err = r.client.Create(context.TODO(), pod)
+		if err != nil {
+			return reconcile.Result{}, err
+		}
+
+		// Pod created successfully - don't requeue
+		return reconcile.Result{}, nil
+	} else if err != nil {
+		return reconcile.Result{}, err
+	}
+
+	// Pod already exists - don't requeue
+	reqLogger.Info("Skip reconcile: Pod already exists", "Pod.Namespace", found.Namespace, "Pod.Name", found.Name)
+	return reconcile.Result{}, nil
+}
+
+// newPodForCR returns a busybox pod with the same name/namespace as the cr
+func newPodForCR(cr *rocketmqv1alpha1.NameService) *corev1.Pod {
+	labels := map[string]string{
+		"app": cr.Name,
+	}
+	return &corev1.Pod{
+		ObjectMeta: metav1.ObjectMeta{
+			Name:      cr.Name + "-pod",
+			Namespace: cr.Namespace,
+			Labels:    labels,
+		},
+		Spec: corev1.PodSpec{
+			Containers: []corev1.Container{
+				{
+					Name:    "busybox",
+					Image:   "busybox",
+					Command: []string{"sleep", "3600"},
+				},
+			},
+		},
+	}
+}