Skip to content

Commit

Permalink
bump dependencies for spring boot and fabric8
Browse files Browse the repository at this point in the history
  • Loading branch information
Björn Wenzel committed Jan 31, 2023
1 parent 14e7275 commit 82a65cd
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 56 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/maven.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,24 @@ jobs:
strategy:
matrix:
kubernetes_version:
- "kindest/node:v1.22.0@sha256:b8bda84bb3a190e6e028b1760d277454a72267a5454b57db34437c34a588d047"
- "kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6"
- "kindest/node:v1.20.7@sha256:cbeaf907fc78ac97ce7b625e4bf0de16e3ea725daf6b04f930bd14c67c671ff9"
- "kindest/node:v1.19.11@sha256:07db187ae84b4b7de440a73886f008cf903fcf5764ba8106a9fd5243d6f32729"
- "kindest/node:v1.18.19@sha256:7af1492e19b3192a79f606e43c35fb741e520d195f96399284515f077b3b622c"
- "kindest/node:v1.25.3@sha256:f52781bc0d7a19fb6c405c2af83abfeb311f130707a0e219175677e366cc45d1"
- "kindest/node:v1.24.7@sha256:577c630ce8e509131eab1aea12c022190978dd2f745aac5eb1fe65c0807eb315"
- "kindest/node:v1.23.13@sha256:ef453bb7c79f0e3caba88d2067d4196f427794086a7d0df8df4f019d5e336b61"
- "kindest/node:v1.22.15@sha256:7d9708c4b0873f0fe2e171e2b1b7f45ae89482617778c1c875f1053d4cef2e41"

steps:
- uses: actions/checkout@v1

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 11
java-version: 17
cache: 'maven'

- uses: helm/kind-action@v1.2.0
- uses: helm/kind-action@v1.4.0
with:
version: "v0.11.1"
version: "v0.17.0"
node_image: "${{ matrix.kubernetes_version }}"

- name: "Kubernetes version"
Expand Down
10 changes: 4 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.12</version>
<version>2.7.8</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>17</java.version>
<fabric8.version>6.1.1</fabric8.version>
<logback.version>1.2.8</logback.version>
<log4j2.version>2.16.0</log4j2.version>
<fabric8.version>6.4.0</fabric8.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -59,7 +57,7 @@
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>3.1.1</version>
<version>3.1.2</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -107,7 +105,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>11</release>
<release>17</release>
<fork>true</fork>
<compilerArgument>-XDignore.symbol.file</compilerArgument>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import io.fabric8.kubernetes.api.model.admission.v1.AdmissionRequest;
import io.fabric8.kubernetes.api.model.admission.v1.AdmissionResponse;
import io.fabric8.kubernetes.api.model.admission.v1.AdmissionResponseBuilder;
import io.fabric8.kubernetes.client.utils.Serialization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
Expand All @@ -25,7 +26,8 @@ public AdmissionReviewService(VaultService vaultService) {

public AdmissionResponse validate(AdmissionRequest admissionRequest) {
try {
Vault vault = (Vault) admissionRequest.getObject();
String s = Serialization.asYaml(admissionRequest.getObject());
Vault vault = Serialization.unmarshal(s, Vault.class);
vaultService.generateSecret(vault);
} catch (ClassCastException ex) {
log.error("Received Admission Request of invalid type!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,27 @@ public void shouldFailWithInvalidRequest() throws Exception {
SecretNotAccessibleException secretException = new SecretNotAccessibleException("Secret is not accessible");
Mockito.when(vaultService.generateSecret(any())).thenThrow(secretException);

mvc.perform(post("/validation/vault-crd").content("{\n" +
" \"apiVersion\": \"admission.k8s.io/v1\",\n" +
" \"kind\": \"AdmissionReview\",\n" +
" \"request\": {\n" +
" \"uid\": \"705ab4f5-6393-11e8-b7cc-42010a800002\",\n" +
" \"object\": {\n" +
" \"apiVersion\": \"koudingspawn.de/v1\",\n" +
" \"kind\": \"Vault\",\n" +
" \"metadata\": {\n" +
" \"name\": \"test-vault\",\n" +
" \"namespace\": \"default\"\n" +
" " +
"},\n" +
" \"spec\": {\n" +
" \"type\": \"KEYVALUE\",\n" +
" \"path\": \"secret/qweasd\"\n" +
" }\n" +
" }\n" +
" }\n" +
"}").contentType("application/json"))
mvc.perform(post("/validation/vault-crd").content("""
{
"apiVersion": "admission.k8s.io/v1",
"kind": "AdmissionReview",
"request": {
"uid": "705ab4f5-6393-11e8-b7cc-42010a800002",
"object": {
"apiVersion": "koudingspawn.de/v1",
"kind": "Vault",
"metadata": {
"name": "test-vault",
"namespace": "default"
},
"spec": {
"type": "KEYVALUE",
"path": "secret/qweasd"
}
}
}
}
""").contentType("application/json"))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("$.response.uid").value("705ab4f5-6393-11e8-b7cc-42010a800002"))
Expand All @@ -93,26 +94,26 @@ public void shouldReturnValidValue() throws Exception {
VaultSecret vaultSecret = new VaultSecret(new HashMap<>(), "qweasd");
Mockito.when(vaultService.generateSecret(any())).thenReturn(vaultSecret);

mvc.perform(post("/validation/vault-crd").content("{\n" +
" \"apiVersion\": \"admission.k8s.io/v1\",\n" +
" \"kind\": \"AdmissionReview\",\n" +
" \"request\": {\n" +
" \"uid\": \"705ab4f5-6393-11e8-b7cc-42010a800002\",\n" +
" \"object\": {\n" +
" \"apiVersion\": \"koudingspawn.de/v1\",\n" +
" \"kind\": \"Vault\",\n" +
" \"metadata\": {\n" +
" \"name\": \"test-vault\",\n" +
" \"namespace\": \"default\"\n" +
" " +
"},\n" +
" \"spec\": {\n" +
" \"type\": \"KEYVALUE\",\n" +
" \"path\": \"secret/qweasd\"\n" +
" }\n" +
" }\n" +
" }\n" +
"}").contentType("application/json"))
mvc.perform(post("/validation/vault-crd").content("""
{
"apiVersion": "admission.k8s.io/v1",
"kind": "AdmissionReview",
"request": {
"uid": "705ab4f5-6393-11e8-b7cc-42010a800002",
"object": {
"apiVersion": "koudingspawn.de/v1",
"kind": "Vault",
"metadata": {
"name": "test-vault",
"namespace": "default"
},
"spec": {
"type": "KEYVALUE",
"path": "secret/qweasd"
}
}
}
}""").contentType("application/json"))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("$.response.uid").value("705ab4f5-6393-11e8-b7cc-42010a800002"))
Expand Down

0 comments on commit 82a65cd

Please sign in to comment.