fix(eks): trust Floci's served certificate in the pod identity webhook (#9231)

The Pod Identity webhook manifest carried only Floci's local CA, so with
floci.tls.cert-path set the API server refused Floci's certificate, and
failurePolicy Ignore admitted every pod unchanged. Its URL named the
Docker host: with Floci in a container that is Floci's container IP,
which Floci's own certificate does not name. An adopted cluster also
kept the manifest written when its container was created.

The caBundle is now the bundle /_floci/ca.pem serves, which moves into
ContainerCaBundle so both read it from one place. The URL uses a host
the served certificate names, through the check custom resource response
URLs already make in ContainerReachableEndpoint: Floci's hostname when
the node resolves through Floci's embedded DNS, otherwise the Docker
host. When the certificate does not name that host, the webhook is
skipped with a warning, as it is with TLS off. Adopting a surviving
cluster writes the manifest again, and names Floci's hostname only when
the surviving node was created with Floci's DNS server as its resolver.

The manifest and the webhook k3s registered from it live on the
cluster's data volume, so a skipped webhook now replaces the manifest
with one holding no objects, and k3s deletes the webhook an earlier
start registered.

The manager's constructors that left collaborators out existed only for
tests; they move to a test-side factory, so the endpoint the webhook
needs is never null in production code.

Closes #5563

Co-authored-by: Andre Kurait <AndreKurait@gmail.com>
This commit is contained in:
Priamo GermosenandAndre Kurait authored and GitHub committed 2026-11-22 20:29:39 -04:00
1 parent 6aff785875
commit 77c11493e7
13 files changed
+579 -193

No files matched your search

@@ -181,6 +181,25 @@ public final class ContainerCaBundle {
return certificates.toString();
}
/**
* The PEM a client must trust for Floci's HTTPS endpoint and the certificates Floci issues, served at
* {@code GET /_floci/ca.pem}: the local CA, {@code localCa}, alone by default. With a user-provided
* certificate the endpoint is signed by that certificate's issuer instead, so the certificates in the
* certificate file come first (never a private key it may also hold), then the local CA. A user-provided
* certificate is the one {@code TlsConfigSource} serves: TLS on, with both a certificate and a key path.
*/
public static String endpointTrustPem(EmulatorConfig config, String localCa)
throws IOException, GeneralSecurityException {
if (!config.tls().enabled() || config.tls().keyPath().filter(path -> !path.isBlank()).isEmpty()) {
return localCa;
}
Optional<String> certificate = config.tls().certPath().filter(path -> !path.isBlank());
if (certificate.isEmpty()) {
return localCa;
}
return certificatePem(Files.readString(Path.of(certificate.get()))) + localCa;
}
/** The {@code KEY=value} entries that make each runtime read {@link #CONTAINER_PATH}. */
public static List<String> env() {
return appendEnv(null);
@@ -7,6 +7,8 @@ import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import java.util.Optional;
/**
* Computes the Floci base URL reachable from <em>inside</em> a Docker container that Floci launches.
*
@@ -24,7 +26,9 @@ import org.eclipse.microprofile.config.inject.ConfigProperty;
* Lambda PUTs its result to</li>
* <li>{@code FlociDuckClient}, for the S3 endpoint the DuckDB sidecar calls</li>
* <li>{@code EksPodIdentityWebhook}, for the {@code AWS_ENDPOINT_URL} of EKS pods, through
* {@link #baseUrl(boolean)} without the embedded DNS server, which a pod cannot use</li>
* {@link #baseUrl(boolean)} without the embedded DNS server, which a pod does not always resolve through</li>
* <li>{@code EksClusterManager}, for the URL the k3s API server calls the Pod Identity admission webhook
* on, through {@link #httpsBaseUrl(boolean)}</li>
* </ul>
*
* <p>Lambda pods on Kubernetes do not use it: {@code KubernetesFlociAddressResolver} builds their
@@ -98,8 +102,17 @@ public class ContainerReachableEndpoint {
* check where http works, so that URL stays http.
*/
public String customResourceResponseBaseUrl() {
String host = host(true);
boolean https = tlsCertificates.serves(host);
return (https ? "https://" : "http://") + host + ":" + port();
return httpsBaseUrl(true).orElseGet(this::baseUrl);
}
/**
* {@link #baseUrl(boolean)} over https, when Floci serves TLS under a certificate that names its host, so
* a client that verifies the name accepts it. Empty otherwise: with TLS off, or for a host the certificate
* does not name, such as an IP from {@code docker-host-override}, the container-IP fallback, or a
* name a user-provided certificate was not issued for.
*/
public Optional<String> httpsBaseUrl(boolean useEmbeddedDns) {
String host = host(useEmbeddedDns);
return tlsCertificates.serves(host) ? Optional.of("https://" + host + ":" + port()) : Optional.empty();
}
}
@@ -22,13 +22,11 @@ import jakarta.ws.rs.core.Response;
import org.jboss.logging.Logger;
import java.io.IOException;
import java.nio.file.Files;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.TreeMap;
@Path("{prefix:(_floci|_localstack)}")
@@ -205,20 +203,7 @@ public class EmulatorInfoController {
}
private String trustBundle() throws IOException, GeneralSecurityException {
String localCa = certificateAuthority.caPem();
Optional<String> userCertificate = userCertificatePath();
if (userCertificate.isEmpty()) {
return localCa;
}
return ContainerCaBundle.certificatePem(Files.readString(java.nio.file.Path.of(userCertificate.get()))) + localCa;
}
/** Set when TLS serves a user-provided certificate, the same condition {@code TlsConfigSource} applies. */
private Optional<String> userCertificatePath() {
if (!config.tls().enabled() || config.tls().keyPath().filter(p -> !p.isBlank()).isEmpty()) {
return Optional.empty();
}
return config.tls().certPath().filter(p -> !p.isBlank());
return ContainerCaBundle.endpointTrustPem(config, certificateAuthority.caPem());
}
@POST
@@ -7,6 +7,7 @@ import com.github.dockerjava.api.command.InspectContainerResponse;
import com.github.dockerjava.api.model.Container;
import com.github.dockerjava.api.model.ContainerNetwork;
import com.github.dockerjava.api.model.Info;
import io.floci.aws.config.ContainerCaBundle;
import io.floci.aws.config.EmulatorConfig;
import io.floci.aws.config.FlociCertificateAuthority;
import io.floci.aws.core.common.AwsArnUtils;
@@ -27,6 +28,7 @@ import io.floci.aws.core.common.docker.ContainerLifecycleManager;
import io.floci.aws.core.common.docker.ContainerLifecycleManager.ContainerInfo;
import io.floci.aws.core.common.docker.ContainerLogStreamer;
import io.floci.aws.core.common.docker.ContainerNetworks;
import io.floci.aws.core.common.docker.ContainerReachableEndpoint;
import io.floci.aws.core.common.docker.ContainerSpec;
import io.floci.aws.core.common.docker.ContainerStorageHelper;
import io.floci.aws.core.common.docker.DockerHostResolver;
@@ -85,6 +87,7 @@ import java.nio.file.attribute.PosixFilePermissions;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
import java.util.Comparator;
import java.util.LinkedHashMap;
@@ -105,6 +108,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.function.BiFunction;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -150,6 +154,11 @@ public class EksClusterManager
static final String CONTAINERD_CERTS_LINK = "etc/containerd/certs.d";
static final String POD_IDENTITY_MANIFEST_FILE = "floci-eks-pod-identity.yaml";
static final String POD_IDENTITY_MANIFEST_TAR_ENTRY = "server/manifests/" + POD_IDENTITY_MANIFEST_FILE;
// The manifest while Floci registers no pod identity webhook: no objects, so k3s deletes what it held before.
static final String POD_IDENTITY_MANIFEST_REMOVED = """
# Floci registers no EKS Pod Identity webhook for this cluster now; its log says why.
# k3s deletes the MutatingWebhookConfiguration an earlier version of this file created.
""";
private static final String ENDPOINT_MODE_NETWORK = "network";
public static final String DEFAULT_POD_CIDR = "10.42.0.0/16";
@@ -191,6 +200,7 @@ public class EksClusterManager
private final Ec2MetadataServer metadataServer;
private final EksOidcService oidcService;
private final FlociCertificateAuthority certificateAuthority;
private final ContainerReachableEndpoint reachableEndpoint;
private final ContainerLogStreamer logStreamer;
private final Ec2ImageCatalog imageCatalog;
private final Ec2InstanceTypeCatalog instanceTypeCatalog = new Ec2InstanceTypeCatalog();
@@ -497,133 +507,6 @@ public class EksClusterManager
entry -> clusterResourceName.equals(entry.getValue().clusterResourceName()));
}
public EksClusterManager(ContainerBuilder containerBuilder,
ContainerLifecycleManager lifecycleManager,
ContainerDetector containerDetector,
PortAllocator portAllocator,
DockerHostResolver dockerHostResolver,
EcrRegistryManager ecrRegistryManager,
EmulatorConfig config,
RegionResolver regionResolver) {
this(containerBuilder, lifecycleManager, containerDetector, portAllocator,
dockerHostResolver, ecrRegistryManager, config, regionResolver, null, null, null, null);
}
public EksClusterManager(ContainerBuilder containerBuilder,
ContainerLifecycleManager lifecycleManager,
ContainerDetector containerDetector,
PortAllocator portAllocator,
DockerHostResolver dockerHostResolver,
EcrRegistryManager ecrRegistryManager,
EmulatorConfig config,
RegionResolver regionResolver,
Ec2MetadataServer metadataServer) {
this(containerBuilder, lifecycleManager, containerDetector, portAllocator,
dockerHostResolver, ecrRegistryManager, config, regionResolver, metadataServer, null, null, null);
}
public EksClusterManager(ContainerBuilder containerBuilder,
ContainerLifecycleManager lifecycleManager,
ContainerDetector containerDetector,
PortAllocator portAllocator,
DockerHostResolver dockerHostResolver,
EcrRegistryManager ecrRegistryManager,
EmulatorConfig config,
RegionResolver regionResolver,
Ec2MetadataServer metadataServer,
EksOidcService oidcService) {
this(containerBuilder, lifecycleManager, containerDetector, portAllocator,
dockerHostResolver, ecrRegistryManager, config, regionResolver, metadataServer, oidcService, null, null);
}
public EksClusterManager(ContainerBuilder containerBuilder,
ContainerLifecycleManager lifecycleManager,
ContainerDetector containerDetector,
PortAllocator portAllocator,
DockerHostResolver dockerHostResolver,
EcrRegistryManager ecrRegistryManager,
EmulatorConfig config,
RegionResolver regionResolver,
Ec2MetadataServer metadataServer,
EksOidcService oidcService,
FlociCertificateAuthority certificateAuthority) {
this(containerBuilder, lifecycleManager, containerDetector, portAllocator,
dockerHostResolver, ecrRegistryManager, config, regionResolver, metadataServer, oidcService,
certificateAuthority, null);
}
public EksClusterManager(ContainerBuilder containerBuilder,
ContainerLifecycleManager lifecycleManager,
ContainerDetector containerDetector,
PortAllocator portAllocator,
DockerHostResolver dockerHostResolver,
EcrRegistryManager ecrRegistryManager,
EmulatorConfig config,
RegionResolver regionResolver,
Ec2MetadataServer metadataServer,
EksOidcService oidcService,
ContainerLogStreamer logStreamer) {
this(containerBuilder, lifecycleManager, containerDetector, portAllocator,
dockerHostResolver, ecrRegistryManager, config, regionResolver, metadataServer, oidcService,
null, logStreamer);
}
public EksClusterManager(ContainerBuilder containerBuilder,
ContainerLifecycleManager lifecycleManager,
ContainerDetector containerDetector,
PortAllocator portAllocator,
DockerHostResolver dockerHostResolver,
EcrRegistryManager ecrRegistryManager,
EmulatorConfig config,
RegionResolver regionResolver,
Ec2MetadataServer metadataServer,
EksOidcService oidcService,
FlociCertificateAuthority certificateAuthority,
ContainerLogStreamer logStreamer) {
this(containerBuilder, lifecycleManager, containerDetector, portAllocator,
dockerHostResolver, ecrRegistryManager, config, regionResolver, metadataServer,
oidcService, certificateAuthority, logStreamer, (StorageBackend<String, Nodegroup>) null);
}
public EksClusterManager(ContainerBuilder containerBuilder,
ContainerLifecycleManager lifecycleManager,
ContainerDetector containerDetector,
PortAllocator portAllocator,
DockerHostResolver dockerHostResolver,
EcrRegistryManager ecrRegistryManager,
EmulatorConfig config,
RegionResolver regionResolver,
Ec2MetadataServer metadataServer,
EksOidcService oidcService,
FlociCertificateAuthority certificateAuthority,
ContainerLogStreamer logStreamer,
StorageBackend<String, Nodegroup> nodeGroupStorage) {
this(containerBuilder, lifecycleManager, containerDetector, portAllocator,
dockerHostResolver, ecrRegistryManager, config, regionResolver, metadataServer,
oidcService, certificateAuthority, logStreamer, nodeGroupStorage,
RetryingTarCopier.DEFAULT_BACKOFF_MS);
}
EksClusterManager(ContainerBuilder containerBuilder,
ContainerLifecycleManager lifecycleManager,
ContainerDetector containerDetector,
PortAllocator portAllocator,
DockerHostResolver dockerHostResolver,
EcrRegistryManager ecrRegistryManager,
EmulatorConfig config,
RegionResolver regionResolver,
Ec2MetadataServer metadataServer,
EksOidcService oidcService,
FlociCertificateAuthority certificateAuthority,
ContainerLogStreamer logStreamer,
StorageBackend<String, Nodegroup> nodeGroupStorage,
long archiveRetryBackoffMillis) {
this(containerBuilder, lifecycleManager, containerDetector, portAllocator,
dockerHostResolver, ecrRegistryManager, config, regionResolver, metadataServer,
oidcService, certificateAuthority, logStreamer, nodeGroupStorage,
archiveRetryBackoffMillis, new Ec2ImageCatalog());
}
EksClusterManager(ContainerBuilder containerBuilder,
ContainerLifecycleManager lifecycleManager,
ContainerDetector containerDetector,
@@ -638,7 +521,8 @@ public class EksClusterManager
ContainerLogStreamer logStreamer,
StorageBackend<String, Nodegroup> nodeGroupStorage,
long archiveRetryBackoffMillis,
Ec2ImageCatalog imageCatalog) {
Ec2ImageCatalog imageCatalog,
ContainerReachableEndpoint reachableEndpoint) {
this.containerBuilder = containerBuilder;
this.lifecycleManager = lifecycleManager;
this.containerDetector = containerDetector;
@@ -654,6 +538,7 @@ public class EksClusterManager
this.nodeGroupStorage = nodeGroupStorage;
this.archiveRetryBackoffMillis = archiveRetryBackoffMillis;
this.imageCatalog = imageCatalog;
this.reachableEndpoint = reachableEndpoint;
}
@Inject
@@ -670,14 +555,15 @@ public class EksClusterManager
FlociCertificateAuthority certificateAuthority,
ContainerLogStreamer logStreamer,
StorageFactory storageFactory,
Ec2ImageCatalog imageCatalog) {
Ec2ImageCatalog imageCatalog,
ContainerReachableEndpoint reachableEndpoint) {
this(containerBuilder, lifecycleManager, containerDetector, portAllocator,
dockerHostResolver, ecrRegistryManager, config, regionResolver, metadataServer,
oidcService, certificateAuthority, logStreamer,
storageFactory != null
? storageFactory.create("eks", "eks-nodegroups.json",
new TypeReference<Map<String, Nodegroup>>() {})
: null, RetryingTarCopier.DEFAULT_BACKOFF_MS, imageCatalog);
: null, RetryingTarCopier.DEFAULT_BACKOFF_MS, imageCatalog, reachableEndpoint);
}
/**
@@ -1190,6 +1076,9 @@ public class EksClusterManager
acquireClusterVpcLease(cluster, resolveClusterAccountId(cluster), clusterRegion(cluster), false);
}
recordClusterNodeInstance(cluster, info.containerId());
// The manifest written at creation names the address and certificate Floci had then.
registerPodIdentityWebhook(info.containerId(), cluster,
() -> survivingNodeResolvesThroughFloci(info.containerId()));
activeClusters.put(clusterResourceName(cluster), cluster);
attachClusterLogs(cluster, true, true, false);
@@ -2061,12 +1950,21 @@ public class EksClusterManager
* so one of them would answer some lookups of Floci's names. Floci forwards every other name itself.
*/
private String podResolvConf(List<String> callerArgs) {
if (!config.services().eks().embeddedDns() || EksClusterArgs.setsKubeletResolvConf(callerArgs)) {
if (EksClusterArgs.setsKubeletResolvConf(callerArgs)) {
return null;
}
return containerBuilder.embeddedDnsServerIpReachableOn(config.services().eks().dockerNetwork())
.map(dnsServerIp -> "nameserver " + dnsServerIp + "\n")
.orElse(null);
return nodeDnsServerIp().map(dnsServerIp -> "nameserver " + dnsServerIp + "\n").orElse(null);
}
/**
* Floci's embedded DNS server, when the cluster's node resolves through it: embedded DNS is on for EKS, so
* the node gets it as its resolver, and the server is running and reachable from the cluster's Docker network.
*/
private Optional<String> nodeDnsServerIp() {
if (!config.services().eks().embeddedDns()) {
return Optional.empty();
}
return containerBuilder.embeddedDnsServerIpReachableOn(config.services().eks().dockerNetwork());
}
/**
@@ -2704,10 +2602,27 @@ public class EksClusterManager
*
* <p>Kubernetes requires an {@code https} {@code clientConfig.url} and a {@code caBundle} it
* trusts, neither of which Floci can offer with TLS off, so the webhook is skipped with a
* warning in that case. A failure here leaves the cluster running without pod identity
* injection, matching the token webhook and the ECR mirror.
* warning in that case. The API server also checks that Floci's certificate names the URL's
* host, so the URL uses Floci's hostname when the node resolves through Floci's DNS, and the
* webhook is skipped with a warning when the certificate does not name the host. A skipped
* webhook still replaces the manifest, through {@link #removePodIdentityWebhook}. A failure
* here leaves the cluster running without pod identity injection, matching the token webhook
* and the ECR mirror.
*
* <p>Also called when a surviving container is adopted: the manifest written at creation names
* Floci's address and certificate as they were then, and k3s applies the rewritten file.
*/
void registerPodIdentityWebhook(String containerId, Cluster cluster) {
registerPodIdentityWebhook(containerId, cluster, () -> nodeDnsServerIp().isPresent());
}
/**
* {@code nodeResolvesThroughFloci} answers whether the node finds Floci's hostname through Floci's DNS
* server. It is asked only once the webhook can be registered: an adopted node answers it with a Docker
* inspect.
*/
private void registerPodIdentityWebhook(String containerId, Cluster cluster,
BooleanSupplier nodeResolvesThroughFloci) {
if (!config.services().eks().podIdentityWebhook()) {
return;
}
@@ -2717,6 +2632,7 @@ public class EksClusterManager
+ "https admission webhook URL, and Floci serves HTTP with floci.tls.enabled=false. "
+ "Set FLOCI_TLS_ENABLED=true to have pods mutated. Pods still start, without the "
+ "pod identity token or credentials environment variables.", clusterName);
removePodIdentityWebhook(containerId, cluster);
return;
}
if (certificateAuthority == null) {
@@ -2724,22 +2640,77 @@ public class EksClusterManager
+ "put in the webhook caBundle", clusterName);
return;
}
String url = "https://" + dockerHostResolver.resolve() + ":" + config.port()
boolean nodeUsesEmbeddedDns = nodeResolvesThroughFloci.getAsBoolean();
Optional<String> baseUrl = reachableEndpoint.httpsBaseUrl(nodeUsesEmbeddedDns);
if (baseUrl.isEmpty()) {
LOG.warnv("EKS Pod Identity injection is off for cluster {0}: the certificate Floci serves does not "
+ "name the host of {1}, where the cluster''s API server would call the webhook, so it would "
+ "refuse the handshake. Pods still start, without the pod identity token or credentials "
+ "environment variables. To have them mutated, serve a certificate that names that host, or "
+ "set FLOCI_HOSTNAME to a name the certificate covers while the cluster resolves through "
+ "Floci''s embedded DNS (floci.services.eks.embedded-dns): the API server then calls Floci "
+ "by that name.", clusterName, reachableEndpoint.baseUrl(nodeUsesEmbeddedDns));
removePodIdentityWebhook(containerId, cluster);
return;
}
String url = baseUrl.get()
+ podIdentityWebhookPath(clusterName, resolveClusterAccountId(cluster), clusterRegion(cluster));
String manifest = buildPodIdentityWebhookConfiguration(url, certificateAuthority.caPem());
writeLocalCopy(localClusterFile(cluster, "webhook", POD_IDENTITY_MANIFEST_FILE), manifest, clusterName);
try {
byte[] tar = tarSingleFile(POD_IDENTITY_MANIFEST_TAR_ENTRY, manifest);
RetryingTarCopier.copyStreamed(lifecycleManager.getDockerClient(), containerId, K3S_DATA_DIR,
POD_IDENTITY_MANIFEST_FILE, out -> out.write(tar),
RetryingTarCopier.DEFAULT_MAX_ATTEMPTS, archiveRetryBackoffMillis);
installPodIdentityManifest(containerId, cluster, buildPodIdentityWebhookConfiguration(url,
ContainerCaBundle.endpointTrustPem(config, certificateAuthority.caPem())));
LOG.infov("Registered the EKS Pod Identity mutating webhook ({0}) for cluster {1}", url, clusterName);
} catch (Exception e) {
LOG.warnv("EKS cluster {0} gets no pod identity injection: could not copy {1} into the k3s "
LOG.warnv("EKS cluster {0} gets no pod identity injection: could not install {1} into the k3s "
+ "container: {2}", clusterName, POD_IDENTITY_MANIFEST_FILE, e.getMessage());
}
}
/**
* Replaces the manifest with {@link #POD_IDENTITY_MANIFEST_REMOVED}. The manifest, and the webhook
* configuration k3s created from it, live on the cluster's data volume, which outlives a restart and a
* replaced container, so a webhook registered under an earlier address, certificate or TLS setting would
* otherwise keep being called, each pod creation waiting out its timeout. k3s applies a changed manifest
* by pruning what the earlier version created, among the kinds it held, so a file with no objects deletes
* that configuration.
*/
private void removePodIdentityWebhook(String containerId, Cluster cluster) {
try {
installPodIdentityManifest(containerId, cluster, POD_IDENTITY_MANIFEST_REMOVED);
} catch (Exception e) {
LOG.warnv("EKS cluster {0} may keep a pod identity webhook registered before: could not replace {1} "
+ "in the k3s container: {2}", cluster.getName(), POD_IDENTITY_MANIFEST_FILE, e.getMessage());
}
}
private void installPodIdentityManifest(String containerId, Cluster cluster, String manifest) {
writeLocalCopy(localClusterFile(cluster, "webhook", POD_IDENTITY_MANIFEST_FILE), manifest, cluster.getName());
byte[] tar = tarSingleFile(POD_IDENTITY_MANIFEST_TAR_ENTRY, manifest);
RetryingTarCopier.copyStreamed(lifecycleManager.getDockerClient(), containerId, K3S_DATA_DIR,
POD_IDENTITY_MANIFEST_FILE, out -> out.write(tar),
RetryingTarCopier.DEFAULT_MAX_ATTEMPTS, archiveRetryBackoffMillis);
}
/**
* Whether an adopted node resolves through Floci's DNS server. A container keeps the resolvers it was
* created with, so a node created while that server was off or out of its reach cannot find Floci's
* hostname now, nor can one created when the server had another address.
*/
private boolean survivingNodeResolvesThroughFloci(String containerId) {
Optional<String> dnsServerIp = nodeDnsServerIp();
if (dnsServerIp.isEmpty()) {
return false;
}
try {
InspectContainerResponse inspect = lifecycleManager.getDockerClient().inspectContainerCmd(containerId).exec();
String[] resolvers = inspect.getHostConfig() == null ? null : inspect.getHostConfig().getDns();
return resolvers != null && Arrays.asList(resolvers).contains(dnsServerIp.get());
} catch (Exception e) {
LOG.warnv("Could not read the resolvers of k3s container {0}, so its pod identity webhook is called "
+ "at the Docker host: {1}", containerId, e.getMessage());
return false;
}
}
/**
* The Floci pod identity admission route. The account is in the path for the same reason the
* token webhook puts its scope there: the API server calls Floci with no AWS credentials, so a
@@ -2752,8 +2723,8 @@ public class EksClusterManager
/**
* Builds the {@code MutatingWebhookConfiguration} k3s auto-applies. Scoped to pod {@code CREATE}
* alone, and {@code failurePolicy: Ignore} so an unreachable or failing Floci never blocks a pod
* from being created. The {@code caBundle} is Floci's local CA, base64 of the PEM as Kubernetes
* expects.
* from being created. The {@code caBundle} is what {@code GET /_floci/ca.pem} serves, which
* trusts Floci's HTTPS endpoint, base64 of the PEM as Kubernetes expects.
*
* <p>{@code timeoutSeconds} is 3, not the Kubernetes default of 10: Floci is a local process, so
* a healthy call takes milliseconds, and the timeout only ever runs down when Floci is