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

albumenj pushed a commit to branch refactor-with-go
in repository https://gitbox.apache.org/repos/asf/dubbo-admin.git


The following commit(s) were added to refs/heads/refactor-with-go by this push:
     new 4c0296a5 Docker make file (#1028)
4c0296a5 is described below

commit 4c0296a59e8fc5858e72ccad5cb30370319469d3
Author: Jun <[email protected]>
AuthorDate: Tue Mar 14 10:13:35 2023 +0800

    Docker make file (#1028)
    
    * add version info
    
    * add docker file and makefile for building
    
    * auto make crd manifests
    
    * fix format
    
    * fix format
    
    * fix version bug
    
    * fix authenticationpolicies order maximum value
    
    * fix license
---
 .gitignore                                         |   5 +-
 Dockerfile                                         |  52 ++++
 Makefile                                           | 190 +++++++++++++++
 .../dubbo.apache.org_authenticationpolicies.yaml   | 200 ++++++++++++++++
 .../dubbo.apache.org_authorizationpolicies.yaml    | 233 ++++++++++++++++++
 dubbo-admin-ui/.dockerignore                       |  18 ++
 dubbo-admin-ui/Dockerfile                          |  35 +++
 dubbo-admin-ui/nginx/default.conf                  |  18 ++
 hack/boilerplate.go.txt                            |  14 ++
 pkg/admin/handlers/service.go                      |   5 +
 pkg/admin/router/router.go                         |   2 +-
 .../apis/dubbo.apache.org/v1beta1/register.go      | 140 ++---------
 .../apis/dubbo.apache.org/v1beta1/type.go          |  52 ----
 .../apis/dubbo.apache.org/v1beta1/types.go         | 264 +++++++++++++++++++++
 pkg/version/version.go                             |  62 +++++
 15 files changed, 1120 insertions(+), 170 deletions(-)

diff --git a/.gitignore b/.gitignore
index 68e78d05..0aae576a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,4 +36,7 @@ dubbo-admin-ui/dist
 dubbo-admin-ui/node
 dubbo-admin-ui/node-modules
 
-coverage.txt
\ No newline at end of file
+coverage.txt
+
+bin/
+vendor/
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 00000000..cb4ee77a
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,52 @@
+# 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.
+
+# Build the image binary
+FROM golang:1.20.1-alpine3.17 as builder
+
+
+# Build argments
+ARG LDFLAGS
+ARG PKGNAME
+ARG BUILD
+
+WORKDIR /go/src/github.com/apache/dubbo-admin
+
+# Copy the Go Modules manifests
+COPY go.mod go.mod
+COPY go.sum go.sum
+
+#RUN if [[ "${PKGNAME}" == "authority" ]]; then apk --update add gcc libc-dev 
upx ca-certificates && update-ca-certificates; fi
+
+# cache deps before building and copying source so that we don't need to 
re-download as much
+# and so that source changes don't invalidate our downloaded layer
+RUN if [[ "${BUILD}" != "CI" ]]; then go env -w 
GOPROXY=https://goproxy.cn,direct; fi
+RUN go env
+RUN go mod download
+
+# Copy the go source
+COPY pkg pkg/
+COPY cmd cmd/
+
+# Build
+RUN env
+RUN go build -ldflags="${LDFLAGS}" -a -o ${PKGNAME} 
/go/src/github.com/apache/dubbo-admin/cmd/${PKGNAME}/main.go
+
+
+FROM alpine:3.17
+WORKDIR /
+ARG PKGNAME
+COPY --from=builder /go/src/github.com/apache/dubbo-admin/${PKGNAME} .
+
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..47009e16
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,190 @@
+# 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.
+
+
+GOOS ?= $(shell go env GOOS)
+
+# Git information
+GIT_VERSION ?= $(shell git describe --tags --always)
+GIT_COMMIT_HASH ?= $(shell git rev-parse HEAD)
+GIT_TREESTATE = "clean"
+GIT_DIFF = $(shell git diff --quiet >/dev/null 2>&1; if [ $$? -eq 1 ]; then 
echo "1"; fi)
+ifeq ($(GIT_DIFF), 1)
+    GIT_TREESTATE = "dirty"
+endif
+
+BUILDDATE = $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
+
+LDFLAGS = "-X github.com/apache/dubbo-admin/pkg/version.gitTag=$(GIT_VERSION) \
+                      -X 
github.com/apache/dubbo-admin/pkg/version.gitCommit=$(GIT_COMMIT_HASH) \
+                      -X 
github.com/apache/dubbo-admin/pkg/version.gitTreeState=$(GIT_TREESTATE) \
+                      -X 
github.com/apache/dubbo-admin/pkg/version.buildDate=$(BUILDDATE)"
+
+# Images management
+REGISTRY ?= docker.io
+REGISTRY_NAMESPACE ?= apache
+REGISTRY_USER_NAME?=""
+REGISTRY_PASSWORD?=""
+
+# Image URL to use all building/pushing image targets
+DUBBO_ADMIN_IMG ?= 
"${REGISTRY}/${REGISTRY_NAMESPACE}/dubbo-admin:${GIT_VERSION}"
+DUBBO_AUTHORITY_IMG ?= 
"${REGISTRY}/${REGISTRY_NAMESPACE}/dubbo-ca:${GIT_VERSION}"
+DUBBO_ADMIN_UI_IMG ?= 
"${REGISTRY}/${REGISTRY_NAMESPACE}/dubbo-admin-ui:${GIT_VERSION}"
+
+# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is 
set)
+ifeq (,$(shell go env GOBIN))
+GOBIN=$(shell go env GOPATH)/bin
+else
+GOBIN=$(shell go env GOBIN)
+endif
+
+LOCALBIN ?= $(shell pwd)/bin
+$(LOCALBIN):
+       mkdir -p $(LOCALBIN)
+
+## Tool Binaries
+KUSTOMIZE ?= $(LOCALBIN)/kustomize
+CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
+
+## Tool Versions
+KUSTOMIZE_VERSION ?= v3.8.7
+CONTROLLER_TOOLS_VERSION ?= v0.10.0
+
+
+
+##@ General
+
+# The help target prints out all targets with their descriptions organized
+# beneath their categories. The categories are represented by '##@' and the
+# target descriptions by '##'. The awk commands is responsible for reading the
+# entire set of makefiles included in this invocation, looking for lines of the
+# file as xyz: ## something, and then pretty-format the target and help. Then,
+# if there's a line with ##@ something, that gets pretty-printed as a category.
+# More info on the usage of ANSI control characters for terminal formatting:
+# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
+# More info on the awk command:
+# http://linuxcommand.org/lc3_adv_awk.php
+
+.PHONY: help
+help: ## Display this help.
+       @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n  make 
\033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf "  
\033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", 
substr($$0, 5) } ' $(MAKEFILE_LIST)
+
+##@ Development
+
+.PHONY: manifests
+manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and 
CustomResourceDefinition objects.
+       $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt"  
crd:allowDangerousTypes=true webhook paths="./pkg/authority/apis/..." 
output:crd:artifacts:config=deploy/manifests
+
+.PHONY: generate
+generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, 
and DeepCopyObject method implementations.
+       #$(CONTROLLER_GEN) object:headerFile="./hack/boilerplate.go.txt"  
crd:allowDangerousTypes=true paths="./..."
+
+.PHONY: fmt
+fmt: ## Run go fmt against code.
+       go fmt ./...
+
+.PHONY: vet
+vet: ## Run go vet against code.
+       @find . -type f -name '*.go'| grep -v "/vendor/" | xargs gofmt -w -s
+
+# Run mod tidy against code
+.PHONY: tidy
+tidy:
+       @go mod tidy
+
+.PHONY: lint
+lint: golangci-lint  ## Run golang lint against code
+       @$(GOLANG_LINT) run ./...
+
+.PHONY: test
+test: fmt vet  ## Run tests.
+       go test -coverprofile coverage.out -covermode=atomic ./...
+
+.PHONY: echoLDFLAGS
+echoLDFLAGS:
+       @echo $(LDFLAGS)
+
+
+.PHONY: build
+build: dubbo-admin dubbo-authority
+
+.PHONY: all
+all: generate test dubbo-admin dubbo-authority
+
+.PHONY: dubbo-admin
+dubbo-admin: ## Build binary with the dubbo admin.
+       CGO_ENABLED=0 GOOS=$(GOOS) go build -ldflags $(LDFLAGS) -o bin/admi 
cmd/admin/main.go
+
+.PHONY: dubbo-authority
+dubbo-authority: ## Build binary with the dubbo authority.
+       CGO_ENABLED=0 GOOS=$(GOOS) go build -ldflags $(LDFLAGS) -o 
bin/authority cmd/authority/main.go
+
+.PHONY: images
+images: image-dubbo-admin image-dubbo-authority  image-dubbo-admin-ui
+
+.PHONY: image-dubbo-admin
+image-dubbo-admin: ## Build docker image with the dubbo admin.
+       docker build --build-arg LDFLAGS=$(LDFLAGS) --build-arg PKGNAME=admin 
-t ${DUBBO_ADMIN_IMG} .
+
+.PHONY: image-dubbo-authority
+image-dubbo-authority: ## Build docker image with the dubbo authority.
+       docker build --build-arg LDFLAGS=$(LDFLAGS) --build-arg 
PKGNAME=authority -t ${DUBBO_AUTHORITY_IMG} .
+
+.PHONY: image-dubbo-admin-ui
+image-dubbo-admin-ui: ## Build docker image with the dubbo-admin-ui.
+       docker build --build-arg LDFLAGS=$(LDFLAGS) --build-arg 
PKGNAME=dubbo-admin-ui -t ${DUBBO_ADMIN_UI_IMG} ./dubbo-admin-ui
+
+
+.PHONY: push-images
+push-images: push-image-admin push-image-admin-ui push-image-authority
+
+.PHONY: push-image-admin
+push-image-admin: ## Push admin images.
+ifneq ($(REGISTRY_USER_NAME), "")
+       docker login -u $(REGISTRY_USER_NAME) -p $(REGISTRY_PASSWORD) 
${REGISTRY}
+endif
+       docker push ${DUBBO_ADMIN_IMG}
+
+.PHONY: push-image-authority
+push-image-authority: ## Push authority images.
+ifneq ($(REGISTRY_USER_NAME), "")
+       docker login -u $(REGISTRY_USER_NAME) -p $(REGISTRY_PASSWORD) 
${REGISTRY}
+endif
+       docker push ${DUBBO_AUTHORITY_IMG}
+
+.PHONY: push-image-admin-ui
+push-image-admin-ui: ## Push admin ui images.
+ifneq ($(REGISTRY_USER_NAME), "")
+       docker login -u $(REGISTRY_USER_NAME) -p $(REGISTRY_PASSWORD) 
${REGISTRY}
+endif
+       docker push ${DUBBO_ADMIN_UI_IMG}
+
+
+
+KUSTOMIZE_INSTALL_SCRIPT ?= 
"https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh";
+.PHONY: kustomize
+kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong 
version is installed, it will be removed before downloading.
+$(KUSTOMIZE): $(LOCALBIN)
+       @if test -x $(LOCALBIN)/kustomize && ! $(LOCALBIN)/kustomize version | 
grep -q $(KUSTOMIZE_VERSION); then \
+               echo "$(LOCALBIN)/kustomize version is not expected 
$(KUSTOMIZE_VERSION). Removing it before installing."; \
+               rm -rf $(LOCALBIN)/kustomize; \
+       fi
+       test -s $(LOCALBIN)/kustomize || { curl -Ss $(KUSTOMIZE_INSTALL_SCRIPT) 
| bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN); }
+
+.PHONY: controller-gen
+controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if 
necessary. If wrong version is installed, it will be overwritten.
+$(CONTROLLER_GEN): $(LOCALBIN)
+       test -s $(LOCALBIN)/controller-gen && $(LOCALBIN)/controller-gen 
--version | grep -q $(CONTROLLER_TOOLS_VERSION) || \
+       GOBIN=$(LOCALBIN) go install 
sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
diff --git a/deploy/manifests/dubbo.apache.org_authenticationpolicies.yaml 
b/deploy/manifests/dubbo.apache.org_authenticationpolicies.yaml
new file mode 100644
index 00000000..abd0a153
--- /dev/null
+++ b/deploy/manifests/dubbo.apache.org_authenticationpolicies.yaml
@@ -0,0 +1,200 @@
+# 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: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+  annotations:
+    controller-gen.kubebuilder.io/version: v0.10.0
+  creationTimestamp: null
+  name: authenticationpolicies.dubbo.apache.org
+spec:
+  group: dubbo.apache.org
+  names:
+    kind: AuthenticationPolicy
+    listKind: AuthenticationPolicyList
+    plural: authenticationpolicies
+    shortNames:
+    - ac
+    singular: authenticationpolicy
+  scope: Namespaced
+  versions:
+  - name: v1beta1
+    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:
+            properties:
+              action:
+                description: The action to take when a rule is matched.
+                enum:
+                - NONE
+                - CLIENT_AUTH
+                - SERVER_AUTH
+                type: string
+              matchType:
+                default: anyMatch
+                description: The match type of the rules.
+                enum:
+                - anyMatch
+                - allMatch
+                type: string
+              order:
+                default: 0
+                description: The order of the rule. The rule with the highest 
precedence
+                  is matched first.
+                maximum: 2147483647
+                minimum: -2147483648
+                type: integer
+              rules:
+                items:
+                  properties:
+                    from:
+                      description: The source of the traffic to be matched.
+                      properties:
+                        extends:
+                          description: The extended identities(from Dubbo 
Auth) to
+                            match of the source workload.
+                          items:
+                            properties:
+                              key:
+                                description: The key of the extended identity.
+                                type: string
+                              value:
+                                description: The value of the extended 
identity.
+                                type: string
+                            type: object
+                          type: array
+                        ipBlocks:
+                          description: The IP addresses to match of the source 
workload.
+                          items:
+                            type: string
+                          type: array
+                        namespaces:
+                          description: The namespaces to match of the source 
workload.
+                          items:
+                            type: string
+                          type: array
+                        notExtends:
+                          description: The extended identities(from Dubbo 
Auth) not
+                            to match of the source workload.
+                          items:
+                            properties:
+                              key:
+                                description: The key of the extended identity.
+                                type: string
+                              value:
+                                description: The value of the extended 
identity.
+                                type: string
+                            type: object
+                          type: array
+                        notIpBlocks:
+                          description: The IP addresses not to match of the 
source
+                            workload.
+                          items:
+                            type: string
+                          type: array
+                        notNamespaces:
+                          description: The namespaces not to match of the 
source workload.
+                          items:
+                            type: string
+                          type: array
+                        notPrincipals:
+                          description: The identities(from spiffe) not to 
match of
+                            the source workload.
+                          items:
+                            type: string
+                          type: array
+                        principals:
+                          description: The identities(from spiffe) to match of 
the
+                            source workload.
+                          items:
+                            type: string
+                          type: array
+                      type: object
+                    to:
+                      description: The destination of the traffic to be 
matched.
+                      properties:
+                        extends:
+                          description: The extended identities(from Dubbo 
Auth) to
+                            match of the destination workload.
+                          items:
+                            properties:
+                              key:
+                                description: The key of the extended identity.
+                                type: string
+                              value:
+                                description: The value of the extended 
identity.
+                                type: string
+                            type: object
+                          type: array
+                        ipBlocks:
+                          description: The IP addresses to match of the 
destination
+                            workload.
+                          items:
+                            type: string
+                          type: array
+                        notExtends:
+                          description: The extended identities(from Dubbo 
Auth) not
+                            to match of the destination workload.
+                          items:
+                            properties:
+                              key:
+                                description: The key of the extended identity.
+                                type: string
+                              value:
+                                description: The value of the extended 
identity.
+                                type: string
+                            type: object
+                          type: array
+                        notIpBlocks:
+                          description: The IP addresses not to match of the 
destination
+                            workload.
+                          items:
+                            type: string
+                          type: array
+                        notPrincipals:
+                          description: The identities(from spiffe) not to 
match of
+                            the destination workload.
+                          items:
+                            type: string
+                          type: array
+                        principals:
+                          description: The identities(from spiffe) to match of 
the
+                            destination workload.
+                          items:
+                            type: string
+                          type: array
+                      type: object
+                  type: object
+                type: array
+            required:
+            - action
+            type: object
+        type: object
+    served: true
+    storage: true
diff --git a/deploy/manifests/dubbo.apache.org_authorizationpolicies.yaml 
b/deploy/manifests/dubbo.apache.org_authorizationpolicies.yaml
new file mode 100644
index 00000000..e66ef074
--- /dev/null
+++ b/deploy/manifests/dubbo.apache.org_authorizationpolicies.yaml
@@ -0,0 +1,233 @@
+# 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: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+  annotations:
+    controller-gen.kubebuilder.io/version: v0.10.0
+  creationTimestamp: null
+  name: authorizationpolicies.dubbo.apache.org
+spec:
+  group: dubbo.apache.org
+  names:
+    kind: AuthorizationPolicy
+    listKind: AuthorizationPolicyList
+    plural: authorizationpolicies
+    shortNames:
+    - az
+    singular: authorizationpolicy
+  scope: Namespaced
+  versions:
+  - name: v1beta1
+    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:
+            properties:
+              action:
+                description: The action to take when a rule is matched
+                enum:
+                - ALLOW
+                - DENY
+                - ADUIT
+                type: string
+              matchType:
+                default: anyMatch
+                description: The match type of the rules.
+                enum:
+                - anyMatch
+                - allMatch
+                type: string
+              rules:
+                items:
+                  properties:
+                    from:
+                      description: The source of the traffic to be matched.
+                      properties:
+                        extends:
+                          description: The extended identities(from Dubbo 
Auth) to
+                            match of the source workload.
+                          items:
+                            properties:
+                              key:
+                                description: The key of the extended identity.
+                                type: string
+                              value:
+                                description: The value of the extended identity
+                                type: string
+                            type: object
+                          type: array
+                        ipBlocks:
+                          description: The IP addresses to match of the source 
workload.
+                          items:
+                            type: string
+                          type: array
+                        namespaces:
+                          description: The namespaces to match of the source 
workload.
+                          items:
+                            type: string
+                          type: array
+                        notExtends:
+                          description: The extended identities(from Dubbo 
Auth) not
+                            to match of the source workload.
+                          items:
+                            properties:
+                              key:
+                                description: The key of the extended identity.
+                                type: string
+                              value:
+                                description: The value of the extended identity
+                                type: string
+                            type: object
+                          type: array
+                        notIpBlocks:
+                          description: The IP addresses not to match of the 
source
+                            workload.
+                          items:
+                            type: string
+                          type: array
+                        notNamespaces:
+                          description: The namespaces not to match of the 
source workload.
+                          items:
+                            type: string
+                          type: array
+                        notPrincipals:
+                          description: The identities(from spiffe) not to 
match of
+                            the source workload
+                          items:
+                            type: string
+                          type: array
+                        principals:
+                          description: The identities(from spiffe) to match of 
the
+                            source workload.
+                          items:
+                            type: string
+                          type: array
+                      type: object
+                    to:
+                      description: The destination of the traffic to be 
matched.
+                      properties:
+                        extends:
+                          description: The extended identities(from Dubbo 
Auth) to
+                            match of the destination workload.
+                          items:
+                            properties:
+                              key:
+                                description: The key of the extended identity.
+                                type: string
+                              value:
+                                description: The value of the extended identity
+                                type: string
+                            type: object
+                          type: array
+                        ipBlocks:
+                          description: The IP addresses to match of the 
destination
+                            workload.
+                          items:
+                            type: string
+                          type: array
+                        notExtends:
+                          description: The extended identities(from Dubbo 
Auth) not
+                            to match of the destination workload.
+                          items:
+                            properties:
+                              key:
+                                description: The key of the extended identity.
+                                type: string
+                              value:
+                                description: The value of the extended identity
+                                type: string
+                            type: object
+                          type: array
+                        notIpBlocks:
+                          description: The IP addresses not to match of the 
destination
+                            workload.
+                          items:
+                            type: string
+                          type: array
+                        notPrincipals:
+                          description: The identities(from spiffe) not to 
match of
+                            the destination workload.
+                          items:
+                            type: string
+                          type: array
+                        principals:
+                          description: The identities(from spiffe) to match of 
the
+                            destination workload.
+                          items:
+                            type: string
+                          type: array
+                      type: object
+                    when:
+                      properties:
+                        key:
+                          type: string
+                        notValues:
+                          items:
+                            properties:
+                              type:
+                                default: equals
+                                enum:
+                                - equals
+                                - regex
+                                - ognl
+                                type: string
+                              value:
+                                type: string
+                            type: object
+                          type: array
+                        values:
+                          items:
+                            properties:
+                              type:
+                                default: equals
+                                enum:
+                                - equals
+                                - regex
+                                - ognl
+                                type: string
+                              value:
+                                type: string
+                            type: object
+                          type: array
+                      type: object
+                  type: object
+                type: array
+              samples:
+                default: 100
+                description: The sample rate of the rule. The value is between 
0 and
+                  100.
+                maximum: 100
+                minimum: 0
+                type: number
+            required:
+            - action
+            type: object
+        type: object
+    served: true
+    storage: true
diff --git a/dubbo-admin-ui/.dockerignore b/dubbo-admin-ui/.dockerignore
new file mode 100644
index 00000000..9ab3e6eb
--- /dev/null
+++ b/dubbo-admin-ui/.dockerignore
@@ -0,0 +1,18 @@
+# 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.
+
+node_modules
+build
+.git
diff --git a/dubbo-admin-ui/Dockerfile b/dubbo-admin-ui/Dockerfile
new file mode 100644
index 00000000..1d1ca67d
--- /dev/null
+++ b/dubbo-admin-ui/Dockerfile
@@ -0,0 +1,35 @@
+# 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.
+
+# -- BUILD --
+FROM node:14.17-alpine as build
+
+WORKDIR /app/ui/src
+
+
+COPY . .
+
+RUN npm i
+RUN npm run build
+
+# -- RELEASE --
+FROM nginx:stable-alpine as release
+
+COPY --from=build /app/ui/src/target/dist /usr/share/nginx/html
+
+WORKDIR /usr/share/nginx/html
+EXPOSE 8080
+
+CMD ["/bin/sh", "-c", "nginx -g \"daemon off;\""]
diff --git a/dubbo-admin-ui/nginx/default.conf 
b/dubbo-admin-ui/nginx/default.conf
new file mode 100644
index 00000000..26944b80
--- /dev/null
+++ b/dubbo-admin-ui/nginx/default.conf
@@ -0,0 +1,18 @@
+server {
+  listen 80;
+
+  location / {
+    root /usr/share/nginx/html/;
+    include /etc/nginx/mime.types;
+    try_files $uri $uri/ /index.html;
+
+    location /api/ {
+      proxy_set_header Host $host;
+      proxy_set_header X-Real-IP $remote_addr;
+      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+      proxy_set_header X-NginX-Proxy true;
+      proxy_pass localhost:38080;
+    }
+  }
+
+}
diff --git a/hack/boilerplate.go.txt b/hack/boilerplate.go.txt
new file mode 100644
index 00000000..bd96df21
--- /dev/null
+++ b/hack/boilerplate.go.txt
@@ -0,0 +1,14 @@
+// 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.
\ No newline at end of file
diff --git a/pkg/admin/handlers/service.go b/pkg/admin/handlers/service.go
index 48a9482e..d1f7857d 100644
--- a/pkg/admin/handlers/service.go
+++ b/pkg/admin/handlers/service.go
@@ -21,6 +21,7 @@ import (
        "net/http"
 
        "github.com/apache/dubbo-admin/pkg/admin/services"
+       "github.com/apache/dubbo-admin/pkg/version"
        "github.com/gin-gonic/gin"
 )
 
@@ -55,3 +56,7 @@ func SearchService(c *gin.Context) {
                "data": providers,
        })
 }
+
+func Version(c *gin.Context) {
+       c.JSON(http.StatusOK, version.GetVersion())
+}
diff --git a/pkg/admin/router/router.go b/pkg/admin/router/router.go
index 5c28c09d..6b54d0ee 100644
--- a/pkg/admin/router/router.go
+++ b/pkg/admin/router/router.go
@@ -27,6 +27,6 @@ func InitRouter() *gin.Engine {
 
        router.GET("/api/dev/services", handlers.AllServices)
        router.GET("/api/dev/service", handlers.SearchService)
-
+       router.GET("/api/dev/version", handlers.Version)
        return router
 }
diff --git a/pkg/authority/apis/dubbo.apache.org/v1beta1/register.go 
b/pkg/authority/apis/dubbo.apache.org/v1beta1/register.go
index 8b2ef905..3e575c2c 100644
--- a/pkg/authority/apis/dubbo.apache.org/v1beta1/register.go
+++ b/pkg/authority/apis/dubbo.apache.org/v1beta1/register.go
@@ -17,128 +17,36 @@ package v1beta1
 
 import (
        metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+       "k8s.io/apimachinery/pkg/runtime"
+       "k8s.io/apimachinery/pkg/runtime/schema"
 )
 
-// +genclient
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+// SchemeGroupVersion is group version used to register these objects
+var SchemeGroupVersion = schema.GroupVersion{Group: "dubbo.apache.org", 
Version: "v1beta1"}
 
-type AuthenticationPolicy struct {
-       metav1.TypeMeta   `json:",inline"`
-       metav1.ObjectMeta `json:"metadata,omitempty"`
-
-       Spec AuthenticationPolicySpec `json:"spec"`
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-type AuthenticationPolicyList struct {
-       metav1.TypeMeta `json:",inline"`
-       metav1.ListMeta `json:"metadata"`
-
-       Items []AuthenticationPolicy `json:"items"`
-}
-
-type AuthenticationPolicySpec struct {
-       Action    string                     `json:"action,omitempty"`
-       Rules     []AuthenticationPolicyRule `json:"rules,omitempty"`
-       Order     int                        `json:"order,omitempty"`
-       MatchType string                     `json:"matchType,omitempty"`
-}
-
-type AuthenticationPolicyRule struct {
-       From AuthenticationPolicySource `json:"from,omitempty"`
-       To   AuthenticationPolicyTarget `json:"to,omitempty"`
+// Kind takes an unqualified kind and returns back a Group qualified GroupKind
+func Kind(kind string) schema.GroupKind {
+       return SchemeGroupVersion.WithKind(kind).GroupKind()
 }
 
-type AuthenticationPolicySource struct {
-       Namespaces    []string                     `json:"namespaces,omitempty"`
-       NotNamespaces []string                     
`json:"notNamespaces,omitempty"`
-       IpBlocks      []string                     `json:"ipBlocks,omitempty"`
-       NotIpBlocks   []string                     
`json:"notIpBlocks,omitempty"`
-       Principals    []string                     `json:"principals,omitempty"`
-       NotPrincipals []string                     
`json:"notPrincipals,omitempty"`
-       Extends       []AuthenticationPolicyExtend `json:"extends,omitempty"`
-       NotExtends    []AuthenticationPolicyExtend `json:"notExtends,omitempty"`
-}
-
-type AuthenticationPolicyTarget struct {
-       IpBlocks      []string                     `json:"ipBlocks,omitempty"`
-       NotIpBlocks   []string                     
`json:"notIpBlocks,omitempty"`
-       Principals    []string                     `json:"principals,omitempty"`
-       NotPrincipals []string                     
`json:"notPrincipals,omitempty"`
-       Extends       []AuthenticationPolicyExtend `json:"extends,omitempty"`
-       NotExtends    []AuthenticationPolicyExtend `json:"notExtends,omitempty"`
-}
-
-type AuthenticationPolicyExtend struct {
-       Key   string `json:"key,omitempty"`
-       Value string `json:"value,omitempty"`
-}
-
-// +genclient
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-type AuthorizationPolicy struct {
-       metav1.TypeMeta   `json:",inline"`
-       metav1.ObjectMeta `json:"metadata,omitempty"`
-
-       Spec AuthorizationPolicySpec `json:"spec"`
+// Resource takes an unqualified resource and returns a Group qualified 
GroupResource
+func Resource(resource string) schema.GroupResource {
+       return SchemeGroupVersion.WithResource(resource).GroupResource()
 }
 
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-type AuthorizationPolicyList struct {
-       metav1.TypeMeta `json:",inline"`
-       metav1.ListMeta `json:"metadata"`
-
-       Items []AuthorizationPolicy `json:"items"`
-}
-
-type AuthorizationPolicySpec struct {
-       Action    string                    `json:"action,omitempty"`
-       Rules     []AuthorizationPolicyRule `json:"rules,omitempty"`
-       Samples   float32                   `json:"samples,omitempty"`
-       MatchType string                    `json:"matchType,omitempty"`
-}
-
-type AuthorizationPolicyRule struct {
-       From AuthorizationPolicySource    `json:"from,omitempty"`
-       To   AuthorizationPolicyTarget    `json:"to,omitempty"`
-       When AuthorizationPolicyCondition `json:"when,omitempty"`
-}
-
-type AuthorizationPolicySource struct {
-       Namespaces    []string                    `json:"namespaces,omitempty"`
-       NotNamespaces []string                    
`json:"notNamespaces,omitempty"`
-       IpBlocks      []string                    `json:"ipBlocks,omitempty"`
-       NotIpBlocks   []string                    `json:"notIpBlocks,omitempty"`
-       Principals    []string                    `json:"principals,omitempty"`
-       NotPrincipals []string                    
`json:"notPrincipals,omitempty"`
-       Extends       []AuthorizationPolicyExtend `json:"extends,omitempty"`
-       NotExtends    []AuthorizationPolicyExtend `json:"notExtends,omitempty"`
-}
-
-type AuthorizationPolicyTarget struct {
-       IpBlocks      []string                    `json:"ipBlocks,omitempty"`
-       NotIpBlocks   []string                    `json:"notIpBlocks,omitempty"`
-       Principals    []string                    `json:"principals,omitempty"`
-       NotPrincipals []string                    
`json:"notPrincipals,omitempty"`
-       Extends       []AuthorizationPolicyExtend `json:"extends,omitempty"`
-       NotExtends    []AuthorizationPolicyExtend `json:"notExtends,omitempty"`
-}
-
-type AuthorizationPolicyCondition struct {
-       Key       string                     `json:"key,omitempty"`
-       Values    []AuthorizationPolicyMatch `json:"values,omitempty"`
-       NotValues []AuthorizationPolicyMatch `json:"notValues,omitempty"`
-}
-
-type AuthorizationPolicyMatch struct {
-       Type  string `json:"type,omitempty"`
-       Value string `json:"value,omitempty"`
-}
+var (
+       // SchemeBuilder initializes a scheme builder
+       SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
+       // AddToScheme is a global function that registers this API group & 
version to a scheme
+       AddToScheme = SchemeBuilder.AddToScheme
+)
 
-type AuthorizationPolicyExtend struct {
-       Key   string `json:"key,omitempty"`
-       Value string `json:"value,omitempty"`
+// Adds the list of known types to Scheme.
+func addKnownTypes(scheme *runtime.Scheme) error {
+       scheme.AddKnownTypes(SchemeGroupVersion,
+               &AuthenticationPolicy{},
+               &AuthorizationPolicy{},
+       )
+       metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
+       return nil
 }
diff --git a/pkg/authority/apis/dubbo.apache.org/v1beta1/type.go 
b/pkg/authority/apis/dubbo.apache.org/v1beta1/type.go
deleted file mode 100644
index 3e575c2c..00000000
--- a/pkg/authority/apis/dubbo.apache.org/v1beta1/type.go
+++ /dev/null
@@ -1,52 +0,0 @@
-// 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 v1beta1
-
-import (
-       metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-       "k8s.io/apimachinery/pkg/runtime"
-       "k8s.io/apimachinery/pkg/runtime/schema"
-)
-
-// SchemeGroupVersion is group version used to register these objects
-var SchemeGroupVersion = schema.GroupVersion{Group: "dubbo.apache.org", 
Version: "v1beta1"}
-
-// Kind takes an unqualified kind and returns back a Group qualified GroupKind
-func Kind(kind string) schema.GroupKind {
-       return SchemeGroupVersion.WithKind(kind).GroupKind()
-}
-
-// Resource takes an unqualified resource and returns a Group qualified 
GroupResource
-func Resource(resource string) schema.GroupResource {
-       return SchemeGroupVersion.WithResource(resource).GroupResource()
-}
-
-var (
-       // SchemeBuilder initializes a scheme builder
-       SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
-       // AddToScheme is a global function that registers this API group & 
version to a scheme
-       AddToScheme = SchemeBuilder.AddToScheme
-)
-
-// Adds the list of known types to Scheme.
-func addKnownTypes(scheme *runtime.Scheme) error {
-       scheme.AddKnownTypes(SchemeGroupVersion,
-               &AuthenticationPolicy{},
-               &AuthorizationPolicy{},
-       )
-       metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
-       return nil
-}
diff --git a/pkg/authority/apis/dubbo.apache.org/v1beta1/types.go 
b/pkg/authority/apis/dubbo.apache.org/v1beta1/types.go
new file mode 100644
index 00000000..1bf714ab
--- /dev/null
+++ b/pkg/authority/apis/dubbo.apache.org/v1beta1/types.go
@@ -0,0 +1,264 @@
+// 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 v1beta1
+
+import (
+       metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+)
+
+// +genclient
+// +kubebuilder:object:root=true
+// +kubebuilder:resource:shortName=ac
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+
+type AuthenticationPolicy struct {
+       metav1.TypeMeta   `json:",inline"`
+       metav1.ObjectMeta `json:"metadata,omitempty"`
+
+       // +optional
+       Spec AuthenticationPolicySpec `json:"spec"`
+}
+
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+
+type AuthenticationPolicyList struct {
+       metav1.TypeMeta `json:",inline"`
+       metav1.ListMeta `json:"metadata"`
+
+       Items []AuthenticationPolicy `json:"items"`
+}
+
+type AuthenticationPolicySpec struct {
+       // The action to take when a rule is matched.
+       // +required
+       // +kubebuilder:validation:Required
+       // +kubebuilder:validation:Type=string
+       // +kubebuilder:validation:Enum=NONE;CLIENT_AUTH;SERVER_AUTH
+       Action string `json:"action"`
+       // +optional
+       Rules []AuthenticationPolicyRule `json:"rules,omitempty"`
+       // The order of the rule. The rule with the highest precedence is 
matched first.
+       // +optional
+       // +kubebuilder:validation:Type=integer
+       // +kubebuilder:validation:Minimum=-2147483648
+       // +kubebuilder:validation:Maximum=2147483647
+       // +kubebuilder:default=0
+       Order int `json:"order,omitempty"`
+       // The match type of the rules.
+       // +optional
+       // +kubebuilder:validation:Type=string
+       // +kubebuilder:validation:Enum=anyMatch;allMatch
+       // +kubebuilder:default=anyMatch
+       MatchType string `json:"matchType,omitempty"`
+}
+
+type AuthenticationPolicyRule struct {
+       // The source of the traffic to be matched.
+       // +optional
+       From AuthenticationPolicySource `json:"from,omitempty"`
+       // The destination of the traffic to be matched.
+       // +optional
+       To AuthenticationPolicyTarget `json:"to,omitempty"`
+}
+
+type AuthenticationPolicySource struct {
+       // The namespaces to match of the source workload.
+       // +optional
+       Namespaces []string `json:"namespaces,omitempty"`
+       // The namespaces not to match of the source workload.
+       // +optional
+       NotNamespaces []string `json:"notNamespaces,omitempty"`
+       // The IP addresses to match of the source workload.
+       // +optional
+       IpBlocks []string `json:"ipBlocks,omitempty"`
+       // The IP addresses not to match of the source workload.
+       // +optional
+       NotIpBlocks []string `json:"notIpBlocks,omitempty"`
+       // The identities(from spiffe) to match of the source workload.
+       // +optional
+       Principals []string `json:"principals,omitempty"`
+       // The identities(from spiffe) not to match of the source workload.
+       // +optional
+       NotPrincipals []string `json:"notPrincipals,omitempty"`
+       // The extended identities(from Dubbo Auth) to match of the source 
workload.
+       // +optional
+       Extends []AuthenticationPolicyExtend `json:"extends,omitempty"`
+       // The extended identities(from Dubbo Auth) not to match of the source 
workload.
+       // +optional
+       NotExtends []AuthenticationPolicyExtend `json:"notExtends,omitempty"`
+}
+
+type AuthenticationPolicyTarget struct {
+       // The IP addresses to match of the destination workload.
+       // +optional
+       IpBlocks []string `json:"ipBlocks,omitempty"`
+       // The IP addresses not to match of the destination workload.
+       // +optional
+       NotIpBlocks []string `json:"notIpBlocks,omitempty"`
+       // The identities(from spiffe) to match of the destination workload.
+       // +optional
+       Principals []string `json:"principals,omitempty"`
+       // The identities(from spiffe) not to match of the destination workload.
+       // +optional
+       NotPrincipals []string `json:"notPrincipals,omitempty"`
+       // The extended identities(from Dubbo Auth) to match of the destination 
workload.
+       // +optional
+       Extends []AuthenticationPolicyExtend `json:"extends,omitempty"`
+       // The extended identities(from Dubbo Auth) not to match of the 
destination workload.
+       // +optional
+       NotExtends []AuthenticationPolicyExtend `json:"notExtends,omitempty"`
+}
+
+type AuthenticationPolicyExtend struct {
+       // The key of the extended identity.
+       // +optional
+       Key string `json:"key,omitempty"`
+       // The value of the extended identity.
+       // +optional
+       Value string `json:"value,omitempty"`
+}
+
+// +genclient
+// +kubebuilder:object:root=true
+// +kubebuilder:resource:shortName=az
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+
+type AuthorizationPolicy struct {
+       metav1.TypeMeta   `json:",inline"`
+       metav1.ObjectMeta `json:"metadata,omitempty"`
+       // +optional
+       Spec AuthorizationPolicySpec `json:"spec"`
+}
+
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+
+type AuthorizationPolicyList struct {
+       metav1.TypeMeta `json:",inline"`
+       metav1.ListMeta `json:"metadata"`
+
+       Items []AuthorizationPolicy `json:"items"`
+}
+
+type AuthorizationPolicySpec struct {
+       // The action to take when a rule is matched
+       // +required
+       // +kubebuilder:validation:Required
+       // +kubebuilder:validation:Type=string
+       // +kubebuilder:validation:Enum=ALLOW;DENY;ADUIT
+       Action string `json:"action"`
+       // +optional
+       Rules []AuthorizationPolicyRule `json:"rules,omitempty"`
+       // The sample rate of the rule. The value is between 0 and 100.
+       // +optional
+       // +kubebuilder:validation:Type=number
+       // +kubebuilder:validation:Minimum=0
+       // +kubebuilder:validation:Maximum=100
+       // +kubebuilder:default=100
+       Samples float32 `json:"samples,omitempty"`
+       // The match type of the rules.
+       // +optional
+       // +kubebuilder:validation:Type=string
+       // +kubebuilder:validation:Enum=anyMatch;allMatch
+       // +kubebuilder:default=anyMatch
+       MatchType string `json:"matchType,omitempty"`
+}
+
+type AuthorizationPolicyRule struct {
+       // The source of the traffic to be matched.
+       // +optional
+       From AuthorizationPolicySource `json:"from,omitempty"`
+       // The destination of the traffic to be matched.
+       // +optional
+       To AuthorizationPolicyTarget `json:"to,omitempty"`
+       // +optional
+       When AuthorizationPolicyCondition `json:"when,omitempty"`
+}
+
+type AuthorizationPolicySource struct {
+       // The namespaces to match of the source workload.
+       // +optional
+       Namespaces []string `json:"namespaces,omitempty"`
+       // The namespaces not to match of the source workload.
+       // +optional
+       NotNamespaces []string `json:"notNamespaces,omitempty"`
+       // The IP addresses to match of the source workload.
+       // +optional
+       IpBlocks []string `json:"ipBlocks,omitempty"`
+       // The IP addresses not to match of the source workload.
+       // +optional
+       NotIpBlocks []string `json:"notIpBlocks,omitempty"`
+       // The identities(from spiffe) to match of the source workload.
+       // +optional
+       Principals []string `json:"principals,omitempty"`
+       // The identities(from spiffe) not to match of the source workload
+       // +optional
+       NotPrincipals []string `json:"notPrincipals,omitempty"`
+       // The extended identities(from Dubbo Auth) to match of the source 
workload.
+       // +optional
+       Extends []AuthorizationPolicyExtend `json:"extends,omitempty"`
+       // The extended identities(from Dubbo Auth) not to match of the source 
workload.
+       // +optional
+       NotExtends []AuthorizationPolicyExtend `json:"notExtends,omitempty"`
+}
+
+type AuthorizationPolicyTarget struct {
+       // The IP addresses to match of the destination workload.
+       // +optional
+       IpBlocks []string `json:"ipBlocks,omitempty"`
+       // The IP addresses not to match of the destination workload.
+       // +optional
+       NotIpBlocks []string `json:"notIpBlocks,omitempty"`
+       // The identities(from spiffe) to match of the destination workload.
+       // +optional
+       Principals []string `json:"principals,omitempty"`
+       // The identities(from spiffe) not to match of the destination workload.
+       // +optional
+       NotPrincipals []string `json:"notPrincipals,omitempty"`
+       // The extended identities(from Dubbo Auth) to match of the destination 
workload.
+       // +optional
+       Extends []AuthorizationPolicyExtend `json:"extends,omitempty"`
+       // The extended identities(from Dubbo Auth) not to match of the 
destination workload.
+       // +optional
+       NotExtends []AuthorizationPolicyExtend `json:"notExtends,omitempty"`
+}
+
+type AuthorizationPolicyCondition struct {
+       // +optional
+       Key string `json:"key,omitempty"`
+       // +optional
+       Values []AuthorizationPolicyMatch `json:"values,omitempty"`
+       // +optional
+       NotValues []AuthorizationPolicyMatch `json:"notValues,omitempty"`
+}
+
+type AuthorizationPolicyMatch struct {
+       // +optional
+       // +kubebuilder:validation:Type=string
+       // +kubebuilder:validation:Enum=equals;regex;ognl
+       // +kubebuilder:default=equals
+       Type string `json:"type,omitempty"`
+       // +optional
+       Value string `json:"value,omitempty"`
+}
+
+type AuthorizationPolicyExtend struct {
+       // The key of the extended identity.
+       // +optional
+       Key string `json:"key,omitempty"`
+       // The value of the extended identity
+       // +optional
+       Value string `json:"value,omitempty"`
+}
diff --git a/pkg/version/version.go b/pkg/version/version.go
new file mode 100644
index 00000000..40ac63dc
--- /dev/null
+++ b/pkg/version/version.go
@@ -0,0 +1,62 @@
+/*
+ * 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 version
+
+import (
+       "encoding/json"
+       "fmt"
+       "runtime"
+)
+
+var (
+       gitVersion   = "dubbo-admin-%s"
+       gitCommit    = "$Format:%H$"
+       gitTreeState = "" // state of git tree, either "clean" or "dirty"
+       gitTag       = ""
+       buildDate    = "1970-01-01T00:00:00Z"
+)
+
+type Version struct {
+       GitVersion   string `json:"gitVersion"`
+       GitCommit    string `json:"gitCommit"`
+       GitTreeState string `json:"gitTreeState"`
+       BuildDate    string `json:"buildDate"`
+       GoVersion    string `json:"goVersion"`
+       Compiler     string `json:"compiler"`
+       Platform     string `json:"platform"`
+}
+
+func GetVersion() Version {
+       version := Version{
+               GitVersion:   fmt.Sprintf(gitVersion, gitTag),
+               GitCommit:    gitCommit,
+               GitTreeState: gitTreeState,
+               BuildDate:    buildDate,
+               GoVersion:    runtime.Version(),
+               Compiler:     runtime.Compiler,
+               Platform:     fmt.Sprintf("%s/%s", runtime.GOOS, 
runtime.GOARCH),
+       }
+
+       return version
+}
+
+func GetVersionInfo() string {
+       version := GetVersion()
+       result, _ := json.Marshal(version)
+       return string(result)
+}

Reply via email to