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

Upgrade stork k8s quickstart #1339

Closed
Closed
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 amazon-dynamodb-quickstart/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<quarkus-amazon-services.version>2.5.0</quarkus-amazon-services.version>
<quarkus-amazon-services.version>2.5.1</quarkus-amazon-services.version>
<awssdk.testcontainers.version>1.12.57</awssdk.testcontainers.version>
</properties>

Expand Down
2 changes: 1 addition & 1 deletion amazon-kms-quickstart/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<quarkus-amazon-services.version>2.5.0</quarkus-amazon-services.version>
<quarkus-amazon-services.version>2.5.1</quarkus-amazon-services.version>
<awssdk.testcontainers.version>1.12.57</awssdk.testcontainers.version>
</properties>

Expand Down
2 changes: 1 addition & 1 deletion amazon-s3-quickstart/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<quarkus-amazon-services.version>2.5.0</quarkus-amazon-services.version>
<quarkus-amazon-services.version>2.5.1</quarkus-amazon-services.version>
</properties>

<dependencyManagement>
Expand Down
2 changes: 1 addition & 1 deletion amazon-ses-quickstart/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<quarkus-amazon-services.version>2.5.0</quarkus-amazon-services.version>
<quarkus-amazon-services.version>2.5.1</quarkus-amazon-services.version>
<awssdk.testcontainers.version>1.12.57</awssdk.testcontainers.version>
</properties>

Expand Down
2 changes: 1 addition & 1 deletion amazon-sns-quickstart/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<quarkus-amazon-services.version>2.5.0</quarkus-amazon-services.version>
<quarkus-amazon-services.version>2.5.1</quarkus-amazon-services.version>
<awssdk.testcontainers.version>1.12.57</awssdk.testcontainers.version>
</properties>

Expand Down
2 changes: 1 addition & 1 deletion amazon-sqs-quickstart/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<quarkus-amazon-services.version>2.5.0</quarkus-amazon-services.version>
<quarkus-amazon-services.version>2.5.1</quarkus-amazon-services.version>
<awssdk.testcontainers.version>1.12.57</awssdk.testcontainers.version>
</properties>

Expand Down
2 changes: 1 addition & 1 deletion amazon-ssm-quickstart/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<quarkus-amazon-services.version>2.5.0</quarkus-amazon-services.version>
<quarkus-amazon-services.version>2.5.1</quarkus-amazon-services.version>
<awssdk.testcontainers.version>1.12.57</awssdk.testcontainers.version>
</properties>

Expand Down
4 changes: 2 additions & 2 deletions mqtt-quickstart/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# Configure the MQTT sink (we write to it)
mp.messaging.outgoing.topic-price.connector=smallrye-mqtt
mp.messaging.outgoing.topic-price.topic=prices
mp.messaging.outgoing.topic-price.host=localhost
mp.messaging.outgoing.topic-price.host=${MQTT_HOST:localhost}
mp.messaging.outgoing.topic-price.port=1883
mp.messaging.outgoing.topic-price.auto-generated-client-id=true

# Configure the MQTT source (we read from it)
mp.messaging.incoming.prices.connector=smallrye-mqtt
mp.messaging.incoming.prices.topic=prices
mp.messaging.incoming.prices.host=localhost
mp.messaging.incoming.prices.host=${MQTT_HOST:localhost}
mp.messaging.incoming.prices.port=1883
mp.messaging.incoming.prices.auto-generated-client-id=true
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<module>getting-started-knative</module>
<module>getting-started-testing</module>
<module>getting-started-command-mode</module>
<module>getting-started-dev-services</module>
<module>google-cloud-functions-quickstart</module>
<module>google-cloud-functions-http-quickstart</module>
<module>hibernate-orm-quickstart</module>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@
import com.rabbitmq.client.DeliverCallback;

import org.acme.rabbitmq.model.Quote;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.junit.jupiter.api.Test;

import io.quarkus.test.junit.QuarkusTest;

@QuarkusTest
public class QuoteProcessorTest {

@ConfigProperty(name = "rabbitmq-host") String host;
@ConfigProperty(name = "rabbitmq-port") int port;
ObjectMapper objectMapper = new ObjectMapper();

@Test
Expand Down Expand Up @@ -63,8 +66,8 @@ void testProcessor() throws Exception {

Channel getChannel() throws Exception {
ConnectionFactory connectionFactory = new ConnectionFactory();
connectionFactory.setHost("localhost");
connectionFactory.setPort(5672);
connectionFactory.setHost(host);
connectionFactory.setPort(port);
connectionFactory.setUsername("guest");
connectionFactory.setPassword("guest");
connectionFactory.setChannelRpcTimeout((int) SECONDS.toMillis(3));
Expand Down
10 changes: 0 additions & 10 deletions security-jdbc-quickstart/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,6 @@
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=quarkus
quarkus.datasource.password=quarkus
quarkus.datasource.jdbc.url=jdbc:postgresql:elytron_security_jdbc
%prod.quarkus.datasource.username=quarkus
%prod.quarkus.datasource.password=quarkus
%prod.quarkus.datasource.jdbc.url=jdbc:postgresql:elytron_security_jdbc

quarkus.security.jdbc.enabled=true
quarkus.security.jdbc.principal-query.sql=SELECT u.password, u.role FROM test_user u WHERE u.username=?
quarkus.security.jdbc.principal-query.clear-password-mapper.enabled=true
quarkus.security.jdbc.principal-query.clear-password-mapper.password-index=1
quarkus.security.jdbc.principal-query.attribute-mappings.0.index=2
quarkus.security.jdbc.principal-query.attribute-mappings.0.to=groups

%test.quarkus.datasource.devservices.init-script-path=test_user.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,13 @@
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;

import com.github.dockerjava.api.model.ExposedPort;
import com.github.dockerjava.api.model.PortBinding;
import com.github.dockerjava.api.model.Ports;

import io.quarkus.test.junit.QuarkusTest;

@Testcontainers
@QuarkusTest
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class JdbcSecurityRealmTest {

@Container
public static final PostgreSQLContainer DATABASE = new PostgreSQLContainer<>()
.withDatabaseName("elytron_security_jdbc")
.withUsername("quarkus")
.withPassword("quarkus")
.withExposedPorts(5432)
.withCreateContainerCmdModifier(cmd -> cmd
.withHostName("localhost")
.withPortBindings(new PortBinding(Ports.Binding.bindPort(5432), new ExposedPort(5432))))
.withInitScript("test_user.sql");

@Test
@Order(1)
void shouldAccessPublicWhenAnonymous() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ public void testGetNameWithAdminTokenPropagated() {
.statusCode(200)
.body(is("admin"));
}

@Test
public void testGetNameWithUserTokenPropagated() {
String userToken = getAccessToken("alice");

RestAssured.given().auth().oauth2(userToken)
.when().get("/frontend/user-name-with-propagated-token")
.then()
.statusCode(200)
.body(is("alice"));

RestAssured.given().auth().oauth2(userToken)
.when().get("/frontend/admin-name-with-propagated-token")
.then()
.statusCode(403);
}

@Test
public void testGetNameWithOidcClient() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
quarkus.oidc.client-id=backend-service
quarkus.oidc.credentials.secret=secret
quarkus.keycloak.devservices.realm-path=quarkus-realm.json
quarkus.keycloak.devservices.grant.type=client

# DEBUG console logging
quarkus.log.console.enable=true
Expand All @@ -18,3 +19,6 @@ quarkus.log.file.enable=true
#quarkus.log.category."io.quarkus.smallrye.jwt".level=TRACE
#quarkus.log.category."io.undertow.request.security".level=TRACE
#quarkus.log.category."io.smallrye.jwt".level=TRACE

quarkus.log.category."io.quarkus.oidc.runtime.OidcProvider".level=TRACE
quarkus.log.category."io.quarkus.oidc.runtime.OidcProvider".min-level=TRACE
23 changes: 11 additions & 12 deletions stork-kubernetes-quickstart/kubernetes-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ metadata:
app.quarkus.io/build-timestamp: 2022-03-31 - 10:36:56 +0000
labels:
app.kubernetes.io/name: color-service
app.kubernetes.io/version: "1.0"
app.kubernetes.io/version: "2.0"
name: color-service
spec:
ports:
- name: http
port: 80
targetPort: 8080
selector:
app.kubernetes.io/version: "1.0"
app.kubernetes.io/version: "2.0"
type: color-service
type: ClusterIP
---
Expand All @@ -52,8 +52,7 @@ metadata:
app.quarkus.io/build-timestamp: 2022-03-31 - 10:46:19 +0000
labels:
app.kubernetes.io/name: color-service
app.kubernetes.io/version: "1.0"
color: blue
app.kubernetes.io/version: "2.0"
type: color-service
name: color-service
spec:
Expand All @@ -79,14 +78,14 @@ metadata:
color: blue
type: color-service
app.kubernetes.io/name: blue-service
app.kubernetes.io/version: "1.0"
app.kubernetes.io/version: "2.0"
name: blue-service
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: blue-service
app.kubernetes.io/version: "1.0"
app.kubernetes.io/version: "2.0"
template:
metadata:
annotations:
Expand All @@ -96,15 +95,15 @@ spec:
color: blue
type: color-service
app.kubernetes.io/name: blue-service
app.kubernetes.io/version: "1.0"
app.kubernetes.io/version: "2.0"
spec:
containers:
- env:
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: quay.io/quarkus/blue-service:1.0
image: quay.io/quarkus/blue-service:2.0
imagePullPolicy: Always
name: blue-service
ports:
Expand All @@ -121,14 +120,14 @@ metadata:
labels:
color: red
type: color-service
app.kubernetes.io/version: "1.0"
app.kubernetes.io/version: "2.0"
app.kubernetes.io/name: red-service
name: red-service
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/version: "1.0"
app.kubernetes.io/version: "2.0"
app.kubernetes.io/name: red-service
template:
metadata:
Expand All @@ -138,7 +137,7 @@ spec:
labels:
color: red
type: color-service
app.kubernetes.io/version: "1.0"
app.kubernetes.io/version: "2.0"
app.kubernetes.io/name: red-service
spec:
containers:
Expand All @@ -147,7 +146,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: quay.io/quarkus/red-service:1.0
image: quay.io/quarkus/red-service:2.0
imagePullPolicy: Always
name: red-service
ports:
Expand Down