Skip to content

Commit

Permalink
optimized fsm connector (#210)
Browse files Browse the repository at this point in the history
* add connector crd.

* add connector crd.

* add connector crd.

* add connector crd.

* add connector crd.

* add connector crd.

fix: connector chart

Signed-off-by: Lin Yang <[email protected]>
  • Loading branch information
cybwan authored and reaver-flomesh committed Mar 18, 2024
1 parent 8df46fb commit 1960cad
Show file tree
Hide file tree
Showing 166 changed files with 11,634 additions and 5,494 deletions.
274 changes: 2 additions & 272 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,231 +162,15 @@ jobs:
- name: Scan docker images for vulnerabilities
run: make trivy-scan-images

e2etest_1-3:
name: Go test e2e
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
k8s_version: [ "" ]
focus: [ "" ]
bucket: [ 1, 2, 3 ]
env:
CTR_TAG: ${{ github.sha }}
CTR_REGISTRY: "localhost:5000" # unused for kind, but currently required in framework
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build test dependencies
env:
DOCKER_BUILDX_OUTPUT: type=docker
run: make docker-build-e2e build-fsm
- name: Run tests
id: test
env:
K8S_NAMESPACE: "fsm-system"
run: |
export PATH=$PWD/bin:$PATH
echo "PATH=$PATH"
go test ./tests/e2e -test.v -ginkgo.v -ginkgo.progress -installType=KindCluster -kindClusterVersion='${{ matrix.k8s_version }}' -test.timeout 0 -test.failfast -ginkgo.failFast -ginkgo.focus='\[Bucket ${{ matrix.bucket }}\].*${{ matrix.focus }}'
continue-on-error: true
- name: Set Logs name
if: ${{ steps.test.conclusion != 'skipped' }}
run: |
if [[ -n "${{ matrix.k8s_version }}" ]]; then
echo "ARTIFACT_NAME=test_logs_k8s_version_${{ matrix.k8s_version }}" >> $GITHUB_ENV
else
echo "ARTIFACT_NAME=test_logs_bucket_${{ matrix.bucket }}" >> $GITHUB_ENV
fi
- name: Upload test logs
if: ${{ steps.test.conclusion != 'skipped' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: /tmp/test**/*
- name: Check continue tests
if: ${{ steps.test.conclusion != 'skipped' && steps.test.outcome == 'failure'}}
run: exit 1
- name: Clean tests
if: ${{ steps.test.conclusion != 'skipped' }}
run: rm -rf /tmp/test*

e2etest_4:
name: Go test e2e
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
k8s_version: [ "" ]
focus: [ "" ]
bucket: [ 4 ]
env:
CTR_TAG: ${{ github.sha }}
CTR_REGISTRY: "localhost:5000" # unused for kind, but currently required in framework
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build test dependencies
env:
DOCKER_BUILDX_OUTPUT: type=docker
run: make docker-build-e2e build-fsm
- name: Run tests
id: test
env:
K8S_NAMESPACE: "fsm-system"
run: |
export PATH=$PWD/bin:$PATH
echo "PATH=$PATH"
go test ./tests/e2e -test.v -ginkgo.v -ginkgo.progress -installType=KindCluster -kindClusterVersion='${{ matrix.k8s_version }}' -test.timeout 0 -test.failfast -ginkgo.failFast -ginkgo.focus='\[Bucket ${{ matrix.bucket }}\].*${{ matrix.focus }}'
continue-on-error: true
- name: Set Logs name
if: ${{ steps.test.conclusion != 'skipped' }}
run: |
if [[ -n "${{ matrix.k8s_version }}" ]]; then
echo "ARTIFACT_NAME=test_logs_k8s_version_${{ matrix.k8s_version }}" >> $GITHUB_ENV
else
echo "ARTIFACT_NAME=test_logs_bucket_${{ matrix.bucket }}" >> $GITHUB_ENV
fi
- name: Upload test logs
if: ${{ steps.test.conclusion != 'skipped' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: /tmp/test**/*
- name: Check continue tests
if: ${{ steps.test.conclusion != 'skipped' && steps.test.outcome == 'failure'}}
run: exit 1
- name: Clean tests
if: ${{ steps.test.conclusion != 'skipped' }}
run: rm -rf /tmp/test*

e2etest_5-6:
name: Go test e2e
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
k8s_version: [""]
focus: [""]
bucket: [5, 6]
env:
CTR_TAG: ${{ github.sha }}
CTR_REGISTRY: "localhost:5000" # unused for kind, but currently required in framework
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build test dependencies
env:
DOCKER_BUILDX_OUTPUT: type=docker
run: make docker-build-e2e build-fsm
- name: Run tests
id: test
env:
K8S_NAMESPACE: "fsm-system"
run: |
export PATH=$PWD/bin:$PATH
echo "PATH=$PATH"
go test ./tests/e2e -test.v -ginkgo.v -ginkgo.progress -installType=KindCluster -kindClusterVersion='${{ matrix.k8s_version }}' -test.timeout 0 -test.failfast -ginkgo.failFast -ginkgo.focus='\[Bucket ${{ matrix.bucket }}\].*${{ matrix.focus }}'
continue-on-error: true
- name: Set Logs name
if: ${{ steps.test.conclusion != 'skipped' }}
run: |
if [[ -n "${{ matrix.k8s_version }}" ]]; then
echo "ARTIFACT_NAME=test_logs_k8s_version_${{ matrix.k8s_version }}" >> $GITHUB_ENV
else
echo "ARTIFACT_NAME=test_logs_bucket_${{ matrix.bucket }}" >> $GITHUB_ENV
fi
- name: Upload test logs
if: ${{ steps.test.conclusion != 'skipped' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: /tmp/test**/*
- name: Check continue tests
if: ${{ steps.test.conclusion != 'skipped' && steps.test.outcome == 'failure'}}
run: exit 1
- name: Clean tests
if: ${{ steps.test.conclusion != 'skipped' }}
run: rm -rf /tmp/test*

e2etest_7:
name: Go test e2e
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
k8s_version: [""]
focus: [""]
bucket: [7]
env:
CTR_TAG: ${{ github.sha }}
CTR_REGISTRY: "localhost:5000" # unused for kind, but currently required in framework
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build test dependencies
env:
DOCKER_BUILDX_OUTPUT: type=docker
run: make docker-build-e2e build-fsm
- name: Run tests
id: test
env:
K8S_NAMESPACE: "fsm-system"
run: |
export PATH=$PWD/bin:$PATH
echo "PATH=$PATH"
go test ./tests/e2e -test.v -ginkgo.v -ginkgo.progress -installType=KindCluster -kindClusterVersion='${{ matrix.k8s_version }}' -test.timeout 0 -test.failfast -ginkgo.failFast -ginkgo.focus='\[Bucket ${{ matrix.bucket }}\].*${{ matrix.focus }}'
continue-on-error: true
- name: Set Logs name
if: ${{ steps.test.conclusion != 'skipped' }}
run: |
if [[ -n "${{ matrix.k8s_version }}" ]]; then
echo "ARTIFACT_NAME=test_logs_k8s_version_${{ matrix.k8s_version }}" >> $GITHUB_ENV
else
echo "ARTIFACT_NAME=test_logs_bucket_${{ matrix.bucket }}" >> $GITHUB_ENV
fi
- name: Upload test logs
if: ${{ steps.test.conclusion != 'skipped' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: /tmp/test**/*
- name: Check continue tests
if: ${{ steps.test.conclusion != 'skipped' && steps.test.outcome == 'failure'}}
run: exit 1
- name: Clean tests
if: ${{ steps.test.conclusion != 'skipped' }}
run: rm -rf /tmp/test*

e2etest_8-11:
e2etest:
name: Go test e2e
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
k8s_version: [""]
focus: [""]
bucket: [8, 9, 10, 11]
bucket: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
include:
- k8s_version: v1.19.11
focus: "Test traffic flowing from client to server with a Kubernetes Service for the Source: HTTP"
Expand Down Expand Up @@ -439,60 +223,6 @@ jobs:
if: ${{ steps.test.conclusion != 'skipped' }}
run: rm -rf /tmp/test*

e2etest_12:
name: Go test e2e
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
k8s_version: [""]
focus: [""]
bucket: [12]
env:
CTR_TAG: ${{ github.sha }}
CTR_REGISTRY: "localhost:5000" # unused for kind, but currently required in framework
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build test dependencies
env:
DOCKER_BUILDX_OUTPUT: type=docker
run: make docker-build-e2e build-fsm
- name: Run tests
id: test
env:
K8S_NAMESPACE: "fsm-system"
run: |
export PATH=$PWD/bin:$PATH
echo "PATH=$PATH"
go test ./tests/e2e -test.v -ginkgo.v -ginkgo.progress -installType=KindCluster -kindClusterVersion='${{ matrix.k8s_version }}' -test.timeout 0 -test.failfast -ginkgo.failFast -ginkgo.focus='\[Bucket ${{ matrix.bucket }}\].*${{ matrix.focus }}'
continue-on-error: true
- name: Set Logs name
if: ${{ steps.test.conclusion != 'skipped' }}
run: |
if [[ -n "${{ matrix.k8s_version }}" ]]; then
echo "ARTIFACT_NAME=test_logs_k8s_version_${{ matrix.k8s_version }}" >> $GITHUB_ENV
else
echo "ARTIFACT_NAME=test_logs_bucket_${{ matrix.bucket }}" >> $GITHUB_ENV
fi
- name: Upload test logs
if: ${{ steps.test.conclusion != 'skipped' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: /tmp/test**/*
- name: Check continue tests
if: ${{ steps.test.conclusion != 'skipped' && steps.test.outcome == 'failure'}}
run: exit 1
- name: Clean tests
if: ${{ steps.test.conclusion != 'skipped' }}
run: rm -rf /tmp/test*

integration-tresor:
name: Integration Test with Tresor, SMI traffic policies, and egress disabled
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ jobs:
run: |
rm -rfv charts/gateway/
rm -rfv charts/namespaced-ingress/
rm -rfv charts/connector/
- name: Publish Helm charts
uses: stefanprodan/[email protected]
with:
Expand Down
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,21 @@ pkg/controllers/namespacedingress/v1alpha1/chart.tgz: scripts/generate_chart/gen
pkg/controllers/gateway/v1beta1/chart.tgz: scripts/generate_chart/generate_chart.go $(shell find charts/gateway)
go run $< --chart-name=gateway > $@

pkg/controllers/connector/v1alpha1/chart.tgz: scripts/generate_chart/generate_chart.go $(shell find charts/connector)
go run $< --chart-name=connector > $@

helm-update-dep: helm
$(HELM) dependency update charts/fsm/
$(HELM) dependency update charts/gateway/
$(HELM) dependency update charts/namespaced-ingress/
$(HELM) dependency update charts/connector/

.PHONY: package-scripts
package-scripts: ## Tar all repo initializing scripts
tar --no-xattrs -C $(CHART_COMPONENTS_DIR)/ --exclude='.DS_Store' -zcvf $(SCRIPTS_TAR) scripts/

.PHONY: charts-tgz
charts-tgz: pkg/controllers/namespacedingress/v1alpha1/chart.tgz pkg/controllers/gateway/v1beta1/chart.tgz
charts-tgz: pkg/controllers/namespacedingress/v1alpha1/chart.tgz pkg/controllers/gateway/v1beta1/chart.tgz pkg/controllers/connector/v1alpha1/chart.tgz

.PHONY: clean-fsm
clean-fsm:
Expand All @@ -111,6 +115,9 @@ chart-readme:
.PHONY: chart-check-readme
chart-check-readme: chart-readme
@git diff --exit-code charts/fsm/README.md || { echo "----- Please commit the changes made by 'make chart-readme' -----"; exit 1; }
@git diff --exit-code charts/gateway/README.md || { echo "----- Please commit the changes made by 'make chart-readme' -----"; exit 1; }
@git diff --exit-code charts/namespaced-ingress/README.md || { echo "----- Please commit the changes made by 'make chart-readme' -----"; exit 1; }
@git diff --exit-code charts/connector/README.md || { echo "----- Please commit the changes made by 'make chart-readme' -----"; exit 1; }

.PHONY: helm-lint
helm-lint:
Expand Down Expand Up @@ -261,16 +268,21 @@ docker-build-fsm-gateway:
TRI_TARGETS = fsm-curl fsm-sidecar-init fsm-controller fsm-injector fsm-crds fsm-bootstrap fsm-preinstall fsm-healthcheck fsm-connector fsm-ingress fsm-gateway
FSM_TARGETS = fsm-curl 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-curl fsm-sidecar-init fsm-controller fsm-injector fsm-crds fsm-bootstrap fsm-preinstall fsm-healthcheck fsm-connector fsm-ingress fsm-gateway
MIN_TARGETS = fsm-curl fsm-sidecar-init fsm-controller fsm-injector fsm-crds fsm-bootstrap fsm-preinstall fsm-healthcheck

DOCKER_FSM_TARGETS = $(addprefix docker-build-, $(FSM_TARGETS))
DOCKER_E2E_TARGETS = $(addprefix docker-build-, $(E2E_TARGETS))
DOCKER_MIN_TARGETS = $(addprefix docker-build-, $(MIN_TARGETS))

.PHONY: docker-build-fsm
docker-build-fsm: charts-tgz $(DOCKER_FSM_TARGETS)

.PHONY: docker-build-e2e
docker-build-e2e: charts-tgz $(DOCKER_E2E_TARGETS)

.PHONY: docker-build-min
docker-build-min: charts-tgz $(DOCKER_MIN_TARGETS)

.PHONY: buildx-context
buildx-context:
@if ! docker buildx ls | grep -q "^fsm "; then docker buildx create --name fsm --driver-opt network=host; fi
Expand Down
23 changes: 23 additions & 0 deletions charts/connector/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions charts/connector/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: tpls
repository: file://../tpls
version: 0.1.1
digest: sha256:835c3f1a59e3d49577b45e10e3ee288f7a2b0107867e382c40c15cd80b90b366
generated: "2023-03-03T15:37:06.264565+08:00"
Loading

0 comments on commit 1960cad

Please sign in to comment.