Unverified Commit 482cf1d0 authored by SparkSnail's avatar SparkSnail Committed by GitHub
Browse files

quick fix create secret in kubeflowTrainingService (#474)

rest api of kubernetes does not use base64 to encode chars, now use base64 to encode username and then create secret.
parent 77e3a6c7
...@@ -26,7 +26,8 @@ ...@@ -26,7 +26,8 @@
"typescript-string-operations": "^1.3.1", "typescript-string-operations": "^1.3.1",
"webhdfs":"^1.2.0", "webhdfs":"^1.2.0",
"azure-storage": "^2.10.2", "azure-storage": "^2.10.2",
"kubernetes-client": "^6.5.0" "kubernetes-client": "^6.5.0",
"js-base64": "^2.4.9"
}, },
"devDependencies": { "devDependencies": {
"@types/chai": "^4.1.4", "@types/chai": "^4.1.4",
......
...@@ -47,6 +47,7 @@ import { AzureStorageClientUtility } from './azureStorageClientUtils'; ...@@ -47,6 +47,7 @@ import { AzureStorageClientUtility } from './azureStorageClientUtils';
import { GeneralK8sClient, KubeflowOperatorClient } from './kubernetesApiClient'; import { GeneralK8sClient, KubeflowOperatorClient } from './kubernetesApiClient';
var azure = require('azure-storage'); var azure = require('azure-storage');
var base64 = require('js-base64').Base64;
/** /**
* Training Service implementation for Kubeflow * Training Service implementation for Kubeflow
...@@ -345,7 +346,7 @@ class KubeflowTrainingService implements TrainingService { ...@@ -345,7 +346,7 @@ class KubeflowTrainingService implements TrainingService {
const azureKubeflowClusterConfig: KubeflowClusterConfigAzure = const azureKubeflowClusterConfig: KubeflowClusterConfigAzure =
new KubeflowClusterConfigAzure(kubeflowClusterJsonObject.operator, new KubeflowClusterConfigAzure(kubeflowClusterJsonObject.operator,
kubeflowClusterJsonObject.apiVersion, kubeflowClusterJsonObject.apiVersion,
kubeflowClusterJsonObject.keyvault, kubeflowClusterJsonObject.keyVault,
kubeflowClusterJsonObject.azureStorage, kubeflowClusterJsonObject.storage); kubeflowClusterJsonObject.azureStorage, kubeflowClusterJsonObject.storage);
const vaultName = azureKubeflowClusterConfig.keyVault.vaultName; const vaultName = azureKubeflowClusterConfig.keyVault.vaultName;
...@@ -365,7 +366,6 @@ class KubeflowTrainingService implements TrainingService { ...@@ -365,7 +366,6 @@ class KubeflowTrainingService implements TrainingService {
await AzureStorageClientUtility.createShare(this.azureStorageClient, this.azureStorageShare); await AzureStorageClientUtility.createShare(this.azureStorageClient, this.azureStorageShare);
//create sotrage secret //create sotrage secret
this.azureStorageSecretName = 'nni-secret-' + uniqueString(8).toLowerCase(); this.azureStorageSecretName = 'nni-secret-' + uniqueString(8).toLowerCase();
await this.genericK8sClient.createSecret( await this.genericK8sClient.createSecret(
{ {
apiVersion: 'v1', apiVersion: 'v1',
...@@ -380,8 +380,8 @@ class KubeflowTrainingService implements TrainingService { ...@@ -380,8 +380,8 @@ class KubeflowTrainingService implements TrainingService {
}, },
type: 'Opaque', type: 'Opaque',
data: { data: {
azurestorageaccountname: this.azureStorageAccountName, azurestorageaccountname: base64.encode(this.azureStorageAccountName),
azurestorageaccountkey: storageAccountKey azurestorageaccountkey: base64.encode(storageAccountKey)
} }
} }
); );
......
...@@ -162,6 +162,7 @@ kubeflow_config_schema = { ...@@ -162,6 +162,7 @@ kubeflow_config_schema = {
} }
},{ },{
'operator': Or('tf-operator', 'pytorch-operator'), 'operator': Or('tf-operator', 'pytorch-operator'),
'apiVersion': str,
Optional('storage'): Or('nfs', 'azureStorage'), Optional('storage'): Or('nfs', 'azureStorage'),
'keyVault': { 'keyVault': {
'vaultName': Regex('([0-9]|[a-z]|[A-Z]|-){1,127}'), 'vaultName': Regex('([0-9]|[a-z]|[A-Z]|-){1,127}'),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment