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

Fix default timeout constants #1006

Merged
merged 1 commit into from
Nov 26, 2020
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ _See code: [src/commands/server/logs.ts](https://github.com/che-incubator/chectl

## `chectl server:start`

start Eclipse Che server
Start Eclipse Che server

```
USAGE
Expand Down
10 changes: 4 additions & 6 deletions src/api/kube.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@ import { merge } from 'lodash'
import * as net from 'net'
import { Writable } from 'stream'

import { CHE_CLUSTER_CRD, DEFAULT_CHE_IMAGE, OLM_STABLE_CHANNEL_NAME } from '../constants'
import { CHE_CLUSTER_CRD, DEFAULT_CHE_IMAGE, DEFAULT_K8S_POD_ERROR_RECHECK_TIMEOUT, DEFAULT_K8S_POD_WAIT_TIMEOUT, OLM_STABLE_CHANNEL_NAME } from '../constants'
import { getClusterClientCommand, isKubernetesPlatformFamily } from '../util'

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

const AWAIT_TIMEOUT_S = 30
export const DEFAULT_K8S_POD_TIMEOUT = 600000
export const DEFAULT_K8S_POD_ERROR_RECHECK_TIMEOUT = 15000

export class KubeHelper {
public static readonly KUBE_CONFIG = KubeHelper.initializeKubeConfig()
Expand All @@ -49,9 +47,9 @@ export class KubeHelper {
podErrorRecheckTimeout: number

constructor(flags?: any) {
this.podWaitTimeout = (flags && flags.k8spodwaittimeout) ? parseInt(flags.k8spodwaittimeout, 10) : DEFAULT_K8S_POD_TIMEOUT
this.podReadyTimeout = (flags && flags.k8spodreadytimeout) ? parseInt(flags.k8spodreadytimeout, 10) : DEFAULT_K8S_POD_TIMEOUT
this.podDownloadImageTimeout = (flags && flags.k8spoddownloadimagetimeout) ? parseInt(flags.k8spoddownloadimagetimeout, 10) : DEFAULT_K8S_POD_TIMEOUT
this.podWaitTimeout = (flags && flags.k8spodwaittimeout) ? parseInt(flags.k8spodwaittimeout, 10) : DEFAULT_K8S_POD_WAIT_TIMEOUT
this.podReadyTimeout = (flags && flags.k8spodreadytimeout) ? parseInt(flags.k8spodreadytimeout, 10) : DEFAULT_K8S_POD_WAIT_TIMEOUT
this.podDownloadImageTimeout = (flags && flags.k8spoddownloadimagetimeout) ? parseInt(flags.k8spoddownloadimagetimeout, 10) : DEFAULT_K8S_POD_WAIT_TIMEOUT
this.podErrorRecheckTimeout = (flags && flags.spoderrorrechecktimeout) ? parseInt(flags.spoderrorrechecktimeout, 10) : DEFAULT_K8S_POD_ERROR_RECHECK_TIMEOUT
}

Expand Down
9 changes: 4 additions & 5 deletions src/common-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
**********************************************************************/
import { boolean, string } from '@oclif/parser/lib/flags'

import { DEFAULT_K8S_POD_ERROR_RECHECK_TIMEOUT, DEFAULT_K8S_POD_TIMEOUT } from './api/kube'
import { DEFAULT_DEV_WORKSPACE_CONTROLLER_NAMESPACE, DOC_LINK_OBTAIN_ACCESS_TOKEN, DOC_LINK_OBTAIN_ACCESS_TOKEN_OAUTH } from './constants'
import { DEFAULT_DEV_WORKSPACE_CONTROLLER_NAMESPACE, DEFAULT_K8S_POD_ERROR_RECHECK_TIMEOUT, DEFAULT_K8S_POD_WAIT_TIMEOUT, DOC_LINK_OBTAIN_ACCESS_TOKEN, DOC_LINK_OBTAIN_ACCESS_TOKEN_OAUTH } from './constants'

export const cheNamespace = string({
char: 'n',
Expand Down Expand Up @@ -86,19 +85,19 @@ export const username = string({
export const K8SPODWAITTIMEOUT_KEY = 'k8spodwaittimeout'
export const k8sPodWaitTimeout = string({
description: 'Waiting time for Pod scheduled condition (in milliseconds)',
default: `${DEFAULT_K8S_POD_TIMEOUT}`
default: `${DEFAULT_K8S_POD_WAIT_TIMEOUT}`
})

export const K8SPODDOWNLOADIMAGETIMEOUT_KEY = 'k8spoddownloadimagetimeout'
export const k8sPodDownloadImageTimeout = string({
description: 'Waiting time for Pod downloading image (in milliseconds)',
default: `${DEFAULT_K8S_POD_TIMEOUT}`
default: `${DEFAULT_K8S_POD_WAIT_TIMEOUT}`
})

export const K8SPODREADYTIMEOUT_KEY = 'k8spodreadytimeout'
export const k8sPodReadyTimeout = string({
description: 'Waiting time for Pod Ready condition (in milliseconds)',
default: `${DEFAULT_K8S_POD_TIMEOUT}`
default: `${DEFAULT_K8S_POD_WAIT_TIMEOUT}`
})

export const K8SPODERRORRECHECKTIMEOUT_KEY = 'k8spoderrorrechecktimeout'
Expand Down
4 changes: 4 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,7 @@ export const OUTPUT_SEPARATOR = '-----------------------------------------------

// DevWorkspace
export const DEFAULT_DEV_WORKSPACE_CONTROLLER_NAMESPACE = 'devworkspace-controller'

// Timeouts
export const DEFAULT_K8S_POD_WAIT_TIMEOUT = 600000
export const DEFAULT_K8S_POD_ERROR_RECHECK_TIMEOUT = 15000
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2138,7 +2138,7 @@ ecc-jsbn@~0.1.1:

"eclipse-che@git://github.com/eclipse/che#master":
version "0.0.0"
resolved "git://github.com/eclipse/che#c1353d3d97f64583ed7e4f4fffe79771e0a746c5"
resolved "git://github.com/eclipse/che#c366ed6a88b265a49f754f99f8f21f9d3cac7e06"

editorconfig@^0.15.0:
version "0.15.3"
Expand Down