@codefresh-io/kube-integration 1.33.5 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,16 +3,16 @@ description: Helm Chart for Kube Integration
3
3
  name: kube-integration
4
4
  version: 1.0.0
5
5
  keywords:
6
- - codefresh
7
- - kube-integration
6
+ - codefresh
7
+ - kube-integration
8
8
  home: https://codefresh.io/
9
9
  icon: https://avatars1.githubusercontent.com/u/11412079?v=3
10
10
  sources:
11
- - https://github.com/codefresh-io/kube-integration
11
+ - https://github.com/codefresh-io/kube-integration
12
12
  maintainers:
13
13
  - name: codefresh
14
14
  url: https://codefresh-io.github.io/
15
15
  dependencies:
16
16
  - name: cf-common
17
17
  repository: oci://quay.io/codefresh/charts
18
- version: "0.23.0"
18
+ version: "0.31.0"
@@ -11,7 +11,6 @@ global:
11
11
  codefresh: codefresh # On-prem chart name (all subcharts use this name to access secrets and configmaps)
12
12
  kubeIntegrationPort: 9000
13
13
  kubeIntegrationService: kube-integration
14
- newrelicLicenseKey: ""
15
14
  postgresDatabase: ""
16
15
  postgresHostname: ""
17
16
  postgresHostnameSecretKeyRef: {}
@@ -158,6 +157,8 @@ container:
158
157
  NODE_ENV: kubernetes
159
158
  PORT: '{{ .Values.global.kubeIntegrationPort }}'
160
159
  SERVICE_NAME: '{{ include (printf "cf-common-%s.names.name" (index .Subcharts "cf-common").Chart.Version) . }}'
160
+ URI_QUERY_MAX_ITEMS: "{{ .Values.global.uriQueryMaxItems }}"
161
+ URI_QUERY_ARRAY_MAX_ITEMS: "{{ .Values.global.uriQueryArrayMaxItems }}"
161
162
 
162
163
  extraEnv:
163
164
  EVENTBUS_URI: $(RABBITMQ_PROTOCOL)://$(RABBITMQ_USERNAME):$(RABBITMQ_PASSWORD)@$(RABBITMQ_HOSTNAME)
@@ -211,8 +212,6 @@ secrets:
211
212
  RABBITMQ_USERNAME: "{{ coalesce .Values.rabbitmqUsername .Values.global.rabbitmqUsername }}"
212
213
  RABBITMQ_PROTOCOL: '{{ coalesce .Values.rabbitmqProtocol .Values.global.rabbitmqProtocol "amqp" }}'
213
214
 
214
- NEWRELIC_LICENSE_KEY: '{{ .Values.global.newrelicLicenseKey }}'
215
-
216
215
  service:
217
216
  main:
218
217
  enabled: true
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- v22.21.0
1
+ v24
package/CODEOWNERS CHANGED
@@ -1,7 +1,9 @@
1
- # These owners will be the default owners for everything in
2
- # the repo. Unless a later match takes precedence,
3
- # @global-owner1 and @global-owner2 will be requested for
4
- # review when someone opens a pull request.
5
- * yaroslav@codefresh.io yaroslav.drachenko@octopus.com denis@codefresh.io zhenya.tikhonov@octopus.com
1
+ # https://github.com/orgs/codefresh-io/teams/r-d/teams
2
+ # use teams and email addresses instead of GitHub usernames
3
+ * @codefresh-io/Codefresh_Developers
6
4
 
7
- / yaroslav@codefresh.io yaroslav.drachenko@octopus.com pavel@codefresh.io denis@codefresh.io
5
+ # team leads are responsible for the codeowners file and the migration scripts
6
+ CODEOWNERS @codefresh-io/teamleads
7
+
8
+ # helm charts for DevOps team
9
+ .deploy/ @codefresh-io/Codefresh_Developers @codefresh-io/DevOps
package/Dockerfile CHANGED
@@ -1,37 +1,27 @@
1
- FROM --platform=$BUILDPLATFORM node:22.21.1-alpine3.23
1
+ # DHI source: https://hub.docker.com/repository/docker/octopusdeploy/dhi-node/customizations/cz_1xiye92r2ry49
2
+ ARG DHI_NODE_TAG=24-debian13
3
+ ARG DHI_NODE_CUSTOMIZATION=cf-kube-integration-node24-debian-13
2
4
 
3
- ARG TARGETPLATFORM
4
- ARG TARGETARCH
5
- RUN printf "Building for TARGETPLATFORM=${TARGETPLATFORM}" \
6
- && printf ", TARGETARCH=${TARGETARCH}"
7
5
 
6
+ FROM octopusdeploy/dhi-node:${DHI_NODE_TAG}-dev AS prod-deps
8
7
  WORKDIR /kube-integration
9
-
10
- RUN apk --no-cache update && apk add --no-cache bash openssh-client curl
11
-
8
+ RUN apt update \
9
+ && apt install -y \
10
+ make \
11
+ python3 \
12
+ g++ \
13
+ git
12
14
  COPY package.json yarn.lock ./
15
+ RUN yarn install --production --frozen-lockfile
16
+ RUN mkdir /logs
13
17
 
14
- # install required binaries
15
- RUN apk add --no-cache --virtual deps make python3 g++ krb5-dev git && \
16
- rm -rf node_modules && \
17
- npm uninstall -g npm && \
18
- yarn install --production --frozen-lockfile && \
19
- yarn cache clean && \
20
- apk del deps && apk upgrade && \
21
- rm -rf /tmp/*
22
-
23
- # copy app files
24
- COPY . .
25
18
 
26
- #add codefresh user and change work directories permissions
27
- RUN adduser -D -h /home/cfu -s /bin/bash cfu && \
28
- mkdir /logs && \
29
- chgrp -R $(id -g cfu) /kube-integration /logs && \
30
- chmod -R g+rwX /kube-integration /logs
31
- USER cfu
32
-
33
- #application server
19
+ FROM octopusdeploy/dhi-node:${DHI_NODE_TAG}_${DHI_NODE_CUSTOMIZATION}@sha256:3a831f3711c6349932c94c9475157444aa1c1452879f34a5d79bcc79e1985b9e AS prod
20
+ WORKDIR /kube-integration
21
+ COPY --chown=node:node --chmod=755 --from=prod-deps /kube-integration/ /kube-integration/
22
+ COPY --chown=node:node --chmod=755 --from=prod-deps /logs/ /logs/
23
+ COPY --chown=node:node --chmod=755 --from=prod-deps /kube-integration/node_modules ./node_modules
24
+ COPY --chown=node:node --chmod=755 . .
25
+ USER node
34
26
  EXPOSE 9000
35
-
36
- # run application
37
27
  CMD ["node", "--max-http-header-size=360000", "index.js"]
package/config/index.js CHANGED
@@ -68,10 +68,6 @@ base.httpLogger = {
68
68
  format: 'dev'
69
69
  };
70
70
 
71
- base.newrelic = {
72
- license_key: process.env.NEWRELIC_LICENSE_KEY
73
- };
74
-
75
71
  base.eventbus = {
76
72
  uri: process.env.EVENTBUS_URI || 'amqp://codefresh.dev',
77
73
  reconnectInterval: process.env.EVENTBUS_INTERVAL || 5,
@@ -89,6 +85,11 @@ base.postgres = {
89
85
  base.helm = {
90
86
  maxHelmHistorySize: process.env.MAX_HELM_HISTORY_SIZE, // If set, limits history in release
91
87
  };
88
+ base.queryString = {
89
+ uriQueryMaxItems: process.env.URI_QUERY_MAX_ITEMS || 200,
90
+ uriQueryArrayMaxItems: process.env.URI_QUERY_ARRAY_MAX_ITEMS || 100
91
+ }
92
+
92
93
 
93
94
  require(`./environment/kubernetes`)(base);
94
95
 
package/infra/eventbus.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  const Promise = require('bluebird');
4
4
  const eventBus = require('@codefresh-io/eventbus');
5
- const monitor = require('@codefresh-io/cf-monitor');
6
5
  const logger = require('cf-logs').Logger("codefresh:infra:eventbus");
7
6
  const config = require('./../config');
8
7
 
@@ -53,7 +52,7 @@ class Eventbus {
53
52
  eventBus.on('error', (err) => {
54
53
  const error = new Error(`Eventbus error: ${err.stack}`);
55
54
  logger.error(error.stack);
56
- monitor.noticeError(error);
55
+ // monitor.noticeError(error); // Used earlier to report an error to New Relic
57
56
  });
58
57
 
59
58
  return deferred.promise;
@@ -93,7 +92,7 @@ class Eventbus {
93
92
  eventBus.publish(name, data)
94
93
  .catch((err) => {
95
94
  logger.error(err.stack);
96
- monitor.noticeError(err);
95
+ // monitor.noticeError(err); // Used earlier to report an error to New Relic
97
96
  })
98
97
  .done();
99
98
  }
package/infra/express.js CHANGED
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const monitor = require('@codefresh-io/cf-monitor');
4
3
  const Promise = require('bluebird');
5
4
  const express = require('express');
6
5
  const compression = require('compression');
@@ -13,6 +12,7 @@ const _ = require('lodash');
13
12
  const middlewares = require('./middleware');
14
13
  const httpInfra = require('@codefresh-io/http-infra');
15
14
  const CFError = require('cf-errors');
15
+ const qs = require('qs')
16
16
 
17
17
 
18
18
  class Express {
@@ -59,6 +59,12 @@ class Express {
59
59
  return Promise.resolve()
60
60
  .then(() => {
61
61
  const app = express();
62
+ app.set('query parser', (str) => {
63
+ return qs.parse(str, {
64
+ allowPrototypes: true,
65
+ parameterLimit: this.config.queryString.uriQueryMaxItems,
66
+ arrayLimit: this.config.queryString.uriQueryArrayMaxItems
67
+ })});
62
68
  app.use(httpInfra.newDomainMiddleware());
63
69
  app.use(cookieParser());
64
70
  app.use(compression());
@@ -136,7 +142,7 @@ class Express {
136
142
  app.use((err, req, res, next) => {
137
143
  if (err instanceof CFError) {
138
144
  if (!err.getFirstValue("recognized")) {
139
- monitor.noticeError(err);
145
+ // monitor.noticeError(err); // Used earlier to report an error to New Relic
140
146
  }
141
147
  }
142
148
  logger.error(err.stack);
package/infra/index.js CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  const logging = require('./logging');
4
4
  const config = require('../config');
5
- const monitor = require('@codefresh-io/cf-monitor');
6
- monitor.init();
7
5
  const Promise = require('bluebird'); // jshint ignore:line
8
6
  const processEvents = require('./process-events');
9
7
  const express = require('./express');
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  const _ = require('lodash');
4
- const uuidv4 = require('uuid/v4');
5
4
  const BaseBuilder = require('./../../kube-native/builder.base');
6
5
  const CFError = require('cf-errors');
7
6
 
@@ -52,7 +51,7 @@ class DeployBuilder extends BaseBuilder {
52
51
 
53
52
  _buildAnnotations() {
54
53
  this._shouldMarkAnnotations() && this.updateTemplate('spec.template.metadata.annotations', {
55
- forceRedeployUniqId: uuidv4(),
54
+ forceRedeployUniqId: globalThis.crypto.randomUUID(),
56
55
  });
57
56
  return this;
58
57
  }
@@ -176,7 +175,7 @@ class DeployBuilder extends BaseBuilder {
176
175
 
177
176
  _buildLabels() {
178
177
  this.shouldMarkWithLabels() && this.updateTemplate('spec.template.metadata.labels', {
179
- ['io.codefresh.auto-generated']: uuidv4(),
178
+ ['io.codefresh.auto-generated']: globalThis.crypto.randomUUID(),
180
179
  ['io.codefresh.generated-at']: Date.now().toString()
181
180
  });
182
181
  this.updateTemplate('metadata.labels', this._getTemplateLabels());
@@ -2,7 +2,6 @@
2
2
 
3
3
  const _ = require('lodash');
4
4
  const BaseBuilder = require('./../../kube-native/builder.base');
5
- const uuidv4 = require('uuid/v4');
6
5
 
7
6
  class ServiceBuilder extends BaseBuilder {
8
7
 
@@ -57,11 +56,11 @@ class ServiceBuilder extends BaseBuilder {
57
56
 
58
57
  _buildLabels(){
59
58
  this.shouldMarkWithLabels() && this.updateTemplate('metadata.labels', {
60
- ['io.codefresh.auto-generated']: uuidv4(),
59
+ ['io.codefresh.auto-generated']: globalThis.crypto.randomUUID(),
61
60
  ['io.codefresh.generated-at']: Date.now().toString()
62
61
  });
63
62
  return this;
64
63
  }
65
64
  }
66
65
 
67
- module.exports = ServiceBuilder;
66
+ module.exports = ServiceBuilder;
@@ -106,7 +106,6 @@ class ServiceController extends ResourсeController {
106
106
  })
107
107
  })
108
108
  .catch((err) => {
109
- // todo: report to new relic
110
109
  const analyzedStatus = this._analyzeStatus({ svc });
111
110
  return _.merge(svc.getBasicData(), { globalStatus: analyzedStatus });
112
111
  });
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.33.5",
2
+ "version": "2.0.0",
3
3
  "name": "@codefresh-io/kube-integration",
4
4
  "main": "index.js",
5
5
  "description": "",
@@ -19,7 +19,7 @@
19
19
  "url": "git+https://github.com/codefresh-io/kube-integration.git"
20
20
  },
21
21
  "engines": {
22
- "node": ">=20.18.0"
22
+ "node": "^24"
23
23
  },
24
24
  "author": "Oleg Sucharevich <olegs@codefresh.io>",
25
25
  "license": "ISC",
@@ -31,33 +31,33 @@
31
31
  "openid-client": "^4.9.0",
32
32
  "tough-cookie": "4.1.3",
33
33
  "@kubernetes/client-node": "0.22.1",
34
- "**/request/form-data": "^2.4.5"
34
+ "**/request/form-data": "^2.4.5",
35
+ "**/request/qs": "6.14.2"
35
36
  },
36
37
  "dependencies": {
37
- "@codefresh-io/cf-monitor": "0.0.30",
38
- "@codefresh-io/docker-reference": "^0.0.5",
39
- "@codefresh-io/eventbus": "2.4.0",
40
- "@codefresh-io/http-infra": "1.8.14",
41
- "bluebird": "^3.5.0",
42
- "cf-errors": "^0.1.16",
43
- "cf-logs": "^1.1.24",
44
- "compression": "^1.6.2",
45
- "cookie-parser": "^1.4.3",
38
+ "@codefresh-io/docker-reference": "^0.1.0",
39
+ "@codefresh-io/eventbus": "^2.4.0",
40
+ "@codefresh-io/http-infra": "^1.8.15",
41
+ "bluebird": "^3.7.2",
42
+ "cf-errors": "^0.1.17",
43
+ "cf-logs": "^1.1.28",
44
+ "compression": "^1.8.1",
45
+ "cookie-parser": "^1.4.7",
46
46
  "eventemitter2": "^4.1.2",
47
- "express": "^4.21.0",
47
+ "express": "^4.22.1",
48
48
  "google-protobuf": "^3.5.0",
49
49
  "js-yaml": "^3.13.1",
50
50
  "kube-config-builder": "^1.1.3",
51
51
  "kubernetes-client": "^9.0.0",
52
- "lodash": "~4.17.21",
52
+ "lodash": "^4.18.1",
53
53
  "method-override": "^2.3.9",
54
- "morgan": "^1.10.0",
54
+ "morgan": "^1.10.1",
55
55
  "nock": "^12.0.3",
56
- "nodegistry": "^1.2.5",
56
+ "nodegistry": "^1.3.1",
57
57
  "object-hash": "^1.2.0",
58
+ "qs": "^6.15.1",
58
59
  "request": "^2.88.2",
59
- "request-promise": "^4.2.6",
60
- "uuid": "^3.1.0"
60
+ "request-promise": "^4.2.6"
61
61
  },
62
62
  "devDependencies": {
63
63
  "chai": "^3.5.0",
@@ -4,18 +4,20 @@ const _ = require('lodash');
4
4
  const Promise = require('bluebird');
5
5
  const {
6
6
  registries: { GcrRegistry, EcrRegistry, StandardRegistry }
7
- } = require('nodegistry');
7
+ } = require('nodegistry');
8
+ const { getAuthenticatedEntity } = require('@codefresh-io/http-infra');
8
9
  const ResponseHandler = require('./../../../helpers/ResponseHandler');
9
10
  const BaseCrudController = require('./../../crud.base.controller');
10
11
  const globalLabels = require('./../../../../lib/labels');
11
12
  const secretLabels = require('./../../../../lib/kube-native/secret/secret.labels');
12
13
  const CFError = require('cf-errors');
13
14
 
14
- function create(options) {
15
+ async function create(options) {
15
16
  switch (options.kind) {
16
17
  case 'google':
17
18
  return new GcrRegistry(options);
18
19
  case 'amazon':
20
+ options.validateAwsRegion = await getAuthenticatedEntity().evaluateFeatureFlag('enableAwsRegionStrictValidation')
19
21
  return new EcrRegistry(options);
20
22
  case 'standard':
21
23
  return new StandardRegistry(options);
@@ -70,8 +72,8 @@ class Controller extends BaseCrudController {
70
72
  }
71
73
  return registry;
72
74
  })
73
- .then((registry) => {
74
- const manager = create(registry);
75
+ .then(async (registry) => {
76
+ const manager = await create(registry);
75
77
  return Promise.all([
76
78
  manager.getDomain(),
77
79
  manager.getCredentials(),
package/service.yaml CHANGED
@@ -1,2 +1 @@
1
- version: 1.33.5
2
-
1
+ version: 2.0.0
package/newrelic.js DELETED
@@ -1,35 +0,0 @@
1
- 'use strict';
2
-
3
- const config = require('./config');
4
-
5
-
6
- /**
7
- * New Relic agent configuration.
8
- *
9
- * See lib/config.defaults.js in the agent distribution for a more complete
10
- * description of configuration variables and their potential values.
11
- */
12
- exports.config = {
13
- /**
14
- * Array of application names.
15
- */
16
- app_name: [`${config.name}[${config.env}]`],
17
- /**
18
- * Your New Relic license key.
19
- */
20
- license_key: config.newrelic.license_key,
21
-
22
- logging: {
23
- /**
24
- * Level at which to log. 'trace' is most useful to New Relic when diagnosing
25
- * issues with the agent, 'info' and higher will impose the least overhead on
26
- * production applications.
27
- */
28
- enabled: false,
29
- level: 'info'
30
- },
31
-
32
- error_collector: {
33
- ignore_status_codes: ['400-600']
34
- }
35
- };