Skip to content

Commit

Permalink
fix(shulker-proxy-directory): name of the default target
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylvln committed Mar 12, 2022
1 parent 6cae574 commit 8d4de7a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
8 changes: 8 additions & 0 deletions internal/resource/cluster/limbo_minecraftserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ func (b *MinecraftClusterLimboMinecraftServerBuilder) Update(object client.Objec
World: &shulkermciov1alpha1.MinecraftServerWorldSpec{
SchematicUrl: "https://i.jeremylvln.fr/shulker/limbo.schematic",
},
PodOverrides: &shulkermciov1alpha1.MinecraftServerPodOverridesSpec{
LivenessProbe: &shulkermciov1alpha1.MinecraftServerPodProbeSpec{
InitialDelaySeconds: 10,
},
ReadinessProbe: &shulkermciov1alpha1.MinecraftServerPodProbeSpec{
InitialDelaySeconds: 10,
},
},
Resources: &corev1.ResourceRequirements{
Requests: corev1.ResourceList{
"cpu": *resource.NewScaledQuantity(250, resource.Milli),
Expand Down
1 change: 0 additions & 1 deletion internal/resource/server/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ func (b *MinecraftServerPodBuilder) getInitContainers() []corev1.Container {

func (b *MinecraftServerPodBuilder) getPodEnv() []corev1.EnvVar {
shouldEnforceWhitelist := len(b.Instance.Spec.WhitelistedPlayers) > 0
maxMemory := b.Instance.Spec.Resources.Limits.Memory().ScaledValue(resource.Mega)

env := []corev1.EnvVar{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public ServerConnectListener(ShulkerProxyDirectory plugin) {

@EventHandler(priority = EventPriority.LOWEST)
public void onServerConnect(ServerConnectEvent event) {
if (event.getTarget().getName().equals("limbo")) {
if (event.getTarget().getName().equals("lobby")) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ private synchronized void updateServerDirectory(List<MinecraftClusterStatus.Serv
List<String> serverPoolNames = serverPool.parallelStream()
.map(MinecraftClusterStatus.ServerPoolEntry::getName).toList();

new HashSet<>(proxyServers.keySet()).stream()
.filter((serverName) -> !serverPoolNames.contains(serverName))
.peek((serverName) -> this.getLogger().info(String.format("Removing server %s from directory", serverName)))
.forEach(proxyServers::remove);

serverPool.stream()
.filter((server) -> server != null && server.getName() != null && server.getAddress() != null && !proxyServers.containsKey(server.getName()))
.map((server) -> {
Expand All @@ -94,11 +99,6 @@ private synchronized void updateServerDirectory(List<MinecraftClusterStatus.Serv
.peek((serverInfo) -> this.getLogger().info(String.format("Adding server %s (%s) to directory", serverInfo.getName(), serverInfo.getSocketAddress())))
.forEach((serverInfo) -> proxyServers.put(serverInfo.getName(), serverInfo));

new HashSet<>(proxyServers.keySet()).stream()
.filter((serverName) -> !serverPoolNames.contains(serverName))
.peek((serverName) -> this.getLogger().info(String.format("Removing server %s from directory", serverName)))
.forEach(proxyServers::remove);

this.serverPool = serverPool.parallelStream()
.collect(Collectors.toMap(MinecraftClusterStatus.ServerPoolEntry::getName, (serverEntry) -> serverEntry));

Expand Down

0 comments on commit 8d4de7a

Please sign in to comment.