-
Notifications
You must be signed in to change notification settings - Fork 1
Microcks tests #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
mathieu-benoit
wants to merge
13
commits into
main
Choose a base branch
from
microcks-test
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Microcks tests #12
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ec75fa6
Microcks tests
mathieu-benoit acf9424
Add endpont provisioner for score-k8s
mathieu-benoit 273a6e1
resources --> api-mocks folder support + _URL in trade-service for en…
mathieu-benoit 1e9c225
doc
mathieu-benoit 7353ae3
artifacts, name and version params
mathieu-benoit 4473b20
fix new params in k8s provisioner
mathieu-benoit b7ae751
update ingress to use the mock endpoints
mathieu-benoit c13990d
Fix make doc
mathieu-benoit 5ee21e5
microcks-uber - size: 65536
mathieu-benoit 31c075d
Fix accountId: 52335
mathieu-benoit 1415889
Fix restart: on-failure for each mock
mathieu-benoit 46397d3
Add missing position-service Mock
mathieu-benoit 96c46f0
Fix Mock endpoint in Ingress to http://microcks:8080 + add position-s…
mathieu-benoit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| FROM nginx:alpine-slim | ||
|
|
||
| EXPOSE 8080 | ||
| ARG NGINX_HOST="localhost" | ||
| ENV NGINX_HOST=$NGINX_HOST | ||
|
|
||
| # This is a workaround for the dollar sign in the envsubst command | ||
| ARG DOLLAR="$" | ||
| ENV DOLLAR=$DOLLAR | ||
|
|
||
| COPY nginx.traderx-mock.conf.template /etc/nginx/conf.d/nginx.traderx.conf.template | ||
|
|
||
| RUN envsubst < /etc/nginx/conf.d/nginx.traderx.conf.template > /etc/nginx/conf.d/default.conf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| server { | ||
| listen 8080; | ||
| server_name $NGINX_HOST; | ||
|
|
||
| location /db-web/ { | ||
| proxy_pass http://database-database:18084/; | ||
| } | ||
| location /reference-data/ { | ||
| proxy_pass http://microcks:8080/rest/FINOS+TraderX+Reference+Data/1.0/; | ||
| } | ||
|
|
||
| location /ng-cli-ws { | ||
| proxy_pass http://web-frontend-web-frontend:18093/ng-cli-ws; | ||
| proxy_http_version 1.1; | ||
| proxy_set_header Upgrade ${DOLLAR}http_upgrade; | ||
| proxy_set_header Connection "upgrade"; | ||
| } | ||
|
|
||
| location /trade-feed/ { | ||
| proxy_set_header X-Forwarded-For ${DOLLAR}proxy_add_x_forwarded_for; | ||
| proxy_set_header Host ${DOLLAR}http_host; | ||
|
|
||
| proxy_pass http://trade-feed-trade-feed:18086/; | ||
|
|
||
| proxy_http_version 1.1; | ||
| proxy_set_header Upgrade ${DOLLAR}http_upgrade; | ||
| proxy_set_header Connection "upgrade"; | ||
| } | ||
|
|
||
| location /socket.io/ { | ||
| proxy_set_header X-Forwarded-For ${DOLLAR}proxy_add_x_forwarded_for; | ||
| proxy_set_header Host ${DOLLAR}http_host; | ||
|
|
||
| proxy_pass http://trade-feed-trade-feed:18086/socket.io/; | ||
|
|
||
| proxy_http_version 1.1; | ||
| proxy_set_header Upgrade ${DOLLAR}http_upgrade; | ||
| proxy_set_header Connection "upgrade"; | ||
| } | ||
|
|
||
| location /people-service/ { | ||
| proxy_pass http://microcks:8080/rest/FINOS+TraderX+People+Service/v1/; | ||
| } | ||
| location /account-service/ { | ||
| proxy_pass http://microcks:8080/rest/FINOS+TraderX+Account+Service/0.1.0/; | ||
| } | ||
| location /position-service/ { | ||
| proxy_pass http://microcks:8080/rest/FINOS+TraderX+Position+Service/0.1.0/; | ||
| } | ||
| location /trade-service/ { | ||
| proxy_pass http://trade-service-trade-service:18092/; | ||
| } | ||
| location /trade-processor/ { | ||
| proxy_pass http://trade-processor-trade-processor:18091/; | ||
| } | ||
| location / { | ||
| proxy_pass http://web-frontend-web-frontend:18093/; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| - op: set | ||
| path: services.microcks | ||
| value: | ||
| image: quay.io/microcks/microcks-uber:latest-native | ||
| read_only: true | ||
| user: "65532" | ||
| cap_drop: ["ALL"] | ||
| ports: | ||
| - target: 8080 | ||
| published: "9090" | ||
| volumes: | ||
| - type: tmpfs | ||
| target: /tmp | ||
| tmpfs: | ||
| size: 65536 |
55 changes: 55 additions & 0 deletions
55
samples/traderx/score-provisioners/compose/10-endpoint-with-microcks.provisioners.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # Custom updates for now, will need to contribute back to the community provisioners repository later on. | ||
| - uri: template://custom-provisioners/endpoint-with-microcks | ||
| type: endpoint | ||
| description: Outputs an endpoint URL for connecting to an other workload (a Microcks mock is generated if not found). | ||
| init: | | ||
| hostname: {{ splitList "." .Id | last }} | ||
| {{ $artifacts := .Params.artifacts | splitList "," }} | ||
| {{ $parsedPath := $artifacts | first | splitList "/" }} | ||
| {{ if eq (len $parsedPath) 0 }} | ||
| resourcesPath: "." | ||
| {{ else }} | ||
| resourcesPath: {{ trimSuffix (last $parsedPath) (first $artifacts) | trimSuffix "/" }} | ||
| {{ end }} | ||
| supported_params: | ||
| - port | ||
| - artifacts | ||
| - name | ||
| - version | ||
| outputs: | | ||
| {{ $w := (index .WorkloadServices .Init.hostname) }} | ||
| {{ if or (not $w) (not $w.ServiceName) }} | ||
| url: http://localhost:9090/rest/{{ .Params.name | replace " " "+" }}/{{ .Params.version }} | ||
| {{ else }} | ||
| url: http://{{ .Init.hostname }}:{{ .Params.port }} | ||
| {{ end }} | ||
| expected_outputs: | ||
| - url | ||
| services: | | ||
| {{ $w := (index .WorkloadServices .Init.hostname) }} | ||
| {{ if or (not $w) (not $w.ServiceName) }} | ||
| {{ .Init.hostname }}-mock: | ||
| image: quay.io/microcks/microcks-cli:latest | ||
| restart: on-failure | ||
| entrypoint: | ||
| - "microcks" | ||
| - "import" | ||
| - "{{ .Params.artifacts }}" | ||
| - "--microcksURL=http://microcks:8080/api" | ||
| - "--insecure-tls" | ||
| - "--keycloakClientId=foo" | ||
| - "--keycloakClientSecret=bar" | ||
| cap_drop: | ||
| - ALL | ||
| read_only: true | ||
| user: "65532" | ||
| volumes: | ||
| - type: bind | ||
| source: {{ .Init.resourcesPath }} | ||
| target: /{{ .Init.resourcesPath }} | ||
| read_only: true | ||
| depends_on: | ||
| microcks: | ||
| condition: service_started | ||
| required: true | ||
| {{ end }} |
37 changes: 37 additions & 0 deletions
37
samples/traderx/score-provisioners/k8s/10-endpoint-with-microcks-cli.provisioners.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # Custom updates for now, will need to contribute back to the community provisioners repository later on. | ||
| - uri: cmd://bash#endpoint-with-microcks-cli | ||
| type: endpoint | ||
| description: Outputs an endpoint URL for connecting to an other workload (a Microcks mock is generated if not found). | ||
| supported_params: | ||
| - port | ||
| - artifacts | ||
| - name | ||
| - version | ||
| expected_outputs: | ||
| - url | ||
| args: | ||
| - -c | ||
| - | | ||
| STDIN=$(cat) | ||
| PARAM_PORT=$(echo $STDIN | yq eval -p json '.resource_params.port') | ||
| PARAM_NAME=$(echo $STDIN | yq eval -p json '.resource_params.name') | ||
| PARAM_VERSION=$(echo $STDIN | yq eval -p json '.resource_params.version') | ||
| PARAM_ARTIFACTS=$(echo $STDIN | yq eval -p json '.resource_params.artifacts') | ||
| SPEC_FILE="" | ||
| if [ "$PARAM_ARTIFACTS" != "" ]; then | ||
| SPEC_FILE=$(echo $STDIN | yq eval -p json '.resource_params.artifacts | split(",") | .[0]') | ||
| fi | ||
| WORKLOAD=$(echo $STDIN | yq eval -p json '.resource_id | split(".") | .[-1]') | ||
| WORKLOAD_EXISTS=$(echo $STDIN | WORKLOAD=${WORKLOAD} yq eval -p json '.workload_services | has(strenv(WORKLOAD))') | ||
| URL_HOSTNAME=${WORKLOAD}:${PARAM_PORT} | ||
| URL_SCHEME="http" | ||
| URL_PATH="" | ||
| if [ "$WORKLOAD_EXISTS" != "true" ]; then | ||
| URL_HOSTNAME="microcks.127.0.0.1.nip.io" | ||
| URL_SCHEME="https" | ||
| URL_PATH=/rest/$(cat $SPEC_FILE | yq eval '.info.title' | yq '. |= sub(" ", "+")') | ||
| set -eu -o pipefail | ||
| microcks import ${PARAM_ARTIFACTS} --microcksURL=https://${URL_HOSTNAME} --insecure-tls --keycloakClientId=foo --keycloakClientSecret=bar >&2 | ||
| fi | ||
| OUTPUTS='{"resource_outputs":{"url":"%s://%s%s"},"manifests":[]}' | ||
| printf "$OUTPUTS" "$URL_SCHEME" "$URL_HOSTNAME" "$URL_PATH" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.