Skip to content

Commit

Permalink
Add support for 1.29.1 for KindContainer (dajudge#269)
Browse files Browse the repository at this point in the history
* Add support for 1.29.1 for `KindContainer`

* Add support for kindest/node >= 1.29.0
  • Loading branch information
dajudge authored Feb 13, 2024
1 parent a332408 commit f89039b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions k8s-versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
},
{
"k8s": "1.28.0"
},
{
"k8s": "1.29.1"
}
]
},
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/com/dajudge/kindcontainer/KindContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.github.dockerjava.api.model.Bind;
import com.github.dockerjava.api.model.ContainerNetwork;
import com.github.dockerjava.api.model.Volume;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.DockerClientFactory;
Expand Down Expand Up @@ -88,11 +89,12 @@ public KindContainer(final KubernetesImageSpec<KindContainerVersion> imageSpec)
super(imageSpec.getImage());
this.version = imageSpec.getVersion();
final StringBuffer log = new StringBuffer();
final String startupMessage = getStartupMessage();
this.withStartupTimeout(ofSeconds(300))
.withLogConsumer(outputFrame -> {
if (provisioningLatch.getCount() != 0) {
log.append(outputFrame.getUtf8String());
if (log.toString().contains("Reached target Multi-User System.")) {
if (log.toString().contains(startupMessage)) {
log.append(outputFrame.getUtf8String());
provisioningLatch.countDown();
}
Expand Down Expand Up @@ -121,6 +123,13 @@ public KindContainer(final KubernetesImageSpec<KindContainerVersion> imageSpec)
.withTmpFs(TMP_FILESYSTEMS);
}

@NotNull
private String getStartupMessage() {
return version.descriptor().getMajor() >= 1 && version.descriptor().getMinor() >= 29
? "Reached target multi-user.target"
: "Reached target Multi-User System.";
}

@Override
public T withReuse(final boolean reuse) {
if (reuse) {
Expand Down

0 comments on commit f89039b

Please sign in to comment.