This is an automated email from the ASF dual-hosted git repository.

zhongxjian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git


The following commit(s) were added to refs/heads/master by this push:
     new 56794514 [operator] Add validate commandlogic
56794514 is described below

commit 567945142ac7eb81e923a7d5f9169fb436eab2bc
Author: mfordjody <[email protected]>
AuthorDate: Thu Dec 26 09:33:56 2024 +0800

    [operator] Add validate commandlogic
---
 dubboctl/cmd/root.go                            |   2 +-
 dubboctl/my-config.yaml                         | 935 ------------------------
 dubboctl/pkg/cli/context.go                     |   1 +
 dubboctl/pkg/cli/options.go                     |   8 +
 {operator => dubboctl}/pkg/validate/validate.go |  20 +-
 5 files changed, 29 insertions(+), 937 deletions(-)

diff --git a/dubboctl/cmd/root.go b/dubboctl/cmd/root.go
index d4892165..a98eb2fc 100644
--- a/dubboctl/cmd/root.go
+++ b/dubboctl/cmd/root.go
@@ -18,8 +18,8 @@ package cmd
 import (
        "flag"
        "github.com/apache/dubbo-kubernetes/dubboctl/pkg/cli"
+       "github.com/apache/dubbo-kubernetes/dubboctl/pkg/validate"
        "github.com/apache/dubbo-kubernetes/operator/cmd/cluster"
-       "github.com/apache/dubbo-kubernetes/operator/pkg/validate"
        "github.com/spf13/cobra"
 )
 
diff --git a/dubboctl/my-config.yaml b/dubboctl/my-config.yaml
deleted file mode 100644
index d5c96eab..00000000
--- a/dubboctl/my-config.yaml
+++ /dev/null
@@ -1,935 +0,0 @@
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
-  annotations:
-    controller-gen.kubebuilder.io/version: v0.14.0
-  name: conditionroutes.dubbo.io
-spec:
-  group: dubbo.io
-  names:
-    categories:
-    - dubbo
-    kind: ConditionRoute
-    listKind: ConditionRouteList
-    plural: conditionroutes
-    singular: conditionroute
-  scope: Cluster
-  versions:
-  - name: v1alpha1
-    schema:
-      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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds
-            type: string
-          mesh:
-            description: |-
-              Mesh is the name of the dubbo mesh this resource belongs to.
-              It may be omitted for cluster-scoped resources.
-            type: string
-          metadata:
-            type: object
-          spec:
-            description: Spec is the specification of the Dubbo ConditionRoute 
resource.
-            x-kubernetes-preserve-unknown-fields: true
-        type: object
-    served: true
-    storage: true
-
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
-  annotations:
-    controller-gen.kubebuilder.io/version: v0.14.0
-  name: dataplaneinsights.dubbo.io
-spec:
-  group: dubbo.io
-  names:
-    categories:
-    - dubbo
-    kind: DataplaneInsight
-    listKind: DataplaneInsightList
-    plural: dataplaneinsights
-    singular: dataplaneinsight
-  scope: Namespaced
-  versions:
-  - name: v1alpha1
-    schema:
-      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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds
-            type: string
-          mesh:
-            description: |-
-              Mesh is the name of the dubbo mesh this resource belongs to.
-              It may be omitted for cluster-scoped resources.
-            type: string
-          metadata:
-            type: object
-          status:
-            description: Status is the status the dubbo resource.
-            x-kubernetes-preserve-unknown-fields: true
-        type: object
-    served: true
-    storage: true
-
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
-  annotations:
-    controller-gen.kubebuilder.io/version: v0.14.0
-  name: dataplanes.dubbo.io
-spec:
-  group: dubbo.io
-  names:
-    categories:
-    - dubbo
-    kind: Dataplane
-    listKind: DataplaneList
-    plural: dataplanes
-    singular: dataplane
-  scope: Namespaced
-  versions:
-  - name: v1alpha1
-    schema:
-      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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds
-            type: string
-          mesh:
-            description: |-
-              Mesh is the name of the dubbo mesh this resource belongs to.
-              It may be omitted for cluster-scoped resources.
-            type: string
-          metadata:
-            type: object
-          spec:
-            description: Spec is the specification of the Dubbo Dataplane 
resource.
-            x-kubernetes-preserve-unknown-fields: true
-        type: object
-    served: true
-    storage: true
-
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
-  annotations:
-    controller-gen.kubebuilder.io/version: v0.14.0
-  name: datasources.dubbo.io
-spec:
-  group: dubbo.io
-  names:
-    categories:
-    - dubbo
-    kind: DataSource
-    listKind: DataSourceList
-    plural: datasources
-    singular: datasource
-  scope: Cluster
-  versions:
-  - name: v1alpha1
-    schema:
-      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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds
-            type: string
-          mesh:
-            description: |-
-              Mesh is the name of the dubbo mesh this resource belongs to.
-              It may be omitted for cluster-scoped resources.
-            type: string
-          metadata:
-            type: object
-          spec:
-            description: Spec is the specification of the Dubbo DataSource 
resource.
-            x-kubernetes-preserve-unknown-fields: true
-        type: object
-    served: true
-    storage: true
-
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
-  annotations:
-    controller-gen.kubebuilder.io/version: v0.14.0
-  name: dynamicconfigs.dubbo.io
-spec:
-  group: dubbo.io
-  names:
-    categories:
-    - dubbo
-    kind: DynamicConfig
-    listKind: DynamicConfigList
-    plural: dynamicconfigs
-    singular: dynamicconfig
-  scope: Cluster
-  versions:
-  - name: v1alpha1
-    schema:
-      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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds
-            type: string
-          mesh:
-            description: |-
-              Mesh is the name of the dubbo mesh this resource belongs to.
-              It may be omitted for cluster-scoped resources.
-            type: string
-          metadata:
-            type: object
-          spec:
-            description: Spec is the specification of the Dubbo DynamicConfig 
resource.
-            x-kubernetes-preserve-unknown-fields: true
-        type: object
-    served: true
-    storage: true
-
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
-  annotations:
-    controller-gen.kubebuilder.io/version: v0.14.0
-  name: mappings.dubbo.io
-spec:
-  group: dubbo.io
-  names:
-    categories:
-    - dubbo
-    kind: Mapping
-    listKind: MappingList
-    plural: mappings
-    singular: mapping
-  scope: Namespaced
-  versions:
-  - name: v1alpha1
-    schema:
-      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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds
-            type: string
-          mesh:
-            description: |-
-              Mesh is the name of the dubbo mesh this resource belongs to.
-              It may be omitted for cluster-scoped resources.
-            type: string
-          metadata:
-            type: object
-          spec:
-            description: Spec is the specification of the Dubbo Mapping 
resource.
-            x-kubernetes-preserve-unknown-fields: true
-        type: object
-    served: true
-    storage: true
-
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
-  annotations:
-    controller-gen.kubebuilder.io/version: v0.14.0
-  name: meshes.dubbo.io
-spec:
-  group: dubbo.io
-  names:
-    categories:
-    - dubbo
-    kind: Mesh
-    listKind: MeshList
-    plural: meshes
-    singular: mesh
-  scope: Cluster
-  versions:
-  - name: v1alpha1
-    schema:
-      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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds
-            type: string
-          mesh:
-            description: |-
-              Mesh is the name of the dubbo mesh this resource belongs to.
-              It may be omitted for cluster-scoped resources.
-            type: string
-          metadata:
-            type: object
-          spec:
-            description: Spec is the specification of the Dubbo Mesh resource.
-            x-kubernetes-preserve-unknown-fields: true
-        type: object
-    served: true
-    storage: true
-
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
-  annotations:
-    controller-gen.kubebuilder.io/version: v0.14.0
-  name: meshinsights.dubbo.io
-spec:
-  group: dubbo.io
-  names:
-    categories:
-    - dubbo
-    kind: MeshInsight
-    listKind: MeshInsightList
-    plural: meshinsights
-    singular: meshinsight
-  scope: Cluster
-  versions:
-  - name: v1alpha1
-    schema:
-      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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds
-            type: string
-          mesh:
-            description: |-
-              Mesh is the name of the dubbo mesh this resource belongs to.
-              It may be omitted for cluster-scoped resources.
-            type: string
-          metadata:
-            type: object
-          spec:
-            description: Spec is the specification of the Dubbo MeshInsight 
resource.
-            x-kubernetes-preserve-unknown-fields: true
-        type: object
-    served: true
-    storage: true
-
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
-  annotations:
-    controller-gen.kubebuilder.io/version: v0.14.0
-  name: metadata.dubbo.io
-spec:
-  group: dubbo.io
-  names:
-    categories:
-    - dubbo
-    kind: MetaData
-    listKind: MetaDataList
-    plural: metadata
-    singular: metadata
-  scope: Namespaced
-  versions:
-  - name: v1alpha1
-    schema:
-      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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds
-            type: string
-          mesh:
-            description: |-
-              Mesh is the name of the dubbo mesh this resource belongs to.
-              It may be omitted for cluster-scoped resources.
-            type: string
-          metadata:
-            type: object
-          spec:
-            description: Spec is the specification of the Dubbo MetaData 
resource.
-            x-kubernetes-preserve-unknown-fields: true
-        type: object
-    served: true
-    storage: true
-
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
-  annotations:
-    controller-gen.kubebuilder.io/version: v0.14.0
-  name: secrets.dubbo.io
-spec:
-  group: dubbo.io
-  names:
-    categories:
-    - dubbo
-    kind: Secret
-    listKind: SecretList
-    plural: secrets
-    singular: secret
-  scope: Cluster
-  versions:
-  - name: v1alpha1
-    schema:
-      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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds
-            type: string
-          mesh:
-            description: |-
-              Mesh is the name of the dubbo mesh this resource belongs to.
-              It may be omitted for cluster-scoped resources.
-            type: string
-          metadata:
-            type: object
-          spec:
-            description: Spec is the specification of the Dubbo Secret 
resource.
-            x-kubernetes-preserve-unknown-fields: true
-        type: object
-    served: true
-    storage: true
-
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
-  annotations:
-    controller-gen.kubebuilder.io/version: v0.14.0
-  name: servicenamemappings.dubbo.io
-spec:
-  group: dubbo.io
-  names:
-    categories:
-    - dubbo
-    kind: ServiceNameMapping
-    listKind: ServiceNameMappingList
-    plural: servicenamemappings
-    singular: servicenamemapping
-  scope: Namespaced
-  versions:
-  - name: v1alpha1
-    schema:
-      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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds
-            type: string
-          metadata:
-            type: object
-          spec:
-            description: Spec is the specification of the Dubbo 
ServiceNameMapping
-              resource.
-            properties:
-              applicationNames:
-                items:
-                  type: string
-                type: array
-              interfaceName:
-                type: string
-              namespace:
-                type: string
-            required:
-            - applicationNames
-            - interfaceName
-            - namespace
-            type: object
-        type: object
-    served: true
-    storage: true
-
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
-  annotations:
-    controller-gen.kubebuilder.io/version: v0.14.0
-  name: tagroutes.dubbo.io
-spec:
-  group: dubbo.io
-  names:
-    categories:
-    - dubbo
-    kind: TagRoute
-    listKind: TagRouteList
-    plural: tagroutes
-    singular: tagroute
-  scope: Cluster
-  versions:
-  - name: v1alpha1
-    schema:
-      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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds
-            type: string
-          mesh:
-            description: |-
-              Mesh is the name of the dubbo mesh this resource belongs to.
-              It may be omitted for cluster-scoped resources.
-            type: string
-          metadata:
-            type: object
-          spec:
-            description: Spec is the specification of the Dubbo TagRoute 
resource.
-            x-kubernetes-preserve-unknown-fields: true
-        type: object
-    served: true
-    storage: true
-
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
-  annotations:
-    controller-gen.kubebuilder.io/version: v0.14.0
-  name: zoneegresses.dubbo.io
-spec:
-  group: dubbo.io
-  names:
-    categories:
-    - dubbo
-    kind: ZoneEgress
-    listKind: ZoneEgressList
-    plural: zoneegresses
-    singular: zoneegress
-  scope: Namespaced
-  versions:
-  - name: v1alpha1
-    schema:
-      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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds
-            type: string
-          mesh:
-            description: |-
-              Mesh is the name of the dubbo mesh this resource belongs to.
-              It may be omitted for cluster-scoped resources.
-            type: string
-          metadata:
-            type: object
-          spec:
-            description: Spec is the specification of the Dubbo ZoneEgress 
resource.
-            x-kubernetes-preserve-unknown-fields: true
-        type: object
-    served: true
-    storage: true
-
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
-  annotations:
-    controller-gen.kubebuilder.io/version: v0.14.0
-  name: zoneegressinsights.dubbo.io
-spec:
-  group: dubbo.io
-  names:
-    categories:
-    - dubbo
-    kind: ZoneEgressInsight
-    listKind: ZoneEgressInsightList
-    plural: zoneegressinsights
-    singular: zoneegressinsight
-  scope: Namespaced
-  versions:
-  - name: v1alpha1
-    schema:
-      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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds
-            type: string
-          mesh:
-            description: |-
-              Mesh is the name of the dubbo mesh this resource belongs to.
-              It may be omitted for cluster-scoped resources.
-            type: string
-          metadata:
-            type: object
-          spec:
-            description: Spec is the specification of the Dubbo 
ZoneEgressInsight
-              resource.
-            x-kubernetes-preserve-unknown-fields: true
-        type: object
-    served: true
-    storage: true
-
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
-  annotations:
-    controller-gen.kubebuilder.io/version: v0.14.0
-  name: zoneingresses.dubbo.io
-spec:
-  group: dubbo.io
-  names:
-    categories:
-    - dubbo
-    kind: ZoneIngress
-    listKind: ZoneIngressList
-    plural: zoneingresses
-    singular: zoneingress
-  scope: Namespaced
-  versions:
-  - name: v1alpha1
-    schema:
-      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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds
-            type: string
-          mesh:
-            description: |-
-              Mesh is the name of the dubbo mesh this resource belongs to.
-              It may be omitted for cluster-scoped resources.
-            type: string
-          metadata:
-            type: object
-          spec:
-            description: Spec is the specification of the Dubbo ZoneIngress 
resource.
-            x-kubernetes-preserve-unknown-fields: true
-        type: object
-    served: true
-    storage: true
-
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
-  annotations:
-    controller-gen.kubebuilder.io/version: v0.14.0
-  name: zoneingressinsights.dubbo.io
-spec:
-  group: dubbo.io
-  names:
-    categories:
-    - dubbo
-    kind: ZoneIngressInsight
-    listKind: ZoneIngressInsightList
-    plural: zoneingressinsights
-    singular: zoneingressinsight
-  scope: Namespaced
-  versions:
-  - name: v1alpha1
-    schema:
-      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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds
-            type: string
-          mesh:
-            description: |-
-              Mesh is the name of the dubbo mesh this resource belongs to.
-              It may be omitted for cluster-scoped resources.
-            type: string
-          metadata:
-            type: object
-          spec:
-            description: Spec is the specification of the Dubbo 
ZoneIngressInsight
-              resource.
-            x-kubernetes-preserve-unknown-fields: true
-        type: object
-    served: true
-    storage: true
-
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
-  annotations:
-    controller-gen.kubebuilder.io/version: v0.14.0
-  name: zoneinsights.dubbo.io
-spec:
-  group: dubbo.io
-  names:
-    categories:
-    - dubbo
-    kind: ZoneInsight
-    listKind: ZoneInsightList
-    plural: zoneinsights
-    singular: zoneinsight
-  scope: Cluster
-  versions:
-  - name: v1alpha1
-    schema:
-      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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds
-            type: string
-          mesh:
-            description: |-
-              Mesh is the name of the dubbo mesh this resource belongs to.
-              It may be omitted for cluster-scoped resources.
-            type: string
-          metadata:
-            type: object
-          spec:
-            description: Spec is the specification of the Dubbo ZoneInsight 
resource.
-            x-kubernetes-preserve-unknown-fields: true
-        type: object
-    served: true
-    storage: true
-
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
-  annotations:
-    controller-gen.kubebuilder.io/version: v0.14.0
-  name: zones.dubbo.io
-spec:
-  group: dubbo.io
-  names:
-    categories:
-    - dubbo
-    kind: Zone
-    listKind: ZoneList
-    plural: zones
-    singular: zone
-  scope: Cluster
-  versions:
-  - name: v1alpha1
-    schema:
-      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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds
-            type: string
-          mesh:
-            description: |-
-              Mesh is the name of the dubbo mesh this resource belongs to.
-              It may be omitted for cluster-scoped resources.
-            type: string
-          metadata:
-            type: object
-          spec:
-            description: Spec is the specification of the Dubbo Zone resource.
-            x-kubernetes-preserve-unknown-fields: true
-        type: object
-    served: true
-    storage: true
-
----
-apiVersion: v1
-kind: Namespace
-metadata:
-  name: dubbo-system
-
----
diff --git a/dubboctl/pkg/cli/context.go b/dubboctl/pkg/cli/context.go
index d12a8958..f28a59d8 100644
--- a/dubboctl/pkg/cli/context.go
+++ b/dubboctl/pkg/cli/context.go
@@ -14,6 +14,7 @@ type instance struct {
 type Context interface {
        CLIClient() (kube.CLIClient, error)
        CLIClientWithRevision(rev string) (kube.CLIClient, error)
+       DubboNamespace() string
 }
 
 func NewCLIContext(rootFlags *RootFlags) Context {
diff --git a/dubboctl/pkg/cli/options.go b/dubboctl/pkg/cli/options.go
index 6b4ce431..c3e5ba4a 100644
--- a/dubboctl/pkg/cli/options.go
+++ b/dubboctl/pkg/cli/options.go
@@ -35,3 +35,11 @@ func AddRootFlags(flags *pflag.FlagSet) *RootFlags {
        flags.StringVarP(rootFlags.dubboNamespace, DubboNamespaceFlag, "i", 
viper.GetString(DubboNamespaceFlag), "Dubbo system namespace")
        return rootFlags
 }
+
+func (r *RootFlags) Namespace() string {
+       return *r.namespace
+}
+
+func (r *RootFlags) DubboNamespace() string {
+       return *r.dubboNamespace
+}
diff --git a/operator/pkg/validate/validate.go 
b/dubboctl/pkg/validate/validate.go
similarity index 65%
rename from operator/pkg/validate/validate.go
rename to dubboctl/pkg/validate/validate.go
index 7c7079b9..1c6b4825 100644
--- a/operator/pkg/validate/validate.go
+++ b/dubboctl/pkg/validate/validate.go
@@ -1,8 +1,17 @@
 package validate
 
 import (
+       "errors"
        "github.com/apache/dubbo-kubernetes/dubboctl/pkg/cli"
        "github.com/spf13/cobra"
+       "io"
+)
+
+var (
+       errFiles = errors.New(`error: you must specify resources by --filename.
+Example resource specifications include:
+   '-f default.yaml'
+   '--filename=default.json'`)
 )
 
 func NewValidateCommand(ctx cli.Context) *cobra.Command {
@@ -19,8 +28,17 @@ func NewValidateCommand(ctx cli.Context) *cobra.Command {
                Args:    cobra.NoArgs,
                Aliases: []string{"v"},
                RunE: func(cmd *cobra.Command, _ []string) error {
-                       return nil
+                       dn := ctx.DubboNamespace()
+                       return validateFiles(&dn, nil, nil)
                },
        }
        return vc
 }
+
+func validateFiles(dubboNamespace *string, files []string, writer io.Writer) 
error {
+       if len(files) == 0 {
+               return errFiles
+       }
+
+       return nil
+}


Reply via email to