diff --git a/README.md b/README.md index e2106bc..3d75f05 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/singchia/frontier)](https://goreportcard.com/report/github.com/singchia/frontier) +[![Go Reference](https://pkg.go.dev/badge/badge/github.com/singchia/frontier.svg)](https://pkg.go.dev/github.com/singchia/frontier/api/dataplane/v1/service) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
@@ -888,7 +889,7 @@ exchange: ### docker ``` -docker run -d --name frontier -p 30011:30011 -p 30012:30012 singchia/frontier:1.0.0 +docker run -d --name frontier -p 30011:30011 -p 30012:30012 singchia/frontier:1.1.0 ``` @@ -910,6 +911,12 @@ cd dist/helm helm install frontier ./ -f values.yaml ``` +你的微服务应该连接`service/frontier-servicebound-svc:40011`,你的边缘节点可以连接`:30012`所在的NodePort。 + +### operator + +见下面集群部署章节 + ## 集群 ### Frontier + Frontlas架构 @@ -1039,11 +1046,23 @@ service ClusterService { ``` git clone https://github.com/singchia/frontier.git -cd pkg/operator -make install && make deploy +cd dist/crd +kubectl apply -f install.yaml ``` -**CR** +查看CRD: + +``` +kubectl get crd frontierclusters.frontier.singchia.io +``` + +查看Operator: + +``` +kubectl get all -n frontier-system +``` + +**FrontierCluster集群** ```yaml apiVersion: frontier.singchia.io/v1alpha1 @@ -1056,7 +1075,7 @@ metadata: spec: frontier: # 单实例Frontier - replicas: 1 + replicas: 2 # 微服务侧端口 servicebound: port: 30011 @@ -1069,8 +1088,8 @@ spec: # 控制面端口 controlplane: port: 40011 - # 依赖的Redis配置 redis: + # 依赖的Redis配置 addrs: - rfs-redisfailover:26379 password: your-password @@ -1078,8 +1097,40 @@ spec: redisType: sentinel ``` -1分钟,你即可拥有一个Frontier+Frontlas的集群。 +1分钟,你即可拥有一个2实例Frontier+1实例Frontlas的集群。 +通过一下来检查资源部署情况 + +> kubectl get all -l app=frontiercluster-frontier +> kubectl get all -l app=frontiercluster-frontlas + + +``` +NAME READY STATUS RESTARTS AGE +pod/frontiercluster-frontier-57d565c89-dn6n8 1/1 Running 0 7m22s +pod/frontiercluster-frontier-57d565c89-nmwmt 1/1 Running 0 7m22s +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +service/frontiercluster-edgebound-svc NodePort 10.233.23.174 30012:30012/TCP 8m7s +service/frontiercluster-servicebound-svc ClusterIP 10.233.29.156 30011/TCP 8m7s +NAME READY UP-TO-DATE AVAILABLE AGE +deployment.apps/frontiercluster-frontier 2/2 2 2 7m22s +NAME DESIRED CURRENT READY AGE +replicaset.apps/frontiercluster-frontier-57d565c89 2 2 2 7m22s +``` + +``` +kubectl get all -l app=frontiercluster-frontlas +NAME READY STATUS RESTARTS AGE +pod/frontiercluster-frontlas-85c4fb6d9b-5clkh 1/1 Running 0 8m11s +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +service/frontiercluster-frontlas-svc ClusterIP 10.233.0.23 40011/TCP,40012/TCP 8m11s +NAME READY UP-TO-DATE AVAILABLE AGE +deployment.apps/frontiercluster-frontlas 1/1 1 1 8m11s +NAME DESIRED CURRENT READY AGE +replicaset.apps/frontiercluster-frontlas-85c4fb6d9b 1 1 1 8m11s +``` + +你的微服务应该连接`service/frontiercluster-frontlas-svc:40011`,你的边缘节点可以连接`:30012`所在的NodePort。 ## 开发 @@ -1107,4 +1158,8 @@ spec: ## 许可证 -Released under the [Apache License 2.0](https://github.com/singchia/geminio/blob/main/LICENSE) \ No newline at end of file +Released under the [Apache License 2.0](https://github.com/singchia/geminio/blob/main/LICENSE) + +--- + +已经看到这里,点个Star⭐️是莫大的认可♥️ \ No newline at end of file diff --git a/VERSION b/VERSION index afaf360..1cc5f65 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.0 \ No newline at end of file +1.1.0 \ No newline at end of file diff --git a/dist/compose/docker-compose.yml b/dist/compose/docker-compose.yml index 84c8b5d..ff988df 100644 --- a/dist/compose/docker-compose.yml +++ b/dist/compose/docker-compose.yml @@ -3,8 +3,9 @@ version: "3.7" services: frontier: container_name: frontier - image: singchia/frontier:1.0.0 + image: singchia/frontier:1.1.0 restart: always + command: --config /usr/conf/frontier.yaml -v 1 ports: - 30010:30010 - 30011:30011 @@ -16,7 +17,7 @@ services: max-file: "5" frontlas: container_name: frontlas - image: singchia/frontlas:1.0.0 + image: singchia/frontlas:1.1.0 restart: always ports: - 40011:40011 diff --git a/dist/crd/frontier-cluster.yaml b/dist/crd/frontier-cluster_example.yaml similarity index 84% rename from dist/crd/frontier-cluster.yaml rename to dist/crd/frontier-cluster_example.yaml index bffa5af..94af7b0 100644 --- a/dist/crd/frontier-cluster.yaml +++ b/dist/crd/frontier-cluster_example.yaml @@ -7,15 +7,17 @@ metadata: name: frontiercluster spec: frontier: - replicas: 1 + replicas: 2 servicebound: port: 30011 edgebound: port: 30012 + image: singchia/frontier:1.1.0 frontlas: replicas: 1 controlplane: port: 40011 + image: singchia/frontlas:1.1.0 redis: addrs: - rfs-redisfailover:26379 diff --git a/dist/crd/iclm-service_example.yaml b/dist/crd/iclm-service_example.yaml new file mode 100644 index 0000000..68c9dd5 --- /dev/null +++ b/dist/crd/iclm-service_example.yaml @@ -0,0 +1,20 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: iclm-service +spec: + selector: + matchLabels: + app: iclm-service + replicas: 1 + template: + metadata: + labels: + app: iclm-service + spec: + imagePullSecrets: + - name: Always + containers: + - name: iclm-service + image: singchia/iclm_service:1.0.0-dev + imagePullPolicy: Always \ No newline at end of file diff --git a/dist/crd/install.yaml b/dist/crd/install.yaml index d1d56ae..e743b20 100644 --- a/dist/crd/install.yaml +++ b/dist/crd/install.yaml @@ -109,6 +109,8 @@ spec: - mtls type: object type: object + image: + type: string nodeAffinity: description: Node affinity is a group of node affinity scheduling rules. @@ -328,6 +330,8 @@ spec: for a service type: string type: object + image: + type: string nodeAffinity: description: Node affinity is a group of node affinity scheduling rules. @@ -525,6 +529,8 @@ spec: type: array db: type: integer + masterName: + type: string password: type: string redisType: @@ -859,7 +865,7 @@ spec: - --leader-elect command: - /manager - image: singchia/frontiercluster-controller:1.0.0 + image: singchia/frontiercluster-controller:1.1.0 imagePullPolicy: Always livenessProbe: httpGet: diff --git a/dist/helm/configs/frontier/frontier.yaml b/dist/helm/configs/frontier/frontier.yaml index dfb574a..f16f6e0 100644 --- a/dist/helm/configs/frontier/frontier.yaml +++ b/dist/helm/configs/frontier/frontier.yaml @@ -7,52 +7,14 @@ daemon: enable: true addr: 0.0.0.0:6060 cpu_profile_rate: 0 -controlplane: - enable: false - listen: - network: tcp - addr: 0.0.0.0:30010 servicebound: listen: network: tcp addr: 0.0.0.0:30011 - tls: - enable: false - mtls: false - ca_certs: - - ca1.cert - - ca2.cert - certs: - - cert: servicebound.cert - key: servicebound.key - insecure_skip_verify: false edgebound: listen: network: tcp addr: 0.0.0.0:30012 - tls: - enable: false - mtls: false - ca_certs: - - ca1.cert - - ca2.cert - certs: - - cert: edgebound.cert - key: edgebound.key - insecure_skip_verify: false - bypass: - network: tcp - addr: 192.168.1.10:8443 - tls: - enable: true - mtls: true - ca_certs: - - ca1.cert - certs: - - cert: frontier.cert - key: frontier.key - insecure_skip_verify: false - bypass_enable: false edgeid_alloc_when_no_idservice_on: true dao: debug: false diff --git a/dist/helm/templates/service_frontier.yaml b/dist/helm/templates/service_frontier.yaml index 78a57d6..5f05aca 100644 --- a/dist/helm/templates/service_frontier.yaml +++ b/dist/helm/templates/service_frontier.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "frontier.fullname" . }} + name: "frontier-servicebound-svc" labels: {{- include "frontier.labels" . | nindent 4 }} spec: @@ -19,7 +19,7 @@ spec: apiVersion: v1 kind: Service metadata: - name: {{ include "frontier.fullname" . }} + name: "frontier-edgebound-svc" labels: {{- include "frontier.labels" . | nindent 4 }} spec: diff --git a/dist/helm/values.yaml b/dist/helm/values.yaml index 7a9fee8..99e020a 100644 --- a/dist/helm/values.yaml +++ b/dist/helm/values.yaml @@ -2,7 +2,7 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. global: - registry: hub.docker.com/singchia + registry: singchia pullPolicy: Always imagePullSecrets: [] @@ -14,7 +14,7 @@ image: image: frontier pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. - tag: 1.0.0 + tag: 1.1.0 replicaCount: 1 @@ -47,7 +47,7 @@ service: type: ClusterIP targetPort: controlbound port: 30010 - - name: servicebound + - name: frontier-edgebound-svc type: ClusterIP targetPort: servicebound port: 30011 diff --git a/pkg/frontier/edgebound/edge_manager.go b/pkg/frontier/edgebound/edge_manager.go index 048ad35..86ab468 100644 --- a/pkg/frontier/edgebound/edge_manager.go +++ b/pkg/frontier/edgebound/edge_manager.go @@ -87,6 +87,7 @@ func newEdgeManager(conf *config.Configuration, repo apis.Repo, informer apis.Ed klog.Errorf("edge manager listen err: %s", err) return nil, err } + klog.V(0).Infof("edgebound server listening on: %s", ln.Addr()) geminioLn := ln bypass := conf.Edgebound.BypassEnable diff --git a/pkg/frontier/frontlas/frontlas.go b/pkg/frontier/frontlas/frontlas.go index 3e3b11f..dbf023c 100644 --- a/pkg/frontier/frontlas/frontlas.go +++ b/pkg/frontier/frontlas/frontlas.go @@ -33,6 +33,9 @@ func NewInformer(conf *config.Configuration, tmr timer.Timer) (*Informer, error) if dial.Addrs == nil || len(dial.Addrs) == 0 { return nil, errors.New("illegal dial addrs") } + if dial.Network == "" { + dial.Network = "tcp" + } sbAddr, ebAddr, err := getAdvertisedAddrs(conf.Servicebound.Listen, conf.Edgebound.Listen, dial) // meta diff --git a/pkg/frontier/servicebound/service_manager.go b/pkg/frontier/servicebound/service_manager.go index 2bc2ec8..80f719e 100644 --- a/pkg/frontier/servicebound/service_manager.go +++ b/pkg/frontier/servicebound/service_manager.go @@ -87,6 +87,7 @@ func newServiceManager(conf *config.Configuration, repo apis.Repo, informer apis klog.Errorf("service manager listen err: %s", err) return nil, err } + klog.V(0).Infof("servicebound server listening on: %s", ln.Addr()) sm.ln = ln return sm, nil } diff --git a/pkg/frontier/servicebound/service_onoff.go b/pkg/frontier/servicebound/service_onoff.go index a371918..e41e4f5 100644 --- a/pkg/frontier/servicebound/service_onoff.go +++ b/pkg/frontier/servicebound/service_onoff.go @@ -130,7 +130,7 @@ func (sm *serviceManager) ConnOffline(d delegate.ConnDescriber) error { serviceID := d.ClientID() meta := string(d.Meta()) addr := d.RemoteAddr() - klog.V(2).Infof("service offline, serviceID: %d, service: %s, remote addr: %s", serviceID, meta, addr) + klog.V(1).Infof("service offline, serviceID: %d, service: %s, remote addr: %s", serviceID, meta, addr) // offline the cache err := sm.offline(serviceID, addr) if err != nil { diff --git a/pkg/frontlas/frontierbound/frontier_bound.go b/pkg/frontlas/frontierbound/frontier_bound.go index 11510ae..8a723e4 100644 --- a/pkg/frontlas/frontierbound/frontier_bound.go +++ b/pkg/frontlas/frontierbound/frontier_bound.go @@ -46,7 +46,7 @@ func NewFrontierManager(conf *config.Configuration, dao *repo.Dao, tmr timer.Tim klog.Errorf("frontier plane listen err: %s", err) return nil, err } - klog.V(1).Infof("server listening on: %v", ln.Addr()) + klog.V(0).Infof("frontierbound server listening on: %v", ln.Addr()) fm.ln = ln return fm, nil diff --git a/pkg/operator/Makefile b/pkg/operator/Makefile index d7d25c5..35eb582 100644 --- a/pkg/operator/Makefile +++ b/pkg/operator/Makefile @@ -1,5 +1,5 @@ # Image URL to use all building/pushing image targets -IMG ?= singchia/frontiercluster-controller:1.0.0-dev +IMG ?= singchia/frontiercluster-controller:1.1.0 # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.29.0 diff --git a/pkg/operator/api/v1alpha1/frontiercluster_types.go b/pkg/operator/api/v1alpha1/frontiercluster_types.go index 52a5922..315a437 100644 --- a/pkg/operator/api/v1alpha1/frontiercluster_types.go +++ b/pkg/operator/api/v1alpha1/frontiercluster_types.go @@ -65,6 +65,7 @@ type Frontier struct { Replicas int `json:"replicas,omitempty"` // frontier replicas, default 1 Servicebound Servicebound `json:"servicebound"` Edgebound Edgebound `json:"edgebound"` + Image string `json:"image,omitempty"` // default singchia/frontier:1.1.0 NodeAffinity corev1.NodeAffinity `json:"nodeAffinity,omitempty"` } @@ -95,6 +96,7 @@ type Frontlas struct { Replicas int `json:"replicas,omitempty"` // frontlas replicas, default 1 ControlPlane ControlPlane `json:"controlplane,omitempty"` NodeAffinity corev1.NodeAffinity `json:"nodeAffinity,omitempty"` + Image string `json:"image,omitempty"` Redis Redis `json:"redis"` } diff --git a/pkg/operator/config/crd/bases/frontier.singchia.io_frontierclusters.yaml b/pkg/operator/config/crd/bases/frontier.singchia.io_frontierclusters.yaml index c283c9c..d1e23bf 100644 --- a/pkg/operator/config/crd/bases/frontier.singchia.io_frontierclusters.yaml +++ b/pkg/operator/config/crd/bases/frontier.singchia.io_frontierclusters.yaml @@ -97,6 +97,8 @@ spec: - mtls type: object type: object + image: + type: string nodeAffinity: description: Node affinity is a group of node affinity scheduling rules. @@ -316,6 +318,8 @@ spec: for a service type: string type: object + image: + type: string nodeAffinity: description: Node affinity is a group of node affinity scheduling rules. diff --git a/pkg/operator/config/manager/kustomization.yaml b/pkg/operator/config/manager/kustomization.yaml index eda1796..7e36189 100644 --- a/pkg/operator/config/manager/kustomization.yaml +++ b/pkg/operator/config/manager/kustomization.yaml @@ -5,4 +5,4 @@ kind: Kustomization images: - name: controller newName: singchia/frontiercluster-controller - newTag: 1.0.0-dev + newTag: 1.1.0 diff --git a/pkg/operator/dist/install.yaml b/pkg/operator/dist/install.yaml index d1d56ae..e743b20 100644 --- a/pkg/operator/dist/install.yaml +++ b/pkg/operator/dist/install.yaml @@ -109,6 +109,8 @@ spec: - mtls type: object type: object + image: + type: string nodeAffinity: description: Node affinity is a group of node affinity scheduling rules. @@ -328,6 +330,8 @@ spec: for a service type: string type: object + image: + type: string nodeAffinity: description: Node affinity is a group of node affinity scheduling rules. @@ -525,6 +529,8 @@ spec: type: array db: type: integer + masterName: + type: string password: type: string redisType: @@ -859,7 +865,7 @@ spec: - --leader-elect command: - /manager - image: singchia/frontiercluster-controller:1.0.0 + image: singchia/frontiercluster-controller:1.1.0 imagePullPolicy: Always livenessProbe: httpGet: diff --git a/pkg/operator/internal/controller/frontiercluster_deployment.go b/pkg/operator/internal/controller/frontiercluster_deployment.go index 72dbe05..1590808 100644 --- a/pkg/operator/internal/controller/frontiercluster_deployment.go +++ b/pkg/operator/internal/controller/frontiercluster_deployment.go @@ -96,6 +96,10 @@ func (r *FrontierClusterReconciler) ensureFrontierDeployment(ctx context.Context labels := map[string]string{ "app": app, } + image := fc.Spec.Frontier.Image + if image == "" { + image = "singchia/frontier:1.1.0" + } volumeMounts := []corev1.VolumeMount{} volumes := []corev1.Volume{} @@ -146,7 +150,7 @@ func (r *FrontierClusterReconciler) ensureFrontierDeployment(ctx context.Context // container container := container.Builder(). SetName("frontier"). - SetImage("singchia/frontier:1.0.0-dev"). + SetImage(image). SetImagePullPolicy(corev1.PullAlways). SetEnvs([]corev1.EnvVar{{ Name: FrontierServiceboundPortEnv, @@ -221,13 +225,17 @@ func (r *FrontierClusterReconciler) ensureFrontlasDeployment(ctx context.Context labels := map[string]string{ "app": app, } + image := fc.Spec.Frontlas.Image + if image == "" { + image = "singchia/frontlas:1.1.0" + } service, _, cpport, _ := fc.FrontlasServicePort() // container container := container.Builder(). SetName("frontlas"). - SetImage("singchia/frontlas:1.0.0-dev"). + SetImage(image). SetImagePullPolicy(corev1.PullAlways). SetEnvs([]corev1.EnvVar{{ Name: FrontlasControlPlanePortEnv,