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

Make our types definitions typescript modules #1754

Merged
merged 3 commits into from
Oct 8, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion src/api/backup-restore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import { V1ObjectMeta } from '@kubernetes/client-node'
import { CHE_BACKUP_SERVER_CONFIG_KIND_PLURAL, CHE_CLUSTER_API_GROUP, CHE_CLUSTER_API_VERSION } from '../constants'
import { KubeHelper } from './kube'
import { V1AwsS3ServerConfig, V1CheBackupServerConfiguration, V1CheClusterBackup, V1RestServerConfig, V1SftpServerConfing } from './typings/backup-restore-crds'
import { V1AwsS3ServerConfig, V1CheBackupServerConfiguration, V1CheClusterBackup, V1RestServerConfig, V1SftpServerConfing } from './types/backup-restore-crds'

export type BackupServerType = 'rest' | 'sftp' | 's3' | ''

Expand Down
4 changes: 2 additions & 2 deletions src/api/che.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ import { OpenShiftHelper } from '../api/openshift'
import { CHE_ROOT_CA_SECRET_NAME, DEFAULT_CA_CERT_FILE_NAME, DEFAULT_CHE_OLM_PACKAGE_NAME, DEFAULT_OPENSHIFT_OPERATORS_NS_NAME, OPERATOR_TEMPLATE_DIR } from '../constants'
import { base64Decode, downloadFile } from '../util'
import { CheApiClient } from './che-api-client'
import { Devfile } from './devfile'
import { Devfile } from './types/devfile'
import { KubeHelper } from './kube'
import { OperatorGroup, Subscription } from './typings/olm'
import { OperatorGroup, Subscription } from './types/olm'

export class CheHelper {
defaultCheResponseTimeoutMs = 3000
Expand Down
12 changes: 8 additions & 4 deletions src/api/kube.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ import { Writable } from 'stream'

import { CHE_CLUSTER_API_GROUP, CHE_CLUSTER_API_VERSION, CHE_CLUSTER_BACKUP_KIND_PLURAL, CHE_CLUSTER_KIND_PLURAL, CHE_CLUSTER_RESTORE_KIND_PLURAL, DEFAULT_K8S_POD_ERROR_RECHECK_TIMEOUT, DEFAULT_K8S_POD_WAIT_TIMEOUT, OLM_STABLE_CHANNEL_NAME } from '../constants'
import { base64Encode, getClusterClientCommand, getImageNameAndTag, isKubernetesPlatformFamily, newError, safeLoadFromYamlFile } from '../util'
import { V1CheClusterBackup, V1CheClusterRestore } from './typings/backup-restore-crds'
import { V1CheClusterBackup, V1CheClusterRestore } from './types/backup-restore-crds'

import { V1Certificate } from './typings/cert-manager'
import { CatalogSource, ClusterServiceVersion, ClusterServiceVersionList, InstallPlan, OperatorGroup, PackageManifest, Subscription } from './typings/olm'
import { IdentityProvider, OAuth } from './typings/openshift'
import { V1Certificate } from './types/cert-manager'
import { CatalogSource, ClusterServiceVersion, ClusterServiceVersionList, InstallPlan, OperatorGroup, PackageManifest, Subscription } from './types/olm'
import { IdentityProvider, OAuth } from './types/openshift'
import { VersionHelper } from './version'

const AWAIT_TIMEOUT_S = 30
Expand Down Expand Up @@ -2360,6 +2360,10 @@ export class KubeHelper {
}

async createCheClusterCertificate(certificate: V1Certificate, version: string): Promise<void> {
if (!certificate.metadata || !certificate.metadata.namespace) {
mmorhun marked this conversation as resolved.
Show resolved Hide resolved
throw new Error('Expected namespace in metadata')
}

const customObjectsApi = this.kubeConfig.makeApiClient(CustomObjectsApi)

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* Red Hat, Inc. - initial API and implementation
*/

import { V1ObjectMeta } from '@kubernetes/client-node'

export interface V1Certificate {
apiVersion: string
kind: string
Expand All @@ -21,7 +23,7 @@ export interface V1CertificateSpec {
secretName: string
issuerRef: V1CertificateSpecIssuerReference
commonName: string
dnsNames: List<string>
dnsNames: string[]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure where the List comes from and if it can be replaced with Array. I suppose it should be OK as far as the build doesn't fail.

}

export interface V1CertificateSpecIssuerReference {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* Red Hat, Inc. - initial API and implementation
*/

import { V1ObjectMeta } from '@kubernetes/client-node'

export interface OAuth {
apiVersion: string;
kind: string;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/devfile/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { string } from '@oclif/parser/lib/flags'
import * as yaml from 'js-yaml'

import { ChectlContext } from '../../api/context'
import { Devfile, DevfileCommand, DevfileComponent, DevfileProject, ProjectSource, TheEndpointName } from '../../api/devfile'
import { Devfile, DevfileCommand, DevfileComponent, DevfileProject, ProjectSource, TheEndpointName } from '../../api/types/devfile'
import { KubeHelper } from '../../api/kube'
import { CHE_TELEMETRY } from '../../common-flags'
import { DEFAULT_ANALYTIC_HOOK_NAME } from '../../constants'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/server/backup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { ChectlContext } from '../../api/context'
import { KubeHelper } from '../../api/kube'
import { cheNamespace } from '../../common-flags'
import { requestBackup, BackupServerConfig, getBackupServerType } from '../../api/backup-restore'
import { V1CheClusterBackup, V1CheClusterBackupStatus } from '../../api/typings/backup-restore-crds'
import { V1CheClusterBackup, V1CheClusterBackupStatus } from '../../api/types/backup-restore-crds'
import { cli } from 'cli-ux'
import { ApiTasks } from '../../tasks/platforms/api'
import { findWorkingNamespace, getCommandSuccessMessage, notifyCommandCompletedSuccessfully, wrapCommandError } from '../../util'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/server/restore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { TASK_TITLE_CREATE_CUSTOM_CATALOG_SOURCE_FROM_FILE, TASK_TITLE_DELETE_CU
import { OperatorTasks } from '../../tasks/installers/operator'
import { checkChectlAndCheVersionCompatibility, downloadTemplates, TASK_TITLE_CREATE_CHE_CLUSTER_CRD, TASK_TITLE_PATCH_CHECLUSTER_CR } from '../../tasks/installers/common-tasks'
import { confirmYN, findWorkingNamespace, getCommandSuccessMessage, getEmbeddedTemplatesDirectory, notifyCommandCompletedSuccessfully, wrapCommandError } from '../../util'
import { V1CheBackupServerConfiguration, V1CheClusterBackup, V1CheClusterRestore, V1CheClusterRestoreStatus } from '../../api/typings/backup-restore-crds'
import { V1CheBackupServerConfiguration, V1CheClusterBackup, V1CheClusterRestore, V1CheClusterRestoreStatus } from '../../api/types/backup-restore-crds'

import { awsAccessKeyId, awsSecretAccessKey, AWS_ACCESS_KEY_ID_KEY, AWS_SECRET_ACCESS_KEY_KEY, backupRepositoryPassword, backupRepositoryUrl, backupRestServerPassword, backupRestServerUsername, backupServerConfigName, BACKUP_REPOSITORY_PASSWORD_KEY, BACKUP_REPOSITORY_URL_KEY, BACKUP_REST_SERVER_PASSWORD_KEY, BACKUP_REST_SERVER_USERNAME_KEY, BACKUP_SERVER_CONFIG_CR_NAME_KEY, getBackupServerConfiguration, sshKey, sshKeyFile, SSH_KEY_FILE_KEY, SSH_KEY_KEY } from './backup'

Expand Down
2 changes: 1 addition & 1 deletion src/tasks/component-installers/cert-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import * as path from 'path'

import { CheHelper } from '../../api/che'
import { KubeHelper } from '../../api/kube'
import { V1Certificate } from '../../api/typings/cert-manager'
import { V1Certificate } from '../../api/types/cert-manager'
import { CA_CERT_GENERATION_JOB_IMAGE, CERT_MANAGER_NAMESPACE_NAME, CHE_RELATED_COMPONENT_LABEL, CHE_ROOT_CA_SECRET_NAME, CHE_TLS_SECRET_NAME } from '../../constants'
import { base64Decode } from '../../util'
import { getMessageImportCaCertIntoBrowser } from '../installers/common-tasks'
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/installers/olm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import * as path from 'path'

import { CheHelper } from '../../api/che'
import { KubeHelper } from '../../api/kube'
import { CatalogSource, Subscription } from '../../api/typings/olm'
import { CatalogSource, Subscription } from '../../api/types/olm'
import { VersionHelper } from '../../api/version'
import { CUSTOM_CATALOG_SOURCE_NAME, CVS_PREFIX, DEFAULT_CHE_NAMESPACE, DEFAULT_CHE_OLM_PACKAGE_NAME, DEFAULT_OLM_KUBERNETES_NAMESPACE, DEFAULT_OPENSHIFT_MARKET_PLACE_NAMESPACE, DEFAULT_OPENSHIFT_OPERATORS_NS_NAME, KUBERNETES_OLM_CATALOG, NEXT_CATALOG_SOURCE_NAME, OLM_NEXT_CHANNEL_NAME, OLM_STABLE_CHANNEL_NAME, OPENSHIFT_OLM_CATALOG, OPERATOR_GROUP_NAME, OLM_STABLE_ALL_NAMESPACES_CHANNEL_NAME, DEFAULT_CHE_OPERATOR_SUBSCRIPTION_NAME } from '../../constants'
import { isKubernetesPlatformFamily } from '../../util'
Expand Down