diff --git a/README.md b/README.md index 2fb2230..2c6462e 100644 --- a/README.md +++ b/README.md @@ -43,26 +43,26 @@ In order for Kuvel to monitor the server, you must request permission from Kuber and ReplicaSets. ```yml - apiVersion: v1 - kind: ServiceAccount - metadata: - name: velocity-account - namespace: default - --- - apiVersion: rbac.authorization.k8s.io/v1 - kind: ClusterRoleBinding - metadata: - name: velocity-clusterrolebiding - roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: view - subjects: - - kind: ServiceAccount - name: velocity-account - namespace: default - ``` - ```yml +apiVersion: v1 +kind: ServiceAccount +metadata: + name: velocity-account + namespace: default +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: velocity-clusterrolebiding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: view +subjects: +- kind: ServiceAccount + name: velocity-account + namespace: default +``` +```yml # Apply ServiceAccount to the Velocity pod apiVersion: apps/v1 kind: ... @@ -70,7 +70,7 @@ kind: ... spec: serviceAccountName: velocity-account # ... - ``` +``` ## Enable Service Discovery on the Minecraft Servers @@ -94,7 +94,7 @@ metadata: name: test-server labels: kuvel.azisaba.net/enable-server-discovery: "true" # Required for Kuvel to detect Minecraft servers. Depends on your config. - kuvel.azisaba.net/preferred-server-name: : "test-server" # Required for Kuvel to name the server + kuvel.azisaba.net/preferred-server-name: "test-server" # Required for Kuvel to name the server # kuvel.azisaba.net/initial-server: "true" # Uncomment this line if you want to make this server the initial server. spec: containers: diff --git a/src/main/java/net/azisaba/kuvel/Kuvel.java b/src/main/java/net/azisaba/kuvel/Kuvel.java index d5c8171..c547816 100644 --- a/src/main/java/net/azisaba/kuvel/Kuvel.java +++ b/src/main/java/net/azisaba/kuvel/Kuvel.java @@ -7,7 +7,6 @@ import com.velocitypowered.api.plugin.Plugin; import com.velocitypowered.api.plugin.annotation.DataDirectory; import com.velocitypowered.api.proxy.ProxyServer; -import io.fabric8.kubernetes.client.DefaultKubernetesClient; import io.fabric8.kubernetes.client.KubernetesClient; import java.io.File; @@ -15,7 +14,6 @@ import java.util.Map; import java.util.Objects; import java.util.concurrent.TimeUnit; -import java.util.logging.Logger; import io.fabric8.kubernetes.client.KubernetesClientBuilder; import lombok.Getter; @@ -27,11 +25,12 @@ import net.azisaba.kuvel.redis.ProxyIdProvider; import net.azisaba.kuvel.redis.RedisConnectionLeader; import net.azisaba.kuvel.redis.RedisSubscriberExecutor; +import org.slf4j.Logger; @Plugin( id = "kuvel", name = "Kuvel", - version = "3.0.0-rc2", + version = "3.0.0-rc3", url = "https://github.com/AzisabaNetwork/Kuvel", description = "Server-discovery Velocity plugin for Minecraft servers running in a Kubernetes cluster.", @@ -77,7 +76,7 @@ public void onProxyInitialization(ProxyInitializeEvent event) { } if (kuvelConfig.getLabelSelectors().isEmpty()) { - logger.severe("No label selectors are specified. Plugin feature will be disabled."); + logger.error("No label selectors are specified. Plugin feature will be disabled."); return; } diff --git a/src/main/java/net/azisaba/kuvel/KuvelServiceHandler.java b/src/main/java/net/azisaba/kuvel/KuvelServiceHandler.java index 5f3905a..773ce88 100644 --- a/src/main/java/net/azisaba/kuvel/KuvelServiceHandler.java +++ b/src/main/java/net/azisaba/kuvel/KuvelServiceHandler.java @@ -15,6 +15,7 @@ import java.util.concurrent.atomic.AtomicReference; import javax.annotation.Nullable; +import io.fabric8.kubernetes.client.dsl.FilterWatchListDeletable; import io.fabric8.kubernetes.client.dsl.PodResource; import lombok.Getter; import lombok.RequiredArgsConstructor; @@ -163,10 +164,7 @@ public void setAndRunServerDiscovery(@Nullable ServerDiscovery newServerDiscover boolean success = registerPod(pod, serverName); if (!success) { plugin.getProxy().getServer(serverName).ifPresent(server -> plugin.getProxy().unregisterServer(server.getServerInfo())); - plugin.getLogger().warning("Failed to register pod. ( " - + "serverName = " + serverName + ", " - + "pod = " + pod.getMetadata().getUid() - + " )"); + plugin.getLogger().warn("Failed to register pod. ( serverName = {}, pod = {} )", serverName, pod.getMetadata().getUid()); } }); diff --git a/src/main/java/net/azisaba/kuvel/discovery/impl/redis/RedisServerDiscovery.java b/src/main/java/net/azisaba/kuvel/discovery/impl/redis/RedisServerDiscovery.java index 23fecee..8e943d4 100644 --- a/src/main/java/net/azisaba/kuvel/discovery/impl/redis/RedisServerDiscovery.java +++ b/src/main/java/net/azisaba/kuvel/discovery/impl/redis/RedisServerDiscovery.java @@ -171,9 +171,9 @@ public HashMap getServersForStartup() { .info(verb + " server: " + entry.getValue() + " (" + entry.getKey() + ")"); Pod pod = getPodByUid(entry.getKey()); if (pod == null) { - plugin - .getLogger() - .warn("Pod " + entry.getKey() + " for server " + entry.getValue() + " not found"); + plugin + .getLogger() + .warn("Pod {} for server {} not found", entry.getKey(), entry.getValue()); continue; }