Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
aa20f0b
control-service: secrets service integration test
Jun 20, 2023
74e375d
Google Java Format
Jun 20, 2023
25421c0
versatile-data-kit: update config.yaml template
antoniivanov Jun 20, 2023
1ccd44e
control-service: secrets service integration test
Jun 20, 2023
ff99357
Google Java Format
Jun 20, 2023
1e8ae70
Merge branch 'person/ddakov/vault-secrets-service-integration-test' o…
Jun 20, 2023
e3bae38
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 20, 2023
d694935
control-service: secrets service integration test
Jun 20, 2023
dccd5a3
control-service: secrets service integration test
Jun 21, 2023
fbae133
control-service: secrets service integration test
Jun 21, 2023
d572071
Google Java Format
Jun 21, 2023
9a95e14
control-service: multiple namespaces in testing (#2269)
murphp15 Jun 21, 2023
48ae6b8
vdk-notebook: handle job with mixed .ipynb, .py, .sql files use-cas…
duyguHsnHsn Jun 21, 2023
65c1acb
control-service: secrets service integration test
Jun 21, 2023
c18dcc2
Google Java Format
Jun 21, 2023
f2a4b60
control-service: install kubectl (#2290)
murphp15 Jun 21, 2023
47d35dd
control-service: move cron jobs methods to the data jobs class (#2291)
murphp15 Jun 21, 2023
75e736c
specs: VEP-2272 Complete Data Job Configuration Persistence (#2287)
mivanov1988 Jun 21, 2023
aef4836
control-service: fix failing pipelines (#2296)
murphp15 Jun 21, 2023
0954c5b
build(deps): Bump org.json:json from 20230227 to 20230618 in /project…
dependabot[bot] Jun 22, 2023
1c985b8
build(deps): Bump com.amazonaws:aws-java-sdk-core from 1.12.490 to 1.…
dependabot[bot] Jun 22, 2023
725d1bf
build(deps): Bump net.javacrumbs.shedlock:shedlock-spring from 5.4.0 …
dependabot[bot] Jun 22, 2023
44667b1
control-service: secrets service integration test
Jun 20, 2023
14b2274
Google Java Format
Jun 20, 2023
7c0337d
control-service: secrets service integration test
Jun 20, 2023
31b81f0
Google Java Format
Jun 20, 2023
37de719
control-service: secrets service integration test
Jun 20, 2023
e8f593c
control-service: secrets service integration test
Jun 21, 2023
c66ebf1
control-service: secrets service integration test
Jun 21, 2023
d3e3267
Google Java Format
Jun 21, 2023
7e248da
control-service: secrets service integration test
Jun 21, 2023
0aa98d2
Google Java Format
Jun 21, 2023
b9cb1e8
Merge branch 'person/ddakov/vault-secrets-service-integration-test' o…
Jun 22, 2023
59ae7d7
Google Java Format
Jun 22, 2023
2dc2dbc
control-service: secrets service integration test
Jun 22, 2023
cbd206e
control-service: secrets service integration test
Jun 22, 2023
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
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0

blank_issues_enabled: false
contact_links:
- name: "\U0001F914 All other questions, including if you're not sure what to do."
url: https://github.com/jupyterlab/jupyterlab/discussions/new?category=q-a
about: Search Github Discussions for similar questions or ask for help there.
- name: "\U0001F4AC Chat with the devs on Versatile Data Kit slack channel in CNCF slack "
url: https://communityinviter.com/apps/cloud-native/cncf
about: Ask short questions about using Versatile Data Kit
url: https://communityinviter.com/apps/cloud-native/cncf
about: Ask short questions about using Versatile Data Kit
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ dependencies { // Implementation dependencies are found on compile classpath of
testImplementation versions.'net.bytebuddy:byte-buddy'
testImplementation versions.'org.testcontainers:testcontainers'
testImplementation versions.'org.awaitility:awaitility'
testImplementation versions.'org.testcontainers:vault'
testImplementation versions.'org.testcontainers:junit-jupiter'
testImplementation 'com.github.kirviq:dumbster:1.7.1'
testImplementation versions.'org.junit.jupiter:junit-jupiter-api'
testImplementation versions.'org.junit.platform:junit-platform-suite-api'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* Copyright 2021-2023 VMware, Inc.
* SPDX-License-Identifier: Apache-2.0
*/

package com.vmware.taurus.secrets.service.vault;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.vmware.taurus.ControlplaneApplication;
import com.vmware.taurus.datajobs.it.common.BaseIT;
import com.vmware.taurus.exception.DataJobSecretsSizeLimitException;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.vault.authentication.TokenAuthentication;
import org.springframework.vault.client.VaultEndpoint;
import org.springframework.vault.core.VaultTemplate;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.vault.VaultContainer;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import static org.junit.jupiter.api.Assertions.assertThrows;

@SpringBootTest(
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
classes = ControlplaneApplication.class)
@Testcontainers
public class TestVaultJobSecretsServiceIT extends BaseIT {

@Container
private static final VaultContainer vaultContainer =
new VaultContainer<>("vault:1.0.2").withVaultToken("root");

private static VaultJobSecretsService vaultJobSecretService;

@BeforeAll
public static void init() throws URISyntaxException {
String vaultUri = vaultContainer.getHttpHostAddress();

VaultEndpoint vaultEndpoint = VaultEndpoint.from(new URI(vaultUri));
TokenAuthentication clientAuthentication = new TokenAuthentication("root");

VaultTemplate vaultTemplate = new VaultTemplate(vaultEndpoint, clientAuthentication);

vaultJobSecretService = new VaultJobSecretsService(vaultTemplate);
}

@Test
public void testGetEmptyDataJobSecrets() throws Exception {
Map<String, Object> result = vaultJobSecretService.readJobSecrets("testJob");
Assertions.assertEquals(Collections.emptyMap(), result);
}

@Test
public void testSetDataJobSecrets() throws Exception {
Map<String, Object> temp = new HashMap<>();
temp.put("key1", "value1");

Map<String, Object> secrets = Collections.unmodifiableMap(temp);

vaultJobSecretService.updateJobSecrets("testJob2", secrets);

Map<String, Object> readResult = vaultJobSecretService.readJobSecrets("testJob2");
Assertions.assertEquals(secrets, readResult);
}

@Test
void testUpdateJobSecretsLimit() throws JsonProcessingException {
Map<String, Object> temp = new HashMap<>();
temp.put("key1", "value1");

Map<String, Object> secrets = Collections.unmodifiableMap(temp);

vaultJobSecretService.updateJobSecrets("testJob2", secrets);

Map<String, Object> largeSecrets = new HashMap<>();
largeSecrets.put("key1", null);
largeSecrets.put(
"key2",
RandomStringUtils.randomAlphabetic(VaultJobSecretsService.VAULT_SIZE_LIMIT_DEFAULT));

assertThrows(
DataJobSecretsSizeLimitException.class,
() -> vaultJobSecretService.updateJobSecrets("testJob2", largeSecrets));

// check secrets were not updated
Map<String, Object> readResult = vaultJobSecretService.readJobSecrets("testJob2");
Assertions.assertEquals(secrets, readResult);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
@ConditionalOnProperty(value = "featureflag.vault.integration.enabled")
public class VaultJobSecretsService implements com.vmware.taurus.secrets.service.JobSecretsService {

private static final int VAULT_SIZE_LIMIT_DEFAULT = 1048576; // 1 MB
// package private so it can be used in tests
static final int VAULT_SIZE_LIMIT_DEFAULT = 1048576; // 1 MB
private static final String SECRET = "secret";

@Value("${datajobs.vault.size.limit.bytes}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ project.ext {
'net.javacrumbs.shedlock:shedlock-spring' : 'net.javacrumbs.shedlock:shedlock-spring:5.4.0',
'net.javacrumbs.shedlock:shedlock-provider-jdbc-template' : 'net.javacrumbs.shedlock:shedlock-provider-jdbc-template:5.4.0',
'org.testcontainers:testcontainers' : 'org.testcontainers:testcontainers:1.18.3',
'org.testcontainers:vault' : 'org.testcontainers:vault:1.18.3',
'org.testcontainers:junit-jupiter' : 'org.testcontainers:junit-jupiter:1.18.3',
'org.mock-server:mockserver-netty' : 'org.mock-server:mockserver-netty:5.15.0', //5.11.2
'org.awaitility:awaitility' : 'org.awaitility:awaitility:4.2.0',
'org.apache.commons:commons-lang3' : 'org.apache.commons:commons-lang3:3.12.0',
Expand All @@ -45,7 +47,7 @@ project.ext {
'com.amazonaws:aws-java-sdk-core' : 'com.amazonaws:aws-java-sdk-core:1.12.490',
'com.amazonaws:aws-java-sdk-sts' : 'com.amazonaws:aws-java-sdk-sts:1.12.490',
'com.amazonaws:aws-java-sdk-ecr' : 'com.amazonaws:aws-java-sdk-ecr:1.12.490',
'org.springframework.vault:spring-vault-core' : 'org.springframework.vault:spring-vault-core:3.0.2',
'org.springframework.vault:spring-vault-core' : 'org.springframework.vault:spring-vault-core:2.3.3',

// transitive dependencies version force (freeze)
// on next upgrade, revise if those still need to be set explicitly
Expand Down