Skip to content

Commit 5e48493

Browse files
authored
Merge pull request #315 from snyk/fix/revert-os-changes
fix: Revert "Merge pull request #310 from snyk/feat/include_openshift support"
2 parents 53e3a55 + 59bc47d commit 5e48493

File tree

9 files changed

+12
-156
lines changed

9 files changed

+12
-156
lines changed

.circleci/config.yml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -222,32 +222,6 @@ jobs:
222222
fi
223223
when: on_fail
224224

225-
openshift4_integration_tests:
226-
<<: *default_machine_config
227-
steps:
228-
- checkout
229-
- run:
230-
name: INTEGRATION TESTS OpenShift 4
231-
command: |
232-
export NVM_DIR="/opt/circleci/.nvm" &&
233-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" &&
234-
nvm install v10 &&
235-
npm install &&
236-
docker login --username ${DOCKERHUB_USER} --password ${DOCKERHUB_PASSWORD} &&
237-
export IMAGE_TAG=$([[ "$CIRCLE_BRANCH" == "staging" ]] && echo "staging-candidate" || echo "discardable") &&
238-
export KUBERNETES_MONITOR_IMAGE_NAME_AND_TAG=snyk/kubernetes-monitor:${IMAGE_TAG}-${CIRCLE_SHA1} &&
239-
docker pull ${KUBERNETES_MONITOR_IMAGE_NAME_AND_TAG} &&
240-
.circleci/do-exclusively --branch staging npm run test:integration:openshift4
241-
- run:
242-
name: Notify Slack on failure
243-
command: |
244-
if [[ "$CIRCLE_BRANCH" == "staging" ]]; then
245-
./scripts/slack-notify-failure.sh "staging-openshift4-integration-tests-${CIRCLE_SHA1}"
246-
else
247-
echo "Current branch is $CIRCLE_BRANCH so skipping notifying Slack"
248-
fi
249-
when: on_fail
250-
251225
######################## MERGE TO STAGING ########################
252226
tag_and_push:
253227
<<: *default_container_config
@@ -376,10 +350,6 @@ workflows:
376350
requires:
377351
- build_image
378352
<<: *staging_branch_only_filter
379-
- openshift4_integration_tests:
380-
requires:
381-
- build_image
382-
<<: *staging_branch_only_filter
383353
- package_manager_test_apk:
384354
requires:
385355
- build_image

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"test:integration": "TEST_PLATFORM=kind CREATE_CLUSTER=true tap test/integration/kubernetes.test.ts --timeout=1200",
1111
"test:integration:kind": "TEST_PLATFORM=kind CREATE_CLUSTER=true tap test/integration/kubernetes.test.ts --timeout=1200",
1212
"test:integration:eks": "TEST_PLATFORM=eks CREATE_CLUSTER=false tap test/integration/kubernetes.test.ts --timeout=1200",
13-
"test:integration:openshift4": "TEST_PLATFORM=openshift4 CREATE_CLUSTER=false tap test/integration/kubernetes.test.ts --timeout=1200",
1413
"test:coverage": "npm run test:unit -- --coverage",
1514
"test:watch": "tsc-watch --onSuccess 'npm run test:unit'",
1615
"test:apk": "TEST_PLATFORM=kind CREATE_CLUSTER=true PACKAGE_MANAGER=apk tap test/integration/package-manager.test.ts --timeout=7200",

snyk-monitor-deployment.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ spec:
5656
optional: true
5757
- name: SNYK_MONITOR_VERSION
5858
value: IMAGE_TAG_OVERRIDE_WHEN_PUBLISHING
59-
- name: HOME
60-
value: /srv/app
6159
resources:
6260
requests:
6361
cpu: '250m'

src/common/process.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export function exec(bin: string, ...processArgs: IProcessArgument[]):
1616
// For example, that process doesn't need to know secrets like our integrationId!
1717
const env = {
1818
PATH: process.env.PATH,
19-
HOME: process.env.HOME,
2019
};
2120

2221
const allArguments = processArgs.map((arg) => arg.body);

test/README.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,6 @@ This test runs whenever we commit to our `staging` branch, and at the moment may
6969

7070
Run with `npm run test:integration:eks`.
7171

72-
### OpenShift 4 ###
73-
74-
OpenShift 4 is Red Hat platform and helps us ensure we support not only the generic Kubernetes API, but also specifically OpenShift 4.
75-
76-
This test uses an existing Google Cloud Platform (GCP) account with an existing OpenShift 4 cluster, and as such has a few more prerequisites:
77-
- OpenShift 4 environment variables: `OPEN_SHIFT_4_USER_PASSWORD` and `OPEN_SHIFT_4_CLUSTER_URL` are used to authenticate against the OpenShift 4 cluster in GCP account.
78-
79-
This test runs whenever we commit to our `staging` branch, and at the moment may only run once concurrently since it uses the same cluster.
80-
81-
Run with `npm run test:integration:openshift4`.
82-
8372
### Package Managers ###
8473

8574
These tests attempt to provide some more thorough coverage for our scans of specific package manager: APK, APT and RPM.

test/helpers/deployment.ts

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import * as tap from 'tap';
22
import { V1Deployment } from '@kubernetes/client-node';
33

4-
const OPENSHIFT4 = "openshift4";
5-
const testPlatform = process.env['TEST_PLATFORM'] || 'kind';
6-
74
export function validateSecureConfiguration(test: tap, deployment: V1Deployment) {
85
if (
96
!deployment.spec ||
@@ -45,19 +42,16 @@ export function validateSecureConfiguration(test: tap, deployment: V1Deployment)
4542
tap.ok(securityContext.allowPrivilegeEscalation === false, 'must explicitly set allowPrivilegeEscalation to false');
4643
tap.ok(securityContext.privileged === false, 'must explicitly set privileged to false');
4744
tap.ok(securityContext.runAsNonRoot === true, 'must explicitly set runAsNonRoot to true');
48-
49-
if (testPlatform !== OPENSHIFT4) {
50-
tap.ok(
51-
securityContext.runAsUser !== undefined &&
52-
securityContext.runAsUser >= 10001,
53-
'must explicitly set runAsUser to be 10001 or greater',
54-
);
55-
tap.ok(
56-
securityContext.runAsGroup !== undefined &&
57-
securityContext.runAsGroup >= 10001,
58-
'must explicitly set runAsGroup to be 10001 or greater',
59-
);
60-
}
45+
tap.ok(
46+
securityContext.runAsUser !== undefined &&
47+
securityContext.runAsUser >= 10001,
48+
'must explicitly set runAsUser to be 10001 or greater',
49+
);
50+
tap.ok(
51+
securityContext.runAsGroup !== undefined &&
52+
securityContext.runAsGroup >= 10001,
53+
'must explicitly set runAsGroup to be 10001 or greater',
54+
);
6155
}
6256

6357
export function validateVolumeMounts(test: tap, deployment: V1Deployment) {

test/setup/index.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import platforms from './platforms';
66
import * as kubectl from '../helpers/kubectl';
77
import * as waiters from './waiters';
88

9-
const OPENSHIFT4 = "openshift4";
109
const testPlatform = process.env['TEST_PLATFORM'] || 'kind';
1110
const createCluster = process.env['CREATE_CLUSTER'] === 'true';
1211

@@ -28,7 +27,6 @@ function createTestYamlDeployment(
2827
integrationId: string,
2928
imageNameAndTag: string,
3029
imagePullPolicy: string,
31-
platform: string,
3230
): void {
3331
console.log('Creating test deployment...');
3432
const originalDeploymentYaml = readFileSync('./snyk-monitor-deployment.yaml', 'utf8');
@@ -55,11 +53,6 @@ function createTestYamlDeployment(
5553
value: 'https://kubernetes-upstream.dev.snyk.io',
5654
};
5755

58-
if (platform === OPENSHIFT4) {
59-
delete deployment.spec.template.spec.containers[0].securityContext.runAsUser;
60-
delete deployment.spec.template.spec.containers[0].securityContext.runAsGroup;
61-
}
62-
6356
writeFileSync(newYamlPath, stringify(deployment));
6457
console.log('Created test deployment');
6558
}
@@ -116,7 +109,6 @@ async function createSecretForGcrIoAccess(): Promise<void> {
116109
async function installKubernetesMonitor(
117110
imageNameAndTag: string,
118111
imagePullPolicy: string,
119-
platform: string,
120112
): Promise<string> {
121113
const namespace = 'snyk-monitor';
122114
await kubectl.createNamespace(namespace);
@@ -130,7 +122,7 @@ async function installKubernetesMonitor(
130122
});
131123

132124
const testYaml = 'snyk-monitor-test-deployment.yaml';
133-
createTestYamlDeployment(testYaml, integrationId, imageNameAndTag, imagePullPolicy, platform);
125+
createTestYamlDeployment(testYaml, integrationId, imageNameAndTag, imagePullPolicy);
134126

135127
await kubectl.applyK8sYaml('./snyk-monitor-cluster-permissions.yaml');
136128
await kubectl.applyK8sYaml('./snyk-monitor-test-deployment.yaml');
@@ -162,7 +154,7 @@ export async function deployMonitor(): Promise<string> {
162154
// TODO: hack, rewrite this
163155
const imagePullPolicy = testPlatform === 'kind' ? 'Never' : 'Always';
164156

165-
const integrationId = await installKubernetesMonitor(remoteImageName, imagePullPolicy, testPlatform);
157+
const integrationId = await installKubernetesMonitor(remoteImageName, imagePullPolicy);
166158
await waiters.waitForMonitorToBeReady();
167159
console.log(`Deployed the snyk-monitor with integration ID ${integrationId}`);
168160
return integrationId;

test/setup/platforms/index.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as kind from './kind';
22
import * as eks from './eks';
3-
import * as openshift4 from './openshift4';
43

54
interface IPlatformSetup {
65
// create a Kubernetes cluster
@@ -31,16 +30,7 @@ const eksSetup: IPlatformSetup = {
3130
clean: eks.clean,
3231
};
3332

34-
const openshift4Setup: IPlatformSetup = {
35-
create: openshift4.createCluster,
36-
loadImage: openshift4.loadImageInCluster,
37-
delete: openshift4.deleteCluster,
38-
config: openshift4.exportKubeConfig,
39-
clean: openshift4.clean,
40-
};
41-
4233
export default {
4334
kind: kindSetup,
4435
eks: eksSetup,
45-
openshift4: openshift4Setup,
4636
};

test/setup/platforms/openshift4.ts

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)