Skip to content

Commit

Permalink
[UI] Allow choosing Kubernetes service account
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobgy committed Apr 29, 2020
1 parent bf35380 commit f9cdac5
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
8 changes: 7 additions & 1 deletion frontend/src/apis/job/api.ts
Expand Up @@ -138,11 +138,17 @@ export interface ApiJob {
*/
pipeline_spec?: ApiPipelineSpec;
/**
* Optional input field. Specify which resource this run belongs to.
* Optional input field. Specify which resource this job belongs to.
* @type {Array<ApiResourceReference>}
* @memberof ApiJob
*/
resource_references?: Array<ApiResourceReference>;
/**
* Optional input field. Specify which Kubernetes service account this job uses.
* @type {string}
* @memberof ApiJob
*/
service_account?: string;
/**
*
* @type {string}
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/apis/run/api.ts
Expand Up @@ -346,6 +346,12 @@ export interface ApiRun {
* @memberof ApiRun
*/
resource_references?: Array<ApiResourceReference>;
/**
* Optional input field. Specify which Kubernetes service account this run uses.
* @type {string}
* @memberof ApiRun
*/
service_account?: string;
/**
* Output. The time that the run created.
* @type {Date}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/index.tsx
Expand Up @@ -60,8 +60,8 @@ ReactDOM.render(
<NamespaceContextProvider>{app}</NamespaceContextProvider>
) : (
// Uncomment the following for namespace switch during development.
// <NamespaceContext.Provider value='your-namespace'>{app}</NamespaceContext.Provider>
<NamespaceContext.Provider value={undefined}>{app}</NamespaceContext.Provider>
<NamespaceContext.Provider value='kubeflow-gongyuan'>{app}</NamespaceContext.Provider>
// <NamespaceContext.Provider value={undefined}>{app}</NamespaceContext.Provider>
),
document.getElementById('root'),
);
12 changes: 12 additions & 0 deletions frontend/src/pages/NewRun.tsx
Expand Up @@ -62,6 +62,7 @@ interface NewRunState {
errorMessage: string;
experiment?: ApiExperiment;
experimentName: string;
serviceAccount: string;
experimentSelectorOpen: boolean;
isBeingStarted: boolean;
isClone: boolean;
Expand Down Expand Up @@ -115,6 +116,7 @@ export class NewRun extends Page<{ namespace?: string }, NewRunState> {
description: '',
errorMessage: '',
experimentName: '',
serviceAccount: '',
experimentSelectorOpen: false,
isBeingStarted: false,
isClone: false,
Expand Down Expand Up @@ -175,6 +177,7 @@ export class NewRun extends Page<{ namespace?: string }, NewRunState> {
description,
errorMessage,
experimentName,
serviceAccount,
experimentSelectorOpen,
isClone,
isFirstRunInExperiment,
Expand Down Expand Up @@ -485,6 +488,14 @@ export class NewRun extends Page<{ namespace?: string }, NewRunState> {
}}
/>

<div>This run will use the following Kubernetes service account.</div>
<Input
value={serviceAccount}
onChange={this.handleChange('serviceAccount')}
label='Service Account (Optional)'
variant='outlined'
/>

{/* One-off/Recurring Run Type */}
<div className={commonCss.header}>Run Type</div>
{isClone && <span>{isRecurringRun ? 'Recurring' : 'One-off'}</span>}
Expand Down Expand Up @@ -1025,6 +1036,7 @@ export class NewRun extends Page<{ namespace?: string }, NewRunState> {
: undefined,
},
resource_references: references,
service_account: this.state.serviceAccount,
};
if (this.state.isRecurringRun) {
newRun = Object.assign(newRun, {
Expand Down

0 comments on commit f9cdac5

Please sign in to comment.