Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
updated documentation, and smoke tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yradsmikham committed Apr 15, 2020
1 parent e3223b4 commit eb48dff
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/commands/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@
"defaultValue": ""
}
],
"markdown": "## Description\n\nAdd a new service into this initialized spk project repository.\n\n## Example\n\n```bash\nspk service create my-service . \\\n --display-name $app_name \\\n --helm-config-path $path_to_chart_in_repo \\\n --helm-config-git $helm_repo_url \\ # Needs to start with https and not contain user name\n --helm-config-branch master \\\n --helm-chart-access-token-variable $ENV_VAR_NAME\n```\n\n## Note\n\n- `--helm-chart-*` and `--helm-config-*` settings are mutually-exclusive. **You\n may only use one.**\n - If the git repository referenced in `--helm-config-git` is a private\n repository, you can specify an environment variable in your\n HLD-to-Materialized pipeline containing your a PAT to authenticate with via\n the `--helm-chart-access-token-variable` option.\n- `--middlewares`, `--k8s-backend-port`, `--path-prefix`,\n `--path-prefix-major-version`, and `--k8s-backend` are all used to configure\n the generated Traefik2 IngressRoutes. i.e.\n\n ```sh\n spk service create my-example-documents-service path/to/my/service \\\n --middlewares middleware \\\n --k8s-backend-port 3001 \\\n --k8s-backend docs-service \\\n --path-prefix documents \\\n --path-prefix-major-version v2\n ```\n\n will result in an IngressRoute that looks like:\n\n ```yaml\n apiVersion: traefik.containo.us/v1alpha1\n kind: IngressRoute\n metadata:\n name: my-example-documents-service-master\n spec:\n routes:\n - kind: Rule\n match: \"PathPrefix(`/v2/documents`) && Headers(`Ring`, `master`)\"\n middlewares:\n - name: my-example-documents-service-master\n - name: middlewareA\n services:\n - name: docs-service\n port: 3001\n ```\n"
"markdown": "## Description\n\nAdd a new service into this initialized spk project repository.\n\n## Example\n\n```bash\nspk service create my-service . \\\n --display-name $app_name \\\n --helm-config-path $path_to_chart_in_repo \\\n --helm-config-git $helm_repo_url \\ # Needs to start with https and not contain user name\n --helm-config-branch master \\\n --helm-chart-access-token-variable $ENV_VAR_NAME \\\n --service-build-vg $service_build_variable_group \\\n --service-build-variables $service_build_variables\n```\n\n## Note\n\n- `--helm-chart-*` and `--helm-config-*` settings are mutually-exclusive. **You\n may only use one.**\n - If the git repository referenced in `--helm-config-git` is a private\n repository, you can specify an environment variable in your\n HLD-to-Materialized pipeline containing your a PAT to authenticate with via\n the `--helm-chart-access-token-variable` option.\n- `--middlewares`, `--k8s-backend-port`, `--path-prefix`,\n `--path-prefix-major-version`, and `--k8s-backend` are all used to configure\n the generated Traefik2 IngressRoutes. i.e.\n\n ```sh\n spk service create my-example-documents-service path/to/my/service \\\n --middlewares middleware \\\n --k8s-backend-port 3001 \\\n --k8s-backend docs-service \\\n --path-prefix documents \\\n --path-prefix-major-version v2\n ```\n\n will result in an IngressRoute that looks like:\n\n ```yaml\n apiVersion: traefik.containo.us/v1alpha1\n kind: IngressRoute\n metadata:\n name: my-example-documents-service-master\n spec:\n routes:\n - kind: Rule\n match: \"PathPrefix(`/v2/documents`) && Headers(`Ring`, `master`)\"\n middlewares:\n - name: my-example-documents-service-master\n - name: middlewareA\n services:\n - name: docs-service\n port: 3001\n ```\n\n- `--service-build-vg` and `--service-build-variables` are optional arguments\n often used together to pass existing variables from an existing variable group\n as build arguments into a Dockerfile build process.\n"
},
"service get-display-name": {
"command": "get-display-name",
Expand Down
27 changes: 25 additions & 2 deletions guides/project-service-management-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ operating Kubernetes clusters with Bedrock principles.
### Setup SPK

Download the latest version of `spk` from the
[releases](https://github.com/microsoft/bedrock-cli/releases) page and add it to your
PATH.
[releases](https://github.com/microsoft/bedrock-cli/releases) page and add it to
your PATH.

To setup a local configuration:

Expand Down Expand Up @@ -266,6 +266,10 @@ below:
-g, --helm-config-git <helm-git> bedrock helm chart configuration git repository. --helm-chart-* and --helm-config-* are exclusive; you may only use one. (default: "")
-b, --helm-config-branch <helm-branch> bedrock custom helm chart configuration branch. --helm-chart-* and --helm-config-* are exclusive; you may only use one. (default: "")
-p, --helm-config-path <helm-path> bedrock custom helm chart configuration path. --helm-chart-* and --helm-config-* are exclusive; you may only use one. (default: "")
--service-build-vg <variable-group> existing azure devops variable groups
may use multiple. (default: "")
--service-build-variables <variables> existing variables from azure devops variable groups
may use multiple. (default: "")
```

As noted by the the documentation text, `helm-chart-*` and `helm-config-*` are
Expand Down Expand Up @@ -405,6 +409,25 @@ parameters to `spk service create --helm-config-git`:

`https://dev.azure.com/fabrikam/fabrikam-project/_git/fabrikam-helm-charts`

#### Passing in Variables as Dockerfile Build Arguments

If you want to pass in build arguments during the Dockerfile build process, you
can inject them using the `--service-build-vg` and `--service-build-variables`
arguments, which will take in multiple variable groups and variables,
respectively.

```
spk service create
--helm-config-git https://dev.azure.com/fabrikam/fabrikam-project/_git/fabrikam-app \
--helm-config-branch master \
--helm-path /charts/fabrikam \
--service-build-vg fabrikam-vg \
--service-build-variables FOO,BAR
```

In this example, variables `FOO` and `BAR` exist in the variable group
`fabrikam-vg`, and will be passed in as arguments in the Dockerfile.

#### Creating a Service Revision

- Create and checkout a new git branch
Expand Down
8 changes: 7 additions & 1 deletion src/commands/service/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ spk service create my-service . \
--helm-config-path $path_to_chart_in_repo \
--helm-config-git $helm_repo_url \ # Needs to start with https and not contain user name
--helm-config-branch master \
--helm-chart-access-token-variable $ENV_VAR_NAME
--helm-chart-access-token-variable $ENV_VAR_NAME \
--service-build-vg $service_build_variable_group \
--service-build-variables $service_build_variables
```

## Note
Expand Down Expand Up @@ -52,3 +54,7 @@ spk service create my-service . \
- name: docs-service
port: 3001
```
- `--service-build-vg` and `--service-build-variables` are optional arguments
often used together to pass existing variables from an existing variable group
as build arguments into a Dockerfile build process.
2 changes: 1 addition & 1 deletion tests/validations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ cd "$TEST_WORKSPACE/$mono_repo_dir"

# helm_repo_url="$AZDO_ORG_URL/$AZDO_PROJECT/_git/$helm_charts_dir"
local_repo_url="$AZDO_ORG_URL/$AZDO_PROJECT/_git/$mono_repo_dir"
spk service create $FrontEnd $FrontEnd -d $services_dir -p "chart" -g $local_repo_url -b master --service-build-vg ydawgie-vg --service-build-variables dawgie >> $TEST_WORKSPACE/log.txt
spk service create $FrontEnd $FrontEnd -d $services_dir -p "chart" -g $local_repo_url -b master --service-build-vg bedrock-cli-vg-test --service-build-variables FOO,BAR >> $TEST_WORKSPACE/log.txt
# spk service create $FrontEnd $FrontEnd -d $services_dir -p "$FrontEnd/chart" -g $helm_repo_url -b master >> $TEST_WORKSPACE/log.txt
directory_to_check="$services_full_dir/$FrontEnd"
file_we_expect=(".gitignore" "build-update-hld.yaml" "Dockerfile" )
Expand Down

0 comments on commit eb48dff

Please sign in to comment.