Skip to content

Commit 9803461

Browse files
sharvil10Tyler Titsworthsramakinteldependabot[bot]
authored
Token Authentication enabled and tested for Torchserve workflow (#306)
Signed-off-by: sharvil10 <[email protected]> Signed-off-by: Tyler Titsworth <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Tyler Titsworth <[email protected]> Co-authored-by: Srikanth Ramakrishna <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 88325df commit 9803461

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

pytorch/serving/config.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ cpu_launcher_enable=true
1212
cpu_launcher_args=--use_logical_core
1313
disable_token_authorization=true
1414
enable_model_api=true
15+
enable_envvars_config=true

workflows/charts/torchserve/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ For more information about how to use Intel Optimized TorchServe, check out the
1818
| deploy.resources.limits | object | `{"cpu":"4000m","memory":"1Gi"}` | Maximum resources per pod |
1919
| deploy.resources.requests | object | `{"cpu":"1000m","memory":"512Mi"}` | Minimum resources per pod |
2020
| deploy.storage.nfs | object | `{"enabled":false,"path":"nil","readOnly":true,"server":"nil","subPath":"nil"}` | Network File System (NFS) storage for models |
21+
| deploy.tokens_disabled | bool | `false` | Set token authentication on or off. Checkout the latest [torchserve docs](https://github.com/pytorch/serve/blob/master/docs/token_authorization_api.md) for more details. |
2122
| fullnameOverride | string | `""` | Full qualified Domain Name |
2223
| nameOverride | string | `""` | Name of the serving service |
2324
| pvc.size | string | `"1Gi"` | Size of the storage |
@@ -37,4 +38,4 @@ There are some additional steps that can be taken to prepare your service for yo
3738
- Integrate an [SSL Certificate](https://pytorch.org/serve/configuration.html#enable-ssl) in your model config file to serve models securely.
3839

3940
----------------------------------------------
40-
Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1)
41+
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)

workflows/charts/torchserve/templates/NOTES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,8 @@
1414
echo "Visit http://127.0.0.1:8080 to use your application"
1515
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
1616
{{- end }}
17+
{{- if eq false .Values.deploy.tokens_disabled }}
18+
2. Display the tokens for accessing the APIs. For more details about token authentication checkout: https://github.com/pytorch/serve/blob/master/docs/token_authorization_api.md
19+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "torchserve.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
20+
kubectl exec --namespace {{ .Release.Namespace }} $POD_NAME -- cat /home/model-server/key_file.json
21+
{{- end }}

workflows/charts/torchserve/templates/deploy.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ spec:
4747
- configMapRef:
4848
name: {{ .Values.deploy.env.configMapName }}
4949
{{- end }}
50+
env:
51+
- name: TS_DISABLE_TOKEN_AUTHORIZATION
52+
value: "{{ .Values.deploy.tokens_disabled }}"
5053
ports:
5154
- name: rest-1
5255
containerPort: 8080

workflows/charts/torchserve/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ deploy:
2323
env:
2424
configMapName: intel-proxy-config
2525
enabled: true
26+
# -- Set token authentication on or off. Checkout the latest [torchserve docs](https://github.com/pytorch/serve/blob/master/docs/token_authorization_api.md) for more details.
27+
tokens_disabled: true
2628
# -- Models to be loaded
2729
models: all
2830
# -- Model Server Configuration file location

0 commit comments

Comments
 (0)