conf.js 8.2 KB
Newer Older
C
Christoph Held 已提交
1
// Copyright 2017 The Kubernetes Authors.
2 3 4 5 6
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
B
bryk 已提交
7
//     http://www.apache.org/licenses/LICENSE-2.0
8 9 10 11 12 13 14 15 16 17
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
 * @fileoverview Common configuration constants used in other build/test files.
 */
18
import minimist from 'minimist';
19 20 21 22 23
import path from 'path';

/**
 * Base path for all other paths.
 */
24
const basePath = path.join(__dirname, '../../');
25

B
bryk 已提交
26 27 28 29 30 31 32 33 34 35 36
/**
 * Compilation architecture configuration.
 */
const arch = {
  /**
   * Default architecture that the project is compiled to. Used for local development and testing.
   */
  default: 'amd64',
  /**
   * List of all supported architectures by this project.
   */
S
Sebastian Florek 已提交
37
  list: ['amd64', 'arm64', 'arm', 'ppc64le', 's390x'],
B
bryk 已提交
38 39
};

40 41 42 43
/**
 * Configuration for container registry to push images to.
 */
const containerRegistry = {
S
Sebastian Florek 已提交
44
  release: 'kubernetesui',
W
wxb0521 已提交
45
  /** Default to an environment variable */
S
Sebastian Florek 已提交
46
  head: 'kubernetesdashboarddev',
47 48
};

B
bryk 已提交
49 50 51 52 53 54 55
/**
 * Package version information.
 */
const version = {
  /**
   * Current release version of the project.
   */
56
  release: 'v2.0.0-rc6',
B
bryk 已提交
57
  /**
58
   * Version name of the head release of the project.
B
bryk 已提交
59
   */
60
  head: 'head',
61 62 63
  /**
   * Year of last source change of the project
   */
64
  year: '2019',
B
bryk 已提交
65 66 67 68 69
};

/**
 * Base name for the docker image.
 */
S
Sebastian Florek 已提交
70
const imageNameBase = 'dashboard';
B
bryk 已提交
71

72 73 74 75 76
/**
 * Arguments
 */
const argv = minimist(process.argv.slice(2));

77 78
/**
 * Exported configuration object with common constants used in build pipeline.
79
 */
80
export default {
L
Liu Chang 已提交
81 82 83 84 85 86
  /**
   * the expression of recording version info into src/app/backend/client/manager.go
   */
  recordVersionExpression:
      `-X github.com/kubernetes/dashboard/src/app/backend/client.Version=${version.release}`,

87 88 89 90 91
  /**
   * Configuration for container registry to push images to.
   */
  containerRegistry: containerRegistry,

92 93 94 95 96 97 98 99
  /**
   * Backend application constants.
   */
  backend: {
    /**
     * The name of the backend binary.
     */
    binaryName: 'dashboard',
B
bryk 已提交
100 101 102
    /**
     * Name of the main backend package that is used in go build command.
     */
103
    mainPackageName: 'github.com/kubernetes/dashboard/src/app/backend',
104 105 106
    /**
     * Names of all backend packages prefixed with 'test' command.
     */
107 108 109 110 111
    testCommandArgs:
        [
          'test',
          'github.com/kubernetes/dashboard/src/app/backend/...',
        ],
112
    /**
113
     * Insecure port number of the backend server. Only used during development.
114
     */
115
    devServerPort: 9090,
116 117 118 119
    /**
     * Secure port number of the backend server. Only used during development.
     */
    secureDevServerPort: 8443,
120
    /**
121 122
     * Address for the Kubernetes API server.
     */
123
    apiServerHost: 'http://localhost:8080',
124 125 126
    /**
     * Env variable with path to kubeconfig file.
     */
127
    kubeconfig: argv.kubeconfig !== undefined ? argv.kubeconfig : '',
128 129 130 131
    /**
     * Env variable for API request log level. If blank, the
     * dashboard defaults to INFO, publishing sanitized logs to STDOUT
     */
132
    apiLogLevel: argv.apiLogLevel !== undefined ? argv.apiLogLevel : '',
133 134 135
    /**
     * Setting for metrics provider. Defaults to sidecar.
     */
136
    metricsProvider: argv.metricsProvider !== undefined ? argv.metricsProvider : 'sidecar',
137
    /**
138 139
     * Address for the Heapster API server. If blank, the dashboard
     * will attempt to connect to Heapster via a service proxy.
140
     */
141 142
    heapsterServerHost: argv.heapsterServerHost !== undefined ?
        argv.heapsterServerHost :
143 144 145 146 147
        'http://localhost:8001',
    /**
     * Address for the Sidecar API server. If blank, the dashboard
     * will attempt to connect to Sidecar via a service proxy.
     */
148 149
    sidecarServerHost: argv.sidecarServerHost !== undefined ?
        argv.sidecarServerHost :
150
        'http://localhost:8000',
151 152 153
    /**
     * File containing the default x509 Certificate for HTTPS.
     */
154
    tlsCert: argv.tlsCert !== undefined ? argv.tlsCert : '',
155 156 157
    /**
     * File containing the default x509 private key matching --tlsCert.
     */
158
    tlsKey: argv.tlsKey !== undefined ? argv.tlsKey : '',
159 160 161 162 163
    /**
     * When set to true, Dashboard will automatically generate certificates used to serve HTTPS.
     * Matches dashboard
     * '--auto-generate-certificates' flag.
     */
164 165
    autoGenerateCerts: argv.autoGenerateCerts !== undefined ?
        argv.autoGenerateCerts :
166 167 168 169
        'false',
    /**
     * Directory path containing certificate files. Matches dashboard '--default-cert-dir' flag.
     */
170
    defaultCertDir: argv.defaultCertDir !== undefined ? argv.defaultCertDir : '',
171 172 173
    /**
     * System banner message. Matches dashboard '--system-banner' flag.
     */
174
    systemBanner: argv.systemBanner !== undefined ? argv.systemBanner : '',
175 176 177
    /**
     * System banner severity. Matches dashboard '--system-banner-severity' flag.
     */
178 179
    systemBannerSeverity: argv.systemBannerSeverity !== undefined ?
        argv.systemBannerSeverity :
180
        '',
181 182 183
    /**
     * Allows to override enable skip login option on the backend.
     */
184 185 186
    enableSkipButton: argv.enableSkipButton !== undefined ?
        argv.enableSkipButton :
        false,
187 188
  },

B
bryk 已提交
189 190 191 192 193
  /**
   * Project compilation architecture info.
   */
  arch: arch,

194 195 196 197
  /**
   * Deployment constants configuration.
   */
  deploy: {
B
bryk 已提交
198
    /**
B
bryk 已提交
199
     * Project version info.
B
bryk 已提交
200
     */
B
bryk 已提交
201 202
    version: version,

B
bryk 已提交
203
    /**
204 205 206 207 208 209
     * Image name base for current architecture.
     */
    imageNameBase: `${imageNameBase}-${arch.default}`,

    /**
     * Image name for the head release for current architecture.
B
bryk 已提交
210
     */
211
    headImageName: `${containerRegistry.head}/${imageNameBase}-${arch.default}:${version.head}`,
B
bryk 已提交
212 213 214 215

    /**
     * Image name for the versioned release for current architecture.
     */
216 217
    releaseImageName:
        `${containerRegistry.release}/${imageNameBase}-${arch.default}:${version.release}`,
B
bryk 已提交
218

219 220 221 222 223 224 225 226 227 228 229
    /**
     * Manifest name for the head release
     */
    headManifestName: `${containerRegistry.head}/${imageNameBase}:${version.head}`,

    /**
     * Manifest name for the versioned release
     */
    releaseManifestName:
        `${containerRegistry.release}/${imageNameBase}:${version.release}`,

B
bryk 已提交
230
    /**
231
     * Image name for the head release for all supported architecture.
B
bryk 已提交
232
     */
233 234
    headImageNames: arch.list.map(
        (arch) => `${containerRegistry.head}/${imageNameBase}-${arch}:${version.head}`),
B
bryk 已提交
235

236
    /**
B
bryk 已提交
237
     * Image name for the versioned release for all supported architecture.
238
     */
239 240
    releaseImageNames: arch.list.map(
        (arch) => `${containerRegistry.release}/${imageNameBase}-${arch}:${version.release}`),
241 242
  },

243 244 245 246
  /**
   * Frontend application constants.
   */
  frontend: {
247
    /**
248 249
     * Port number to access the dashboard UI
     */
250
    serverPort: 9090,
251 252 253
    /**
     * The name of the root Angular module, i.e., the module that bootstraps the application.
     */
254
    rootModuleName: 'kubernetesDashboard',
255 256 257
    /**
     * If defined `gulp serve` will serve on HTTPS.
     */
258
    serveHttps: argv.serveHttps !== undefined,
259 260
  },

261 262 263 264 265 266 267
  /**
   * Configuration for tests.
   */
  test: {
    /**
     * Whether to use sauce labs for running tests that require a browser.
     */
S
Sebastian Florek 已提交
268
    useSauceLabs: !!process.env.TRAVIS,
269 270
  },

271 272 273 274 275
  /**
   * Absolute paths to known directories, e.g., to source directory.
   */
  paths: {
    base: basePath,
276
    backendSrc: path.join(basePath, 'src/app/backend'),
277
    deploySrc: path.join(basePath, 'aio'),
B
bryk 已提交
278 279
    dist: path.join(basePath, 'dist', arch.default),
    distCross: arch.list.map((arch) => path.join(basePath, 'dist', arch)),
280
    distPre: path.join(basePath, '.tmp/dist'),
B
bryk 已提交
281 282 283
    distPublic: path.join(basePath, 'dist', arch.default, 'public'),
    distPublicCross: arch.list.map((arch) => path.join(basePath, 'dist', arch, 'public')),
    distRoot: path.join(basePath, 'dist'),
284
    goTools: path.join(basePath, '.tools/go'),
B
bryk 已提交
285
    prodTmp: path.join(basePath, '.tmp/prod'),
286 287
    serve: path.join(basePath, '.tmp/serve'),
    src: path.join(basePath, 'src'),
288
    tmp: path.join(basePath, '.tmp'),
B
bryk 已提交
289
  },
290
};