Skip to content

Commit

Permalink
feat: add gradle base for support plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylvln committed Mar 5, 2022
1 parent 1fabf97 commit 62dba66
Show file tree
Hide file tree
Showing 25 changed files with 695 additions and 24 deletions.
75 changes: 65 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Global

# Binaries for programs and plugins
## Binaries for programs and plugins
*.exe
*.exe~
*.dll
Expand All @@ -8,18 +9,72 @@
bin
testbin/*

# Test binary, build with `go test -c`
# Go

## Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
## Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Kubernetes Generated files - skip generated files, except for vendored files

## Kubernetes Generated files - skip generated files, except for vendored files
!vendor/**/zz_generated.*

# editor and IDE paraphernalia
.idea
*.swp
*.swo
*~
# Java & Gradle

# Ignore Gradle project-specific cache directory/ …born/.gitignore
.gradle

# Ignore Gradle build output directory
build
**/build/
!src/**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Cache of project
.gradletasknamecache

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
.idea/artifacts
.idea/compiler.xml
.idea/jarRepositories.xml
.idea/modules.xml
.idea/*.iml
6 changes: 6 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion api/v1alpha1/proxydeployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,27 @@ type ProxyDeploymentSpec struct {
//+kubebuilder:validation:Required
Replicas int32 `json:"replicas,omitempty"`

// Number of maximum players that can connect to the
// Proxy Deployment.
//+kubebuilder:default=100
MaxPlayers *int64 `json:"maxPlayers,omitempty"`

// Message to display when the players query the status
// of the Proxy Deployment.
//+kubebuilder:default="A Minecraft Cluster on Shulker"
Motd string `json:"motd,omitempty"`

// Server icon image in base64 format.
ServerIcon string `json:"serverIcon,omitempty"`

// The desired state of the Kubernetes Service to create for the
// Proxy Deployment.
//+kubebuilder:default={enabled: true, type: "LoadBalancer"}
Service *ProxyDeploymentServiceSpec `json:"service,omitempty"`

// Overrides configuration for the Proxy Deployment pod.
//+kubebuilder:default={livenessProbe: {initialDelaySeconds: 15}, readinessProbe: {initialDelaySeconds: 15}, terminationGracePeriodSeconds: 3600}
PodOverrides *MinecraftServerPodOverridesSpec `json:"podOverrides,omitempty"`
PodOverrides *ProxyDeploymentPodOverridesSpec `json:"podOverrides,omitempty"`

// The desired compute resource requirements of Pods in the Proxy
// Deployment.
Expand Down
7 changes: 6 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
configure(subprojects.findAll {
!['support'].contains(it.name)
}) {
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'maven-publish'

group = 'io.shulkermc'

java.toolchain.languageVersion = JavaLanguageVersion.of(17)

compileJava.options.encoding = 'UTF-8'

repositories {
mavenCentral()
mavenLocal()
}

dependencies {
testImplementation 'junit:junit:4.13'
}
}
36 changes: 25 additions & 11 deletions config/crd/bases/shulkermc.io_proxydeployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,12 @@ spec:
type: array
type: object
type: object
maxPlayers:
default: 100
description: Number of maximum players that can connect to the Proxy
Deployment.
format: int64
type: integer
minecraftClusterRef:
description: Reference to a Minecraft Cluster. Adding this will enroll
this Proxy Deployment to be part of a Minecraft Cluster.
Expand All @@ -882,6 +888,11 @@ spec:
description: Name of the Minecraft Cluster.
type: string
type: object
motd:
default: A Minecraft Cluster on Shulker
description: Message to display when the players query the status
of the Proxy Deployment.
type: string
podOverrides:
default:
livenessProbe:
Expand All @@ -892,8 +903,8 @@ spec:
description: Overrides configuration for the Proxy Deployment pod.
properties:
env:
description: Additional environment variables to add to the Minecraft
Server.
description: Additional environment variables to add to the Proxy
Deployment.
items:
description: EnvVar represents an environment variable present
in a Container.
Expand Down Expand Up @@ -1003,31 +1014,31 @@ spec:
type: object
type: array
livenessProbe:
description: Overrides for the liveness probe of the Minecraft
Server.
description: Overrides for the liveness probe of the Proxy Deployment.
properties:
initialDelaySeconds:
default: 60
default: 15
description: Number of seconds before starting to perform
the probe. Depending on the server configuration, one can
take more time than another to be ready. Defaults to 1 minute.
take more time than another to be ready. Defaults to 15
seconds.
format: int32
type: integer
type: object
readinessProbe:
description: Overrides for the readiness probe of the Minecraft
Server.
description: Overrides for the readiness probe of the Proxy Deployment.
properties:
initialDelaySeconds:
default: 60
default: 15
description: Number of seconds before starting to perform
the probe. Depending on the server configuration, one can
take more time than another to be ready. Defaults to 1 minute.
take more time than another to be ready. Defaults to 15
seconds.
format: int32
type: integer
type: object
terminationGracePeriodSeconds:
default: 60
default: 3600
description: Number of seconds before force killing the pod after
a graceful termination request. Defaults to 1 minute.
format: int64
Expand Down Expand Up @@ -1071,6 +1082,9 @@ spec:
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
serverIcon:
description: Server icon image in base64 format.
type: string
service:
default:
enabled: true
Expand Down
7 changes: 6 additions & 1 deletion controllers/minecraftserver_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ func (r *MinecraftServerReconciler) Reconcile(ctx context.Context, req ctrl.Requ
minecraftServer.Status.SetCondition(shulkermciov1alpha1.ServerReadyCondition, metav1.ConditionFalse, "Unknown", "Pod status is unknown")
for _, condition := range pod.Status.Conditions {
if condition.Type == corev1.PodReady {
minecraftServer.Status.SetCondition(shulkermciov1alpha1.ServerReadyCondition, metav1.ConditionStatus(condition.Status), condition.Reason, condition.Message)
if condition.Status == corev1.ConditionTrue {
minecraftServer.Status.SetCondition(shulkermciov1alpha1.ServerReadyCondition, metav1.ConditionTrue, "PodReady", condition.Message)
} else {
minecraftServer.Status.SetCondition(shulkermciov1alpha1.ServerReadyCondition, metav1.ConditionFalse, "PodNotReady", condition.Message)
}

break
}
}
Expand Down
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 62dba66

Please sign in to comment.