Repository: microsoft/nni
File: ts/nni_manager/training_service/kubernetes/kubernetesApiClient.ts (TypeScript)

Code before:
            result = Promise.resolve(true);
        } else {
            result = Promise.reject(`Create secrets failed, statusCode is ${response.statusCode}`);
        }

        return result;
    }
}

/**
 * Kubernetes CRD client
 */
abstract class KubernetesCRDClient {
    protected readonly client: any;
    protected readonly log: Logger = getLogger('KubernetesCRDClient');
    protected crdSchema: any;
    protected namespace: string = 'default';

    constructor() {
        this.client = new Client1_10({config: getKubernetesConfig()});
        this.client.loadSpec();
    }

    protected abstract get operator(): any;

    public set setNamespace(namespace: string) {
        this.namespace = namespace;
    }

    public get getNamespace(): string {
        return this.namespace;
    }

    public abstract get containerName(): string;

    public get jobKind(): string {
        if (this.crdSchema
            && this.crdSchema.spec
            && this.crdSchema.spec.names
            && this.crdSchema.spec.names.kind) {
            return this.crdSchema.spec.names.kind;
        } else {
            throw new Error('KubeflowOperatorClient: getJobKind failed, kind is undefined in crd schema!');
        }
    }

    public get apiVersion(): string {
        if (this.crdSchema
            && this.crdSchema.spec
            && this.crdSchema.spec.version) {
            return this.crdSchema.spec.version;

Review comment (suggestion):
This is not how setter works. It's like following code in Python:
```python
@setNamespace.setter
def setNamespace(self, namespace):
    self.namespace = namespace

@property
def getNamespace(self):
    return self.namespace
```

Code after:
            result = Promise.resolve(true);
        } else {
            result = Promise.reject(`Create secrets failed, statusCode is ${response.statusCode}`);
        }

        return result;
    }
}

/**
 * Kubernetes CRD client
 */
abstract class KubernetesCRDClient {
    protected readonly client: any;
    protected readonly log: Logger = getLogger('KubernetesCRDClient');
    protected crdSchema: any;
    public namespace: string = 'default';

    constructor() {
        this.client = new Client1_10({config: getKubernetesConfig()});
        this.client.loadSpec();
    }

    protected abstract get operator(): any;

    public abstract get containerName(): string;

    public get jobKind(): string {
        if (this.crdSchema
            && this.crdSchema.spec
            && this.crdSchema.spec.names
            && this.crdSchema.spec.names.kind) {
            return this.crdSchema.spec.names.kind;
        } else {
            throw new Error('KubeflowOperatorClient: getJobKind failed, kind is undefined in crd schema!');
        }
    }

    public get apiVersion(): string {
        if (this.crdSchema
            && this.crdSchema.spec
            && this.crdSchema.spec.version) {
            return this.crdSchema.spec.version;
        } else {
            throw new Error('KubeflowOperatorClient: get apiVersion failed, version is undefined in crd schema!');
        }
    }

    public async createKubernetesJob(jobManifest: any): Promise<boolean> {
        let result: Promise<boolean>;
        const response: any = await this.operator.post({body: jobManifest});