Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Secret template support set type #275

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ <h3 class="header-title">{{'SECRET.CREATE_TMP' | translate}}</h3>
<section class="form-block wrap">
<div *ngIf="clusters" formArrayName="clusters" class="form-group form-group-padding">
<label class="clr-col-md-3 form-group-label-override required">{{'TITLE.CLUSTER' | translate}}</label>
<span class="warning-text" *ngIf="!clusters || clusters && clusters.length === 0">{{'SECRET.CREATE_EDIT.CLUSTER_MESSAGE' | translate}}</span>
<span class="warning-text"
*ngIf="!clusters || clusters && clusters.length === 0">{{'SECRET.CREATE_EDIT.CLUSTER_MESSAGE' | translate}}</span>
<div *ngFor="let cluster of clusters;let i=index"
style="padding-right: 15px" class="checkbox-inline"
[formGroupName]="i">
Expand All @@ -24,6 +25,42 @@ <h3 class="header-title">{{'SECRET.CREATE_TMP' | translate}}</h3>
required>
</textarea>
</div>
<div class="form-group form-group-padding">
<label class="clr-col-md-3 form-group-label-override required">
{{'TEMPLATE.TYPE' | translate}}
<a style="" role="tooltip" aria-haspopup="true" class="tooltip tooltip-lg">
<clr-icon shape="info-circle" size="24"></clr-icon>
<span class="tooltip-content">
类型说明:
Opaque: 用户自定义数据
<br>
kubernetes.io/dockerconfigjson: ~/.docker/config.json格式
<br>
kubernetes.io/dockercfg: ~/.dockercfg 格式
<br>
kubernetes.io/service-account-token: 定义 service-account
<br>
kubernetes.io/basic-auth: 定义 basic authentication
<br>
kubernetes.io/ssh-auth: 定义 SSH authetication 认证
<br>
kubernetes.io/tls: SecretTypeTLS包含有关TLS客户端或服务器机密的信息。 它主要用于Ingress资源的TLS终止,但也可以用于其他类型。
<br>
</span>
</a>
</label>
<div class="select">
<select formControlName="type" required>
<option value="Opaque" selected>Opaque</option>
<option value="kubernetes.io/dockerconfigjson">kubernetes.io/dockerconfigjson</option>
<option value="kubernetes.io/dockercfg">kubernetes.io/dockercfg</option>
<option value="kubernetes.io/service-account-token">kubernetes.io/service-account-token</option>
<option value="kubernetes.io/basic-auth">kubernetes.io/basic-auth</option>
<option value="kubernetes.io/ssh-auth">kubernetes.io/ssh-auth</option>
<option value="kubernetes.io/tls">kubernetes.io/tls</option>
</select>
</div>
</div>
<div formArrayName="datas">
<div *ngFor="let data of datas.controls; let i = index"
[formGroupName]="i">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export class CreateEditSecretTplComponent implements OnInit, AfterViewInit, OnDe
disabled = true;
}
this.currentForm = this.fb.group({
type: 'Opaque',
description: this.secretTpl.description,
datas: this.fb.array([
this.fb.group({
Expand Down Expand Up @@ -267,7 +268,7 @@ export class CreateEditSecretTplComponent implements OnInit, AfterViewInit, OnDe
}
kubeSecret.kind = 'Secret';
kubeSecret.apiVersion = 'v1';
kubeSecret.type = 'Opaque';
kubeSecret.type = formValue.type;
kubeSecret.metadata.name = this.secret.name;
kubeSecret.metadata.labels = this.buildLabels(kubeSecret.metadata.labels);
if (formValue.datas && formValue.datas.length > 0) {
Expand All @@ -294,6 +295,7 @@ export class CreateEditSecretTplComponent implements OnInit, AfterViewInit, OnDe
dataValue: Base64.decode(kubeSecret.data[key]),
}));
});
this.currentForm.setControl('type', this.fb.control(this.kubeSecret.type));
this.currentForm.setControl('datas', this.fb.array(datas));
}
}
Expand Down