Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(shulker-operator): add the possibility to use custom server jars #254

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions docs/src/next/guide/recipes/using-custom-server-jar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Using custom server JAR

You may want to use a custom server JAR to replace the default
behavior which is to download the matching version from the
channel.

You have the ability to specify a resource reference to a custom
server JAR in the `MinecraftServer` and `MinecraftServerFleet` CRDs:

```yaml
apiVersion: shulkermc.io/v1alpha1
kind: MinecraftServerFleet
metadata:
name: my-server
spec:
clusterRef:
name: my-cluster
replicas: 1
template:
spec: // [!code focus]
version: // [!code focus]
channel: Paper // [!code focus]
name: 1.20.0 // [!code focus]
customJar: // [!code focus]
url: https://example.com/custom-jar.jar // [!code focus]
```

:::warning

While this feature allows you to customize the server software to run,
you can't use it to create servers with unsupported platforms. You
still have to specify the version channel so Shulker is aware of which
agent to inject into the server.

You can, however, expect any standard fork of supported platforms to
work as long as they do not introduce breaking changes.

:::
4 changes: 4 additions & 0 deletions docs/src/next/sidebar.mts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export default [
text: 'Defining network administrators',
link: link('/guide/recipes/defining-network-administrators'),
},
{
text: 'Using custom server JAR',
link: link('/guide/recipes/using-custom-server-jar'),
},
],
},
{
Expand Down
5 changes: 5 additions & 0 deletions examples/custom-server-jar/cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: shulkermc.io/v1alpha1
kind: MinecraftCluster
metadata:
name: getting-started
spec: {}
3 changes: 3 additions & 0 deletions examples/custom-server-jar/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resources:
- cluster.yaml
- minecraftserver.yaml
20 changes: 20 additions & 0 deletions examples/custom-server-jar/minecraftserver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: shulkermc.io/v1alpha1
kind: MinecraftServerFleet
metadata:
name: lobby
spec:
clusterRef:
name: getting-started
replicas: 1
template:
spec:
clusterRef:
name: getting-started
tags:
- lobby
version:
channel: Paper
name: "1.20.2"
customJar:
url: https://api.infernalsuite.com/v1/projects/asp/5118810e-2397-48f2-a725-89372c6d3756/download/e2eab933-7e5c-4a1f-8776-89a6624283a0
config: {}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
replicas: 1
selector:
matchLabels:
{{- include "shulker-addon-matchmaking.labels" . | nindent 6 }}
{{- include "shulker-addon-matchmaking.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: shulker-addon-matchmaking-director
template:
metadata:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ spec:
protocol: TCP
targetPort: metrics
selector:
{{- include "shulker-addon-matchmaking.labels" . | nindent 4 }}
{{- include "shulker-addon-matchmaking.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: shulker-addon-matchmaking-director
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
jobLabel: {{ template "shulker-addon-matchmaking.fullname" . }}-director
selector:
matchLabels:
{{- include "shulker-addon-matchmaking.labels" . | nindent 6 }}
{{- include "shulker-addon-matchmaking.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: shulker-addon-matchmaking-director-metrics
endpoints:
- targetPort: metrics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
replicas: 1
selector:
matchLabels:
{{- include "shulker-addon-matchmaking.labels" . | nindent 6 }}
{{- include "shulker-addon-matchmaking.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: shulker-addon-matchmaking-mmf
template:
metadata:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ spec:
protocol: TCP
targetPort: mmf-elo
selector:
{{- include "shulker-addon-matchmaking.labels" . | nindent 4 }}
{{- include "shulker-addon-matchmaking.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: shulker-addon-matchmaking-mmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: matchmakingqueues.matchmaking.shulkermc.io
spec:
group: matchmaking.shulkermc.io
names:
categories: []
kind: MatchmakingQueue
plural: matchmakingqueues
shortNames: []
singular: matchmakingqueue
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: Auto-generated derived type for MatchmakingQueueSpec via `CustomResource`
properties:
spec:
properties:
maxPlayers:
description: The maximum number of players a match can contain
format: uint32
minimum: 0.0
type: integer
minPlayers:
description: The minimum number of players required to create a match. If `None`, the matchmaking function will wait for the maximum number of players
format: uint32
minimum: 0.0
nullable: true
type: integer
mmf:
description: The matchmaking function to use to create matches for this queue
properties:
builtIn:
description: The matchmaking function to use is provided by Shulker
nullable: true
properties:
type:
description: The type of the matchmaking function to use
enum:
- Batch
- Elo
type: string
required:
- type
type: object
provided:
description: The matchmaking function to use is provided by the user
nullable: true
properties:
host:
description: Host of the matchmaking function
type: string
port:
description: GRPC port of the matchmaking function
format: uint16
minimum: 0.0
type: integer
required:
- host
- port
type: object
type: object
targetFleetRef:
description: The `MinecraftServerFleet` to use as a target for this queue
properties:
name:
description: Name of the Kubernetes `MinecraftServerFleet` owning this resource
type: string
required:
- name
type: object
required:
- maxPlayers
- mmf
- targetFleetRef
type: object
status:
description: The status object of `MatchmakingQueue`
nullable: true
type: object
required:
- spec
title: MatchmakingQueue
type: object
served: true
storage: true
subresources:
status: {}
35 changes: 35 additions & 0 deletions kube/helm/templates/crds/shulkermc.io_minecraftserverfleets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,41 @@ spec:
- Paper
- Folia
type: string
customJar:
description: Reference to a server JAR file to download and use instead of the built-in one
nullable: true
properties:
url:
nullable: true
type: string
urlFrom:
nullable: true
properties:
mavenRef:
nullable: true
properties:
artifactId:
type: string
classifier:
nullable: true
type: string
credentialsSecretName:
nullable: true
type: string
groupId:
type: string
repositoryUrl:
type: string
version:
type: string
required:
- artifactId
- groupId
- repositoryUrl
- version
type: object
type: object
type: object
name:
description: Name of the version to use
type: string
Expand Down
35 changes: 35 additions & 0 deletions kube/helm/templates/crds/shulkermc.io_minecraftservers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,41 @@ spec:
- Paper
- Folia
type: string
customJar:
description: Reference to a server JAR file to download and use instead of the built-in one
nullable: true
properties:
url:
nullable: true
type: string
urlFrom:
nullable: true
properties:
mavenRef:
nullable: true
properties:
artifactId:
type: string
classifier:
nullable: true
type: string
credentialsSecretName:
nullable: true
type: string
groupId:
type: string
repositoryUrl:
type: string
version:
type: string
required:
- artifactId
- groupId
- repositoryUrl
- version
type: object
type: object
type: object
name:
description: Name of the version to use
type: string
Expand Down
2 changes: 1 addition & 1 deletion kube/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
replicas: 1
selector:
matchLabels:
{{- include "shulker-operator.labels" . | nindent 6 }}
{{- include "shulker-operator.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: shulker-operator
template:
metadata:
Expand Down
2 changes: 1 addition & 1 deletion kube/helm/templates/metrics_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ spec:
protocol: TCP
targetPort: metrics
selector:
{{- include "shulker-operator.labels" . | nindent 4 }}
{{- include "shulker-operator.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: shulker-operator
{{- end }}
2 changes: 1 addition & 1 deletion kube/helm/templates/metrics_servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
jobLabel: {{ template "shulker-operator.fullname" . }}
selector:
matchLabels:
{{- include "shulker-operator.labels" . | nindent 6 }}
{{- include "shulker-operator.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: shulker-operator-metrics
endpoints:
- targetPort: metrics
Expand Down
2 changes: 1 addition & 1 deletion kube/helm/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ spec:
protocol: TCP
targetPort: api-grpc
selector:
{{- include "shulker-operator.labels" . | nindent 4 }}
{{- include "shulker-operator.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: shulker-operator
Loading