<div class="form-group row"
*ngIf="serviceForm.controls.service_type.value !== 'snmp-gateway'">
<label class="cd-col-form-label"
- [ngClass]="{'required': ['mds', 'rgw', 'nfs', 'iscsi', 'ingress'].includes(serviceForm.controls.service_type.value)}"
+ [ngClass]="{'required': ['mds', 'rgw', 'nfs', 'iscsi', 'smb', 'ingress'].includes(serviceForm.controls.service_type.value)}"
for="service_id">
<span i18n>Id</span>
<cd-helper i18n>Used in the service name which is <service_type.service_id></cd-helper>
</div>
</ng-container>
+ <!-- smb -->
+ <ng-container *ngIf="serviceForm.controls.service_type.value === 'smb'">
+ <div class="form-group row">
+ <label class="cd-col-form-label required"
+ for="cluster_id"
+ i18n>
+ Cluster id
+ <cd-helper>
+ <span>A short name identifying the SMB “cluster”. In this case a cluster is simply a management unit of one or more Samba services sharing a common configuration,
+ and may not provide actual clustering or availability mechanisms.</span>
+ </cd-helper>
+ </label>
+ <div class="cd-col-form-input">
+ <input id="cluster_id"
+ class="form-control"
+ type="text"
+ formControlName="cluster_id"
+ placeholder="foo"
+ i18n-placeholder>
+ <span class="invalid-feedback"
+ *ngIf="serviceForm.showError('cluster_id', frm, 'required')"
+ i18n>This field is required.</span>
+ </div>
+ </div>
+
+ <div class="form-group row">
+ <label class="cd-col-form-label required"
+ for="config_uri">
+ <span i18n>Config URI</span>
+ <cd-helper i18n>
+ Configuration source that should be loaded by the samba-container as the primary configuration file.
+ </cd-helper>
+ </label>
+ <div class="cd-col-form-input">
+ <input id="config_uri"
+ class="form-control"
+ type="text"
+ formControlName="config_uri"
+ placeholder="rados://.smb/foo/scc.toml"
+ i18n-placeholder>
+ <span class="invalid-feedback"
+ *ngIf="serviceForm.showError('config_uri', frm, 'required')"
+ i18n>This field is required.</span>
+ <span class="invalid-feedback"
+ *ngIf="serviceForm.showError('config_uri', frm, 'configUriPattern')"
+ i18n>The value must start with either 'http:', 'https:', 'rados:' or 'rados:mon-config-key:'</span>
+ </div>
+ </div>
+
+ <div class="form-group row"
+ formGroupName="features">
+ <label class="cd-col-form-label"
+ for="features"
+ i18n>Features
+ <cd-helper>
+ <span>Pre-defined terms enabling specific deployment characteristics.</span>
+ </cd-helper>
+ </label>
+ <div class="cd-col-form-input">
+ <div class="custom-control custom-checkbox"
+ *ngFor="let feature of smbFeaturesList">
+ <input class="custom-control-input"
+ type="checkbox"
+ name="{{feature}}"
+ id="{{feature}}"
+ formControlName="{{feature}}">
+ <label class="custom-control-label"
+ for="{{feature}}"
+ i18n>{{feature}}
+ </label>
+ </div>
+ </div>
+ </div>
+
+ <div class="form-group row">
+ <label class="cd-col-form-label"
+ for="custom_dns">
+ <span i18n>Custom DNS</span>
+ <cd-helper i18n>
+ <span>Comma separated list of DNSs.</span>
+ <br>
+ <span>A list of IP addresses that will be used as the DNS servers for a Samba container.</span>
+ </cd-helper>
+ </label>
+ <div class="cd-col-form-input">
+ <input id="custom_dns"
+ class="form-control"
+ type="text"
+ formControlName="custom_dns"
+ placeholder="192.168.76.204"
+ i18n-placeholder>
+ </div>
+ </div>
+
+ <div class="form-group row">
+ <label class="cd-col-form-label"
+ for="join_sources">
+ <span i18n>Join sources</span>
+ <cd-helper i18n>
+ <span>Comma separated list of URIs.</span>
+ <br>
+ <span>A list of values that will be used to identify where authentication data that will be used to perform domain joins are located.</span>
+ </cd-helper>
+ </label>
+ <div class="cd-col-form-input">
+ <input id="join_sources"
+ class="form-control"
+ type="text"
+ formControlName="join_sources"
+ placeholder="rados:mon-config-key:smb/config/foo/join1.json"
+ i18n-placeholder>
+ </div>
+ </div>
+
+ <div class="form-group row">
+ <label class="cd-col-form-label"
+ for="user_sources">
+ <span i18n>User sources</span>
+ <cd-helper i18n>
+ <span>Comma separated list of URIs.</span>
+ <br>
+ <span>A list of pseudo-uris containing data the samba-container can use to create users (and/or
+ groups). A ceph based samba container may typically use a rados uri
+ or a mon config-key store uri </span>
+ </cd-helper>
+ </label>
+ <div class="cd-col-form-input">
+ <input id="user_sources"
+ class="form-control"
+ type="text"
+ formControlName="user_sources"
+ placeholder="rados:mon-config-key:smb/config/foo/join2.json"
+ i18n-placeholder>
+ </div>
+ </div>
+
+ <div class="form-group row">
+ <label class="cd-col-form-label"
+ for="include_ceph_users">
+ <span i18n>Ceph users</span>
+ <cd-helper i18n>
+ <span>Comma separated list of Ceph users.</span>
+ <br>
+ <span>A list of cephx user names that the Samba Containers may use.</span>
+ </cd-helper>
+ </label>
+ <div class="cd-col-form-input">
+ <input id="include_ceph_users"
+ class="form-control"
+ type="text"
+ formControlName="include_ceph_users"
+ placeholder="client.smb.fs.cluster.foo"
+ i18n-placeholder>
+ </div>
+ </div>
+
+ </ng-container>
+
<!-- Ingress -->
<ng-container *ngIf="serviceForm.controls.service_type.value === 'ingress'">
<!-- virtual_ip -->
import { HttpParams } from '@angular/common/http';
import { Component, Input, OnInit, ViewChild } from '@angular/core';
-import { AbstractControl, Validators } from '@angular/forms';
+import { AbstractControl, UntypedFormControl, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { NgbActiveModal, NgbModalRef, NgbTypeahead } from '@ng-bootstrap/ng-bootstrap';
readonly SNMP_DESTINATION_PATTERN = /^[^\:]+:[0-9]/;
readonly SNMP_ENGINE_ID_PATTERN = /^[0-9A-Fa-f]{10,64}/g;
readonly INGRESS_SUPPORTED_SERVICE_TYPES = ['rgw', 'nfs'];
+ readonly SMB_CONFIG_URI_PATTERN = /^(http:|https:|rados:|rados:mon-config-key:)/;
@ViewChild(NgbTypeahead, { static: false })
typeahead: NgbTypeahead;
realmNames: string[];
zonegroupNames: string[];
zoneNames: string[];
+ smbFeaturesList = ['domain'];
constructor(
public actionLabels: ActionLabelsI18n,
CdValidators.requiredIf({
service_type: 'ingress'
}),
+ CdValidators.requiredIf({
+ service_type: 'smb'
+ }),
CdValidators.composeIf(
{
service_type: 'rgw'
})
]
],
+ // smb
+ cluster_id: [
+ null,
+ [
+ CdValidators.requiredIf({
+ service_type: 'smb'
+ })
+ ]
+ ],
+ features: new CdFormGroup(
+ this.smbFeaturesList.reduce((acc: object, e) => {
+ acc[e] = new UntypedFormControl(false);
+ return acc;
+ }, {})
+ ),
+ config_uri: [
+ null,
+ [
+ CdValidators.composeIf(
+ {
+ service_type: 'smb'
+ },
+ [
+ Validators.required,
+ CdValidators.custom('configUriPattern', (value: string) => {
+ if (_.isEmpty(value)) {
+ return false;
+ }
+ return !this.SMB_CONFIG_URI_PATTERN.test(value);
+ })
+ ]
+ )
+ ]
+ ],
+ custom_dns: [null],
+ join_sources: [null],
+ user_sources: [null],
+ include_ceph_users: [null],
// Ingress
backend_service: [
null,
this.serviceForm.get('ssl_key').setValue(response[0].spec?.ssl_key);
}
break;
+ case 'smb':
+ const smbSpecKeys = [
+ 'cluster_id',
+ 'config_uri',
+ 'features',
+ 'join_sources',
+ 'user_sources',
+ 'custom_dns',
+ 'include_ceph_users'
+ ];
+ smbSpecKeys.forEach((key) => {
+ if (key === 'features') {
+ if (response[0].spec?.features) {
+ response[0].spec.features.forEach((feature) => {
+ this.serviceForm.get(`features.${feature}`).setValue(true);
+ });
+ }
+ } else {
+ this.serviceForm.get(key).setValue(response[0].spec[key]);
+ }
+ });
+ break;
case 'snmp-gateway':
const snmpCommonSpecKeys = ['snmp_version', 'snmp_destination'];
snmpCommonSpecKeys.forEach((key) => {
serviceSpec['pool'] = values['pool'];
break;
+ case 'smb':
+ serviceSpec['cluster_id'] = values['cluster_id']?.trim();
+ serviceSpec['config_uri'] = values['config_uri']?.trim();
+ for (const feature in values['features']) {
+ if (values['features'][feature]) {
+ (serviceSpec['features'] = serviceSpec['features'] || []).push(feature);
+ }
+ }
+ serviceSpec['custom_dns'] = values['custom_dns']?.trim();
+ serviceSpec['join_sources'] = values['join_sources']?.trim();
+ serviceSpec['user_sources'] = values['user_sources']?.trim();
+ serviceSpec['include_ceph_users'] = values['include_ceph_users']?.trim();
+ break;
+
case 'snmp-gateway':
serviceSpec['credentials'] = {};
serviceSpec['snmp_version'] = values['snmp_version'];