This repository was archived by the owner on May 13, 2025. It is now read-only.
forked from Azure/azure-cli-extensions
-
Notifications
You must be signed in to change notification settings - Fork 17
Read SSL cert and key from files #38
Merged
jonathan-innis
merged 11 commits into
k8s-extension/public
from
liakaz/inference_read_ssl_from_file
Jun 2, 2021
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ad8603b
first sketch of the change
liakaz 5c07778
test protected config
liakaz 23c0338
fix test typo
liakaz 916691f
temporary changes reverted
liakaz 0bc89c7
fixing tests
liakaz 8caf752
fixed file paths
liakaz ae49b99
removed accidentally added file
liakaz 26e2a8e
changes according to review comments
liakaz 2b21bfd
more changes according to review comments
liakaz 47f601e
changes according to review comments
liakaz 05a6350
Merge branch 'k8s-extension/public' into liakaz/inference_read_ssl_fr…
jonathan-innis 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
2 changes: 2 additions & 0 deletions
2
src/k8s-extension/azext_k8s_extension/tests/latest/data/azure_ml/cert_and_key_encoded.txt
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,2 @@ | ||
| dGVzdGNlcnQ= | ||
| dGVzdGtleQ== |
1 change: 1 addition & 0 deletions
1
src/k8s-extension/azext_k8s_extension/tests/latest/data/azure_ml/test_cert.pem
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 @@ | ||
| testcert |
1 change: 1 addition & 0 deletions
1
src/k8s-extension/azext_k8s_extension/tests/latest/data/azure_ml/test_key.pem
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 @@ | ||
| testkey |
32 changes: 32 additions & 0 deletions
32
src/k8s-extension/azext_k8s_extension/tests/latest/test_azureml_extension.py
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,32 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| import os | ||
| import unittest | ||
|
|
||
| from azext_k8s_extension.partner_extensions.AzureMLKubernetes import AzureMLKubernetes | ||
|
|
||
|
|
||
| TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) | ||
|
|
||
|
|
||
| class TestAzureMlExtension(unittest.TestCase): | ||
|
|
||
| def test_set_up_inference_ssl(self): | ||
| azremlk8sInstance = AzureMLKubernetes() | ||
| config = {'allowInsecureConnections': 'false'} | ||
| # read and encode dummy cert and key | ||
| sslKeyPemFile = os.path.join(TEST_DIR, 'data', 'azure_ml', 'test_key.pem') | ||
| sslCertPemFile = os.path.join(TEST_DIR, 'data', 'azure_ml', 'test_cert.pem') | ||
| protected_config = {'sslKeyPemFile': sslKeyPemFile, 'sslCertPemFile': sslCertPemFile} | ||
| azremlk8sInstance._AzureMLKubernetes__set_up_inference_ssl(config, protected_config) | ||
| self.assertTrue('scoringFe.sslCert' in protected_config) | ||
| self.assertTrue('scoringFe.sslKey' in protected_config) | ||
| encoded_cert_and_key_file = os.path.join(TEST_DIR, 'data', 'azure_ml', 'cert_and_key_encoded.txt') | ||
| with open(encoded_cert_and_key_file, "rb") as text_file: | ||
| cert = text_file.readline().rstrip() | ||
| self.assertEquals(cert, protected_config['scoringFe.sslCert']) | ||
| key = text_file.readline() | ||
| self.assertEquals(key, protected_config['scoringFe.sslKey']) |
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 @@ | ||
| testcert |
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 @@ | ||
| testkey |
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
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.