diff --git a/example/.gitignore b/example/.gitignore new file mode 100644 index 0000000..a9763ce --- /dev/null +++ b/example/.gitignore @@ -0,0 +1 @@ +tilt/example/docker/example.jar diff --git a/example/build.gradle.kts b/example/build.gradle.kts new file mode 100644 index 0000000..c186209 --- /dev/null +++ b/example/build.gradle.kts @@ -0,0 +1,73 @@ +import java.nio.file.Path + +plugins { + java + id("io.github.goooler.shadow") version "8.1.7" +} + +group = "tr.com.infumia" +version = "1.0.0-SNAPSHOT" + +val tiltFolder: Path = rootProject.layout.projectDirectory.asFile.toPath().resolve("tilt") + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(17) + } +} + +tasks { + jar { + archiveVersion = "" + } + + shadowJar { + archiveClassifier = "" + archiveVersion = "" + + mergeServiceFiles() + + manifest { + attributes( + "Main-Class" to "tr.com.infumia.Main" + ) + } + } + + val outputTask = shadowJar.get() + + register("copyJar") { + val inputJar = outputTask.outputs.files.singleFile + val outputFile = tiltFolder + .resolve("example") + .resolve("docker") + .resolve("example.jar") + .toFile() + + inputs.files(inputJar) + outputs.files(outputFile) + + doLast { + inputJar.copyTo(outputFile, true) + } + + dependsOn(shadowJar) + } + + build { + dependsOn(shadowJar) + finalizedBy("copyJar") + } +} + +repositories { + mavenCentral() + maven("https://jitpack.io/") +} + +dependencies { + implementation("io.grpc:grpc-stub:1.63.0") + implementation("io.grpc:grpc-protobuf:1.63.0") + implementation("io.grpc:grpc-netty:1.63.0") + implementation("com.github.infumia:agones4j:1.0.3") +} diff --git a/example/gradle/wrapper/gradle-wrapper.jar b/example/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..e644113 Binary files /dev/null and b/example/gradle/wrapper/gradle-wrapper.jar differ diff --git a/example/gradle/wrapper/gradle-wrapper.properties b/example/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..e7646de --- /dev/null +++ b/example/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/example/gradlew b/example/gradlew new file mode 100644 index 0000000..1aa94a4 --- /dev/null +++ b/example/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/example/gradlew.bat b/example/gradlew.bat new file mode 100644 index 0000000..25da30d --- /dev/null +++ b/example/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/example/settings.gradle.kts b/example/settings.gradle.kts new file mode 100644 index 0000000..a6260e8 --- /dev/null +++ b/example/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "example" diff --git a/example/src/main/java/tr/com/infumia/Main.java b/example/src/main/java/tr/com/infumia/Main.java new file mode 100644 index 0000000..9077635 --- /dev/null +++ b/example/src/main/java/tr/com/infumia/Main.java @@ -0,0 +1,29 @@ +package tr.com.infumia; + +import java.time.Duration; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import tr.com.infumia.agones4j.Agones; + +public final class Main { + public static void main(final String[] args) throws InterruptedException { + final var agones = Agones.builder() + .withChannel() + .withHealthCheck(Duration.ofSeconds(1L), Duration.ofSeconds(1L)) + .withGameServerWatcherExecutor(Executors.newSingleThreadExecutor()) + .build(); + + agones.addGameServerWatcher(server -> System.out.println("Game server update: " + server)); + agones.ready(); + agones.startHealthChecking(); + + sleep(); + } + + private static void sleep() throws InterruptedException { + while (true) { + Thread.sleep(5L); + } + } +} diff --git a/example/tilt/Tiltfile b/example/tilt/Tiltfile new file mode 100644 index 0000000..36fc110 --- /dev/null +++ b/example/tilt/Tiltfile @@ -0,0 +1,2 @@ +include('agones/Tiltfile') +include('example/Tiltfile') diff --git a/example/tilt/agones/Tiltfile b/example/tilt/agones/Tiltfile new file mode 100644 index 0000000..ddfc34b --- /dev/null +++ b/example/tilt/agones/Tiltfile @@ -0,0 +1,27 @@ +load('ext://helm_remote', 'helm_remote') +load('ext://namespace', 'namespace_create') + +namespace_create('example') + +helm_remote( + 'agones', + namespace='agones-system', + create_namespace=True, + repo_url='https://agones.dev/chart/stable', + values=['./values.yaml'] +) + +k8s_kind('Fleet', image_json_path='{.spec.template.spec.template.spec.containers.*.image}') + +agones_resources = [ + 'agones-controller', + 'agones-extensions', + 'agones-ping', + 'agones-allocator', + 'agones-delete-agones-resources' +] + +for resource in agones_resources: + k8s_resource(resource, labels=['agones']) + +local_resource('agones', cmd='echo ready', resource_deps=agones_resources) diff --git a/example/tilt/agones/values.yaml b/example/tilt/agones/values.yaml new file mode 100644 index 0000000..6e554c9 --- /dev/null +++ b/example/tilt/agones/values.yaml @@ -0,0 +1,58 @@ +gameservers: + namespaces: + - example +agones: + image: + tag: 1.40.0 + generateTLS: false + tlsCert: | + -----BEGIN CERTIFICATE----- + MIIDlDCCAnygAwIBAgIRAKv3UYPE/9CMPyCyCwZXVEMwDQYJKoZIhvcNAQELBQAw + IjEgMB4GA1UEAxMXYWRtaXNzaW9uLWNvbnRyb2xsZXItY2EwHhcNMjQwNDI4MjEw + OTIxWhcNMzQwNDI2MjEwOTIxWjAkMSIwIAYDVQQDExlhZ29uZXMtY29udHJvbGxl + ci1zZXJ2aWNlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1cfb9jlb + f2pHH2VBRHqg3R3yI3x/WPTW27bg/tN0iZssr/aPKqHD9nYEG+QFwVfvuPwiD81r + DpNAXcN2LYNW3eBrSpplbB1bZZewOvvs8M+3MvusntbgwybnABD9a3yiVL5UHbjM + peaDWR/Im388PrrdRLFLkSUcxTYOoa+86+G3mrSWXhgapdjOqmQFZ6NIE6eqq2AG + poUEKQsu5/rrvJo04Brw+YlPvLloUNcLSSVoMtrE2dFKKjOTCETXy6QL9x/zW7zI + owT2mliF63cfS4HJ+PuKJWhfUuohAPK8q/MUWnLQ5W8ahnnuOpKiYrln82p+GUKD + Ro9kXHEo/EgjVQIDAQABo4HCMIG/MA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAU + BggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADAfBgNVHSMEGDAWgBTM + gXTu8kAsr5GKkDUM5b1i7w69/TBfBgNVHREEWDBWgidhZ29uZXMtY29udHJvbGxl + ci1zZXJ2aWNlLmFnb25lcy1zeXN0ZW2CK2Fnb25lcy1jb250cm9sbGVyLXNlcnZp + Y2UuYWdvbmVzLXN5c3RlbS5zdmMwDQYJKoZIhvcNAQELBQADggEBAGVycraRDMAg + Ra9NTEgKrpXWcyMJlBnR/ikO4rpNMfjEWITUMEyRf7hNfp8+OLGMvv/R9Q8+edRl + gXtkCMuf853lKovgS7coTvRL4EYunaACmPixHXrGxYwnHRG/WV0o6NMZ2w5rZE0h + PRE5uGQmePiszyQjb+rnCIHtyhhP8QZIJtu87RTuqf4hYKJuBNty51HlnWYcpYK3 + g3XwCzMXI+yl+ZDlrG/RWj+4/Tk8KWRUUS8p3f33dqnIFQiupbylXmkfhc8/7tS0 + 4ciEHdSzH1ada1g+6KSLEr6pEqiXCR+/0n98EKjYcgNtUCrt8zYmnK2WXLbpugXQ + GZOtYHtORCQ= + -----END CERTIFICATE----- + tlsKey: | + -----BEGIN RSA PRIVATE KEY----- + MIIEogIBAAKCAQEA1cfb9jlbf2pHH2VBRHqg3R3yI3x/WPTW27bg/tN0iZssr/aP + KqHD9nYEG+QFwVfvuPwiD81rDpNAXcN2LYNW3eBrSpplbB1bZZewOvvs8M+3Mvus + ntbgwybnABD9a3yiVL5UHbjMpeaDWR/Im388PrrdRLFLkSUcxTYOoa+86+G3mrSW + XhgapdjOqmQFZ6NIE6eqq2AGpoUEKQsu5/rrvJo04Brw+YlPvLloUNcLSSVoMtrE + 2dFKKjOTCETXy6QL9x/zW7zIowT2mliF63cfS4HJ+PuKJWhfUuohAPK8q/MUWnLQ + 5W8ahnnuOpKiYrln82p+GUKDRo9kXHEo/EgjVQIDAQABAoIBAFIGn3V4SI05ABUh + yss1qidtaA0JpetB9nbTUr0z8VEjQyA5IHGhJAma+rSg5zxqO0blJ0Sc8ujiwx22 + 888+x8PWahRz7VpwYTM34pyfMSis6oQbYP6JQDBg6t1xp2ropXiSlr/Yul0ld1xo + /5X6WelP1bqXtID6lnFs7mxHe9udSkcyoidvOL2Dfqrs/yxFhFd5ESZuSi3t43yE + Uk5XFTra//XfR/A3eIxJHurEKbHqA+Cw0tGOMKFBproUZDcNQtGYeiNT4BvK6YaB + ojoytrYOTY0OOREY3IPm82OyKXo4FEwSv7lKoyTZZ4w/S09SM326WpSfTDXCur0C + pYbXHYECgYEA7DIRgx0cib72PdCbhLsjc1LUrbHL0kpwKqIr2pS9sDFqzXx2ehh1 + ISs98sbjeIz3LKfbgWA+0ALPQ/jR+svLt0+lC7duVKUscsQljsKIYOvaszeSay1z + 8Bw9BI6sk1hWVOmcuTr2HYCVuIoP19T6fmPSgRdUioaNp7D0uXJVI6UCgYEA57Sn + 8rdT5AIlaNEIBzo0nGdstUStJAHr/a8bnDajWQwrm7/DhFfPdJeyHc3YPnB7I3gN + 3hKi978pGVSFwWAEDBlTfQ2yARO0A7XVYOBbKD5U5SmUjMhpk2Mw5TM9nkGoiBkH + U9+M4HD2/7x0THOBWj1q/LZpWfalec6DbzfjMfECgYBfjnoLQ3HSQJG6vHTOpC9Z + br9gbjf5oefzN5zqV5bOe4+sBpigGNj6TFZJrDFHCjDNvjNOCjQfT6Ou6jF5d425 + Yd1x+goG8LQk0jonoYgvPfxC2U7BUahAEgyVlWs4SVrUC5c+UR5VHTp1aFW0ihO1 + ooj9dQTc7kbM+whnJlxPiQKBgFu0ImxrpmYte0TaxkSmAsCMJngvsB76K76BmXng + HhJWQMQpx2YPounQSAyHtbgwqGvHTiXAVoObQtblnvKD39YyB9sMmpDWjX6Sbtsi + sLFiyhLQvBxkDXTp4yYze4WxEtSao03MwmLqErfwjE7dwCpI+JkAUP3sIl3tIBPa + mK7hAoGAVGVYp+4oyjuj2UBYGV17ztVCbyvlUIe1sU8lrBlVV5kPSymeNFXqmQHw + LAzcqP+kdHu0mqYwh0TlcZPz34dVkVTtc1m6FkyWDVD5r6QuC5qARHt1EaVny7xT + ZEi5AuqxCOurvTLAgUizTLYz/rUes3/rDkKMSVYf0KbJX7pN6uU= + -----END RSA PRIVATE KEY----- diff --git a/example/tilt/example/Tiltfile b/example/tilt/example/Tiltfile new file mode 100644 index 0000000..0121bcf --- /dev/null +++ b/example/tilt/example/Tiltfile @@ -0,0 +1,13 @@ +docker_build( + ref='local/infumia/agones4j-example', + context='./docker/', + dockerfile='./docker/Dockerfile' +) + +k8s_yaml(helm( + './charts/', + name='agones4j-example', + namespace='example' +)) + +k8s_resource('example-fleet', resource_deps=['agones']) diff --git a/example/tilt/example/charts/Chart.yaml b/example/tilt/example/charts/Chart.yaml new file mode 100644 index 0000000..f03b727 --- /dev/null +++ b/example/tilt/example/charts/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v2 +version: 1.0.0 +name: agones4j-example +type: application diff --git a/example/tilt/example/charts/templates/server.yaml b/example/tilt/example/charts/templates/server.yaml new file mode 100644 index 0000000..d9ed5a5 --- /dev/null +++ b/example/tilt/example/charts/templates/server.yaml @@ -0,0 +1,23 @@ +--- +apiVersion: agones.dev/v1 +kind: Fleet +metadata: + name: example-fleet + namespace: {{ .Release.Namespace }} +spec: + replicas: 1 + scheduling: Distributed + template: + spec: + health: + initialDelaySeconds: 5 + periodSeconds: 3 + template: + metadata: + labels: + app: example-game-server + spec: + containers: + - name: minecraft + imagePullPolicy: Never + image: local/infumia/agones4j-example:latest diff --git a/example/tilt/example/docker/Dockerfile b/example/tilt/example/docker/Dockerfile new file mode 100644 index 0000000..a0941ce --- /dev/null +++ b/example/tilt/example/docker/Dockerfile @@ -0,0 +1,7 @@ +FROM eclipse-temurin:17-jre + +WORKDIR /app + +COPY example.jar example.jar + +CMD ["java", "-jar", "example.jar"]