Skip to content

Commit

Permalink
refactor fsm-connector (#133)
Browse files Browse the repository at this point in the history
* traffic split based on eureka metadata

* refactor connector

* refactor connector

* refactor connector

* refactor connector

* refactor connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector

* refactor fsm-connector
  • Loading branch information
cybwan authored Dec 1, 2023
1 parent 081caa1 commit e2ac825
Show file tree
Hide file tree
Showing 58 changed files with 5,564 additions and 1,724 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
BUILD_GITCOMMIT_VAR: 'github.com/flomesh-io/fsm/pkg/version.GitCommit'
strategy:
matrix:
id: [ "sidecar-init", "controller", "injector", "consul-connector", "eureka-connector","crds", "bootstrap", "preinstall", "healthcheck", "interceptor", "ingress", "gateway" ]
id: [ "sidecar-init", "controller", "injector", "connector", "crds", "bootstrap", "preinstall", "healthcheck", "interceptor", "ingress", "gateway" ]
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.0.0
Expand Down
20 changes: 8 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ labels: kustomize ## Attach required labels to gateway-api resources
.PHONY: build
build: charts-tgz manifests go-fmt go-vet ## Build commands with release args, the result will be optimized.
@mkdir -p $(BUILD_DIR)
CGO_ENABLED=0 go build -v -o $(BUILD_DIR) -ldflags ${LDFLAGS} ./cmd/{fsm-bootstrap,fsm-connector/consul,fsm-connector/eureka,fsm-controller,fsm-gateway,fsm-healthcheck,fsm-ingress,fsm-injector,fsm-interceptor,fsm-preinstall}
CGO_ENABLED=0 go build -v -o $(BUILD_DIR) -ldflags ${LDFLAGS} ./cmd/{fsm-bootstrap,fsm-connector,fsm-controller,fsm-gateway,fsm-healthcheck,fsm-ingress,fsm-injector,fsm-interceptor,fsm-preinstall}

.PHONY: build-fsm
build-fsm: helm-update-dep cmd/cli/chart.tgz
Expand Down Expand Up @@ -146,7 +146,7 @@ go-vet:

.PHONY: go-lint
go-lint: embed-files-test
docker run --rm -v $$(pwd):/app -w /app golangci/golangci-lint:v1.53 golangci-lint run --config .golangci.yml
docker run --rm -v $$(pwd):/app -w /app golangci/golangci-lint:v1.55 golangci-lint run --config .golangci.yml

.PHONY: go-fmt
go-fmt:
Expand Down Expand Up @@ -242,13 +242,9 @@ docker-build-fsm-healthcheck:
docker-build-fsm-interceptor:
docker buildx build --builder fsm --platform=$(DOCKER_BUILDX_PLATFORM) -o $(DOCKER_BUILDX_OUTPUT) -t $(CTR_REGISTRY)/fsm-interceptor:$(CTR_TAG) -f dockerfiles/Dockerfile.fsm-interceptor --build-arg GO_VERSION=$(DOCKER_GO_VERSION) --build-arg LDFLAGS=$(LDFLAGS) .

.PHONY: docker-build-fsm-consul-connector
docker-build-fsm-consul-connector:
docker buildx build --builder fsm --platform=$(DOCKER_BUILDX_PLATFORM) -o $(DOCKER_BUILDX_OUTPUT) -t $(CTR_REGISTRY)/fsm-consul-connector:$(CTR_TAG) -f dockerfiles/Dockerfile.fsm-consul-connector --build-arg GO_VERSION=$(DOCKER_GO_VERSION) --build-arg LDFLAGS=$(LDFLAGS) .

.PHONY: docker-build-fsm-eureka-connector
docker-build-fsm-eureka-connector:
docker buildx build --builder fsm --platform=$(DOCKER_BUILDX_PLATFORM) -o $(DOCKER_BUILDX_OUTPUT) -t $(CTR_REGISTRY)/fsm-eureka-connector:$(CTR_TAG) -f dockerfiles/Dockerfile.fsm-eureka-connector --build-arg GO_VERSION=$(DOCKER_GO_VERSION) --build-arg LDFLAGS=$(LDFLAGS) .
.PHONY: docker-build-fsm-connector
docker-build-fsm-connector:
docker buildx build --builder fsm --platform=$(DOCKER_BUILDX_PLATFORM) -o $(DOCKER_BUILDX_OUTPUT) -t $(CTR_REGISTRY)/fsm-connector:$(CTR_TAG) -f dockerfiles/Dockerfile.fsm-connector --build-arg GO_VERSION=$(DOCKER_GO_VERSION) --build-arg LDFLAGS=$(LDFLAGS) .

.PHONY: docker-build-fsm-ingress
docker-build-fsm-ingress:
Expand All @@ -258,9 +254,9 @@ docker-build-fsm-ingress:
docker-build-fsm-gateway:
docker buildx build --builder fsm --platform=$(DOCKER_BUILDX_PLATFORM) -o $(DOCKER_BUILDX_OUTPUT) -t $(CTR_REGISTRY)/fsm-gateway:$(CTR_TAG) -f dockerfiles/Dockerfile.fsm-gateway --build-arg GO_VERSION=$(DOCKER_GO_VERSION) --build-arg LDFLAGS=$(LDFLAGS) --build-arg DISTROLESS_TAG=nonroot .

TRI_TARGETS = fsm-sidecar-init fsm-controller fsm-injector fsm-crds fsm-bootstrap fsm-preinstall fsm-healthcheck fsm-consul-connector fsm-eureka-connector fsm-ingress fsm-gateway
FSM_TARGETS = fsm-sidecar-init fsm-controller fsm-injector fsm-crds fsm-bootstrap fsm-preinstall fsm-healthcheck fsm-consul-connector fsm-eureka-connector fsm-interceptor fsm-ingress fsm-gateway
E2E_TARGETS = fsm-sidecar-init fsm-controller fsm-injector fsm-crds fsm-bootstrap fsm-preinstall fsm-healthcheck fsm-consul-connector fsm-eureka-connector fsm-ingress fsm-gateway
TRI_TARGETS = fsm-sidecar-init fsm-controller fsm-injector fsm-crds fsm-bootstrap fsm-preinstall fsm-healthcheck fsm-connector fsm-ingress fsm-gateway
FSM_TARGETS = fsm-sidecar-init fsm-controller fsm-injector fsm-crds fsm-bootstrap fsm-preinstall fsm-healthcheck fsm-connector fsm-interceptor fsm-ingress fsm-gateway
E2E_TARGETS = fsm-sidecar-init fsm-controller fsm-injector fsm-crds fsm-bootstrap fsm-preinstall fsm-healthcheck fsm-connector fsm-ingress fsm-gateway

DOCKER_FSM_TARGETS = $(addprefix docker-build-, $(FSM_TARGETS))
DOCKER_E2E_TARGETS = $(addprefix docker-build-, $(E2E_TARGETS))
Expand Down
81 changes: 64 additions & 17 deletions charts/fsm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ The following table lists the configurable parameters of the fsm chart and their

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| clusterSet.controlPlaneUID | string | `""` | |
| clusterSet.group | string | `"default"` | |
| clusterSet.isManaged | bool | `false` | |
| clusterSet.name | string | `"local"` | |
| clusterSet.region | string | `"default"` | |
| clusterSet.zone | string | `"default"` | |
| fsm.caBundleSecretName | string | `"fsm-ca-bundle"` | The Kubernetes secret name to store CA bundle for the root CA used in FSM |
| fsm.certificateProvider.certKeyBitSize | int | `2048` | Certificate key bit size for data plane certificates issued to workloads to communicate over mTLS |
| fsm.certificateProvider.kind | string | `"tresor"` | The Certificate manager type: `tresor`, `vault` or `cert-manager` |
Expand Down Expand Up @@ -94,18 +100,63 @@ The following table lists the configurable parameters of the fsm chart and their
| fsm.cloudConnector.autoScale.memory.targetAverageUtilization | int | `80` | Average target memory utilization (%) |
| fsm.cloudConnector.autoScale.minReplicas | int | `1` | Minimum replicas for autoscale |
| fsm.cloudConnector.consul.deriveNamespace | string | `""` | |
| fsm.cloudConnector.consul.filterTag | string | `""` | |
| fsm.cloudConnector.consul.enable | bool | `false` | |
| fsm.cloudConnector.consul.httpAddr | string | `"127.0.0.1:8500"` | |
| fsm.cloudConnector.consul.passingOnly | bool | `true` | |
| fsm.cloudConnector.consul.prefixTag | string | `""` | |
| fsm.cloudConnector.consul.suffixTag | string | `""` | |
| fsm.cloudConnector.consul.syncFromK8S.addK8SNamespaceAsServiceSuffix | bool | `false` | |
| fsm.cloudConnector.consul.syncFromK8S.addServicePrefix | string | `""` | |
| fsm.cloudConnector.consul.syncFromK8S.allowK8sNamespaces[0] | string | `"*"` | |
| fsm.cloudConnector.consul.syncFromK8S.consulCrossNamespaceACLPolicy | string | `""` | |
| fsm.cloudConnector.consul.syncFromK8S.consulDestinationNamespace | string | `"default"` | |
| fsm.cloudConnector.consul.syncFromK8S.consulEnableK8SNSMirroring | bool | `false` | |
| fsm.cloudConnector.consul.syncFromK8S.consulEnableNamespaces | bool | `false` | |
| fsm.cloudConnector.consul.syncFromK8S.consulK8SNSMirroringPrefix | string | `""` | |
| fsm.cloudConnector.consul.syncFromK8S.consulK8STag | string | `"k8s"` | |
| fsm.cloudConnector.consul.syncFromK8S.consulNodeName | string | `"k8s-sync"` | |
| fsm.cloudConnector.consul.syncFromK8S.defaultSync | bool | `true` | |
| fsm.cloudConnector.consul.syncFromK8S.denyK8sNamespaces[0] | string | `""` | |
| fsm.cloudConnector.consul.syncFromK8S.enable | bool | `false` | |
| fsm.cloudConnector.consul.syncFromK8S.nodePortSyncType | string | `"ExternalOnly"` | |
| fsm.cloudConnector.consul.syncFromK8S.syncClusterIPServices | bool | `true` | |
| fsm.cloudConnector.consul.syncFromK8S.syncIngress | bool | `false` | |
| fsm.cloudConnector.consul.syncFromK8S.syncIngressLoadBalancerIPs | bool | `false` | |
| fsm.cloudConnector.consul.syncFromK8S.syncLoadBalancerEndpoints | bool | `false` | |
| fsm.cloudConnector.consul.syncFromK8S.withGatewayAPI.enable | bool | `false` | |
| fsm.cloudConnector.consul.syncFromK8S.withGatewayAPI.via | string | `"ClusterIP"` | |
| fsm.cloudConnector.consul.syncToFgw.allowK8sNamespaces[0] | string | `"*"` | |
| fsm.cloudConnector.consul.syncToFgw.defaultSync | bool | `true` | |
| fsm.cloudConnector.consul.syncToFgw.denyK8sNamespaces[0] | string | `""` | |
| fsm.cloudConnector.consul.syncToFgw.enable | bool | `false` | |
| fsm.cloudConnector.consul.syncToK8S.enable | bool | `true` | |
| fsm.cloudConnector.consul.syncToK8S.filterTag | string | `""` | |
| fsm.cloudConnector.consul.syncToK8S.passingOnly | bool | `true` | |
| fsm.cloudConnector.consul.syncToK8S.prefixTag | string | `""` | |
| fsm.cloudConnector.consul.syncToK8S.suffixTag | string | `""` | |
| fsm.cloudConnector.enablePodDisruptionBudget | bool | `false` | Enable Pod Disruption Budget |
| fsm.cloudConnector.eureka.deriveNamespace | string | `""` | |
| fsm.cloudConnector.eureka.filterTag | string | `""` | |
| fsm.cloudConnector.eureka.httpAddr | string | `"127.0.0.1:8500"` | |
| fsm.cloudConnector.eureka.passingOnly | bool | `true` | |
| fsm.cloudConnector.eureka.prefixTag | string | `""` | |
| fsm.cloudConnector.eureka.suffixTag | string | `""` | |
| fsm.cloudConnector.eureka.enable | bool | `false` | |
| fsm.cloudConnector.eureka.httpAddr | string | `"127.0.0.1:8761/eureka"` | |
| fsm.cloudConnector.eureka.syncFromK8S.addK8SNamespaceAsServiceSuffix | bool | `false` | |
| fsm.cloudConnector.eureka.syncFromK8S.addServicePrefix | string | `""` | |
| fsm.cloudConnector.eureka.syncFromK8S.allowK8sNamespaces[0] | string | `"*"` | |
| fsm.cloudConnector.eureka.syncFromK8S.defaultSync | bool | `true` | |
| fsm.cloudConnector.eureka.syncFromK8S.denyK8sNamespaces[0] | string | `""` | |
| fsm.cloudConnector.eureka.syncFromK8S.enable | bool | `false` | |
| fsm.cloudConnector.eureka.syncFromK8S.nodePortSyncType | string | `"ExternalOnly"` | |
| fsm.cloudConnector.eureka.syncFromK8S.syncClusterIPServices | bool | `true` | |
| fsm.cloudConnector.eureka.syncFromK8S.syncIngress | bool | `false` | |
| fsm.cloudConnector.eureka.syncFromK8S.syncIngressLoadBalancerIPs | bool | `false` | |
| fsm.cloudConnector.eureka.syncFromK8S.syncLoadBalancerEndpoints | bool | `false` | |
| fsm.cloudConnector.eureka.syncFromK8S.withGatewayAPI.enable | bool | `false` | |
| fsm.cloudConnector.eureka.syncFromK8S.withGatewayAPI.via | string | `"ClusterIP"` | |
| fsm.cloudConnector.eureka.syncToFgw.allowK8sNamespaces[0] | string | `"*"` | |
| fsm.cloudConnector.eureka.syncToFgw.defaultSync | bool | `true` | |
| fsm.cloudConnector.eureka.syncToFgw.denyK8sNamespaces[0] | string | `""` | |
| fsm.cloudConnector.eureka.syncToFgw.enable | bool | `false` | |
| fsm.cloudConnector.eureka.syncToK8S.enable | bool | `true` | |
| fsm.cloudConnector.eureka.syncToK8S.filterMetadata | string | `""` | |
| fsm.cloudConnector.eureka.syncToK8S.passingOnly | bool | `true` | |
| fsm.cloudConnector.eureka.syncToK8S.prefixMetadata | string | `""` | |
| fsm.cloudConnector.eureka.syncToK8S.suffixMetadata | string | `""` | |
| fsm.cloudConnector.nodeSelector | object | `{}` | |
| fsm.cloudConnector.podLabels | object | `{}` | Sidecar injector's pod labels |
| fsm.cloudConnector.replicaCount | int | `1` | Sidecar injector's replica count (ignored when autoscale.enable is true) |
Expand All @@ -115,8 +166,6 @@ The following table lists the configurable parameters of the fsm chart and their
| fsm.controlPlaneTolerations | list | `[]` | Node tolerations applied to control plane pods. The specified tolerations allow pods to schedule onto nodes with matching taints. |
| fsm.controllerLogLevel | string | `"info"` | Controller log verbosity |
| fsm.curlImage | string | `"curlimages/curl"` | Curl image for control plane init container |
| fsm.deployConsulConnector | bool | `false` | Deploy Consul Connector with FSM installation |
| fsm.deployEurekaConnector | bool | `false` | Deploy Eureka Connector with FSM installation |
| fsm.deployGrafana | bool | `false` | Deploy Grafana with FSM installation |
| fsm.deployJaeger | bool | `false` | Deploy Jaeger during FSM installation |
| fsm.deployPrometheus | bool | `false` | Deploy Prometheus with FSM installation |
Expand Down Expand Up @@ -305,25 +354,23 @@ The following table lists the configurable parameters of the fsm chart and their
| fsm.grafana.tolerations | list | `[]` | Node tolerations applied to control plane pods. The specified tolerations allow pods to schedule onto nodes with matching taints. |
| fsm.http1PerRequestLoadBalancing | bool | `false` | Specifies a boolean indicating if load balancing based on request is enabled for http1. |
| fsm.http2PerRequestLoadBalancing | bool | `true` | Specifies a boolean indicating if load balancing based on request is enabled for http2. |
| fsm.image.digest | object | `{"fsmBootstrap":"","fsmCRDs":"","fsmConsulConnector":"","fsmController":"","fsmEurekaConnector":"","fsmGateway":"","fsmHealthcheck":"","fsmIngress":"","fsmInjector":"","fsmInterceptor":"","fsmPreinstall":"","fsmSidecarInit":""}` | Image digest (defaults to latest compatible tag) |
| fsm.image.digest | object | `{"fsmBootstrap":"","fsmCRDs":"","fsmConnector":"","fsmController":"","fsmGateway":"","fsmHealthcheck":"","fsmIngress":"","fsmInjector":"","fsmInterceptor":"","fsmPreinstall":"","fsmSidecarInit":""}` | Image digest (defaults to latest compatible tag) |
| fsm.image.digest.fsmBootstrap | string | `""` | fsm-boostrap's image digest |
| fsm.image.digest.fsmCRDs | string | `""` | fsm-crds' image digest |
| fsm.image.digest.fsmConsulConnector | string | `""` | fsm-consul-connector's image digest |
| fsm.image.digest.fsmConnector | string | `""` | fsm-connector's image digest |
| fsm.image.digest.fsmController | string | `""` | fsm-controller's image digest |
| fsm.image.digest.fsmEurekaConnector | string | `""` | fsm-eureka-connector's image digest |
| fsm.image.digest.fsmGateway | string | `""` | fsm-gateway's image digest |
| fsm.image.digest.fsmHealthcheck | string | `""` | fsm-healthcheck's image digest |
| fsm.image.digest.fsmIngress | string | `""` | fsm-ingress's image digest |
| fsm.image.digest.fsmInjector | string | `""` | fsm-injector's image digest |
| fsm.image.digest.fsmInterceptor | string | `""` | fsm-interceptor's image digest |
| fsm.image.digest.fsmPreinstall | string | `""` | fsm-preinstall's image digest |
| fsm.image.digest.fsmSidecarInit | string | `""` | Sidecar init container's image digest |
| fsm.image.name | object | `{"fsmBootstrap":"fsm-bootstrap","fsmCRDs":"fsm-crds","fsmConsulConnector":"fsm-consul-connector","fsmController":"fsm-controller","fsmEurekaConnector":"fsm-eureka-connector","fsmGateway":"fsm-gateway","fsmHealthcheck":"fsm-healthcheck","fsmIngress":"fsm-ingress","fsmInjector":"fsm-injector","fsmInterceptor":"fsm-interceptor","fsmPreinstall":"fsm-preinstall","fsmSidecarInit":"fsm-sidecar-init"}` | Image name defaults |
| fsm.image.name | object | `{"fsmBootstrap":"fsm-bootstrap","fsmCRDs":"fsm-crds","fsmConnector":"fsm-connector","fsmController":"fsm-controller","fsmGateway":"fsm-gateway","fsmHealthcheck":"fsm-healthcheck","fsmIngress":"fsm-ingress","fsmInjector":"fsm-injector","fsmInterceptor":"fsm-interceptor","fsmPreinstall":"fsm-preinstall","fsmSidecarInit":"fsm-sidecar-init"}` | Image name defaults |
| fsm.image.name.fsmBootstrap | string | `"fsm-bootstrap"` | fsm-boostrap's image name |
| fsm.image.name.fsmCRDs | string | `"fsm-crds"` | fsm-crds' image name |
| fsm.image.name.fsmConsulConnector | string | `"fsm-consul-connector"` | fsm-consul-connector's image name |
| fsm.image.name.fsmConnector | string | `"fsm-connector"` | fsm-connector's image name |
| fsm.image.name.fsmController | string | `"fsm-controller"` | fsm-controller's image name |
| fsm.image.name.fsmEurekaConnector | string | `"fsm-eureka-connector"` | fsm-eureka-connector's image name |
| fsm.image.name.fsmGateway | string | `"fsm-gateway"` | fsm-gateway's image name |
| fsm.image.name.fsmHealthcheck | string | `"fsm-healthcheck"` | fsm-healthcheck's image name |
| fsm.image.name.fsmIngress | string | `"fsm-ingress"` | fsm-ingress's image name |
Expand Down
17 changes: 4 additions & 13 deletions charts/fsm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,12 @@ securityContext:
{{- end -}}
{{- end -}}

{{/* fsm-consul-conector image */}}
{{- define "fsmConsulConnector.image" -}}
{{/* fsm-conector image */}}
{{- define "fsmConnector.image" -}}
{{- if .Values.fsm.image.tag -}}
{{- printf "%s/%s:%s" .Values.fsm.image.registry .Values.fsm.image.name.fsmConsulConnector .Values.fsm.image.tag -}}
{{- printf "%s/%s:%s" .Values.fsm.image.registry .Values.fsm.image.name.fsmConnector .Values.fsm.image.tag -}}
{{- else -}}
{{- printf "%s/%s@%s" .Values.fsm.image.registry .Values.fsm.image.name.fsmConsulConnector .Values.fsm.image.digest.fsmInjector -}}
{{- end -}}
{{- end -}}

{{/* fsm-eureka-conector image */}}
{{- define "fsmEurekaConnector.image" -}}
{{- if .Values.fsm.image.tag -}}
{{- printf "%s/%s:%s" .Values.fsm.image.registry .Values.fsm.image.name.fsmEurekaConnector .Values.fsm.image.tag -}}
{{- else -}}
{{- printf "%s/%s@%s" .Values.fsm.image.registry .Values.fsm.image.name.fsmEurekaConnector .Values.fsm.image.digest.fsmInjector -}}
{{- printf "%s/%s@%s" .Values.fsm.image.registry .Values.fsm.image.name.fsmConnector .Values.fsm.image.digest.fsmInjector -}}
{{- end -}}
{{- end -}}

Expand Down
Loading

0 comments on commit e2ac825

Please sign in to comment.