Skip to content

Commit

Permalink
fix merge error
Browse files Browse the repository at this point in the history
  • Loading branch information
acrylic-style committed Aug 17, 2024
1 parent d600a4b commit 181aa8d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 33 deletions.
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,34 +43,34 @@ 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: ...
# ...
spec:
serviceAccountName: velocity-account
# ...
```
```

## Enable Service Discovery on the Minecraft Servers

Expand All @@ -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:
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/net/azisaba/kuvel/Kuvel.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
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;
import java.nio.file.Path;
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;
Expand All @@ -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.",
Expand Down Expand Up @@ -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;
}

Expand Down
6 changes: 2 additions & 4 deletions src/main/java/net/azisaba/kuvel/KuvelServiceHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ public HashMap<String, Pod> 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;
}

Expand Down

0 comments on commit 181aa8d

Please sign in to comment.