Skip to content

Commit

Permalink
Add support for k8s 1.32 (#358)
Browse files Browse the repository at this point in the history
* Add support for k8s 1.32 to `K3sContainer` (#353)

* Add support for k8s 1.32 to `K3sContainer`

* Fix negative cert serials for test CA

* Add support for k8s 1.32 to `ApiServerContainer` (#343)

* Add support for k8s 1.32 to `KindContainer` (#337)

* Add support for k8s 1.32 to `KindContainer`

* Build on all pull requests
  • Loading branch information
dajudge authored Feb 11, 2025
1 parent 9fffee4 commit a58d2bb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
matrix:
Expand Down
9 changes: 9 additions & 0 deletions k8s-versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
},
{
"k8s": "1.31.0"
},
{
"k8s": "1.32.0"
}
]
},
Expand Down Expand Up @@ -92,6 +95,9 @@
},
{
"k8s": "1.31.0"
},
{
"k8s": "1.32.0"
}
]
},
Expand Down Expand Up @@ -140,6 +146,9 @@
},
{
"k8s": "1.31.0"
},
{
"k8s": "1.32.0"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public static X509Certificate sign(

final X509v3CertificateBuilder certGenerator = new X509v3CertificateBuilder(
new X500Name(issuerDn),
BigInteger.valueOf(SECURE_RANDOM.nextInt()),
BigInteger.valueOf(Math.abs(SECURE_RANDOM.nextInt())),
notBefore,
notAfter,
new X500Name(ownerDn),
Expand Down
13 changes: 6 additions & 7 deletions src/test/java/com/dajudge/kindcontainer/webhook/WebhookTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
import static io.fabric8.kubernetes.client.Config.fromKubeconfig;
import static java.time.Duration.ofSeconds;
import static java.util.Collections.emptyMap;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.*;
import static org.testcontainers.shaded.org.awaitility.Awaitility.await;

public class WebhookTest {
Expand Down Expand Up @@ -63,19 +62,19 @@ private static void assertObeysObjectSelector(NamespacedKubernetesClient client)
}

private static void awaitWebhooks(NamespacedKubernetesClient client) {
await().ignoreExceptions()
.timeout(ofSeconds(30))
await().timeout(ofSeconds(30))
.untilAsserted(() -> assertValidates(client.inNamespace("default")));
await().ignoreExceptions()
.timeout(ofSeconds(30))
await().timeout(ofSeconds(30))
.untilAsserted(() -> assertMutates(client.inNamespace("default")));
}

private static void assertValidates(NamespacedKubernetesClient client) {
try {
client.configMaps().create(buildConfigMap(false, true));
fail("ConfigMap should not have been accepted");
} catch (final KubernetesClientException e) {
if (e.getCode() == 400) {
if (e.getStatus().getCode() == 400) {
// This is what we expect: the validating webhook failed our request
return;
}
throw e;
Expand Down

0 comments on commit a58d2bb

Please sign in to comment.