-
Notifications
You must be signed in to change notification settings - Fork 161
Update mc-router chart for new auto scale options #270
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{{- if eq .Values.minecraftRouter.autoScale.configObject "ConfigMap" | and .Values.minecraftRouter.autoScale.allowDeny }} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "mc-router.fullname" . }}-autoscale-allow-deny | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "mc-router.labels" . | nindent 4 }} | ||
data: | ||
auto-scale-allow-deny-list.json: {{ .Values.minecraftRouter.autoScale.allowDeny | toJson | squote }} | ||
{{- end }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{{- if eq .Values.minecraftRouter.autoScale.configObject "Secret" | and .Values.minecraftRouter.autoScale.allowDeny }} | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ include "mc-router.fullname" . }}-autoscale-allow-deny | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "mc-router.labels" . | nindent 4 }} | ||
data: | ||
auto-scale-allow-deny-list.json: {{ .Values.minecraftRouter.autoScale.allowDeny | toJson | b64enc }} | ||
{{- end }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,9 +25,18 @@ spec: | |
{{- .Values.deploymentStrategy | toYaml | nindent 4}} | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
{{- if or .Values.minecraftRouter.autoScale.allowDeny .Values.podAnnotations }} | ||
annotations: | ||
{{- if .Values.minecraftRouter.autoScale.allowDeny }} | ||
{{- if eq .Values.minecraftRouter.autoScale.configObject "Secret" }} | ||
checksum/autoscale-allow-deny-config: {{ include (print .Template.BasePath "/autoscale-allow-deny-secret.yaml") . | sha256sum }} | ||
{{- else if eq .Values.minecraftRouter.autoScale.configObject "ConfigMap" }} | ||
checksum/autoscale-allow-deny-config: {{ include (print .Template.BasePath "/autoscale-allow-deny-configmap.yaml") . | sha256sum }} | ||
{{- end }} | ||
{{- end }} | ||
{{- with .Values.podAnnotations }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- end }} | ||
labels: | ||
{{- include "mc-router.labels" . | nindent 8 }} | ||
|
@@ -54,7 +63,12 @@ spec: | |
{{- include "mc-router.envMap" (list "PORT" $minecraftPort) }} | ||
|
||
{{- with .Values.minecraftRouter }} | ||
{{- include "mc-router.envMap" (list "AUTO_SCALE_UP" .autoScaleUp.enabled) }} | ||
{{- include "mc-router.envMap" (list "AUTO_SCALE_UP" .autoScale.up.enabled) }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same backward compatibility comment |
||
{{- include "mc-router.envMap" (list "AUTO_SCALE_DOWN" .autoScale.down.enabled) }} | ||
{{- include "mc-router.envMap" (list "AUTO_SCALE_DOWN_AFTER" .autoScale.down.after) }} | ||
{{- if .autoScale.allowDeny }} | ||
{{- include "mc-router.envMap" (list "AUTO_SCALE_ALLOW_DENY" "etc/mc-router/auto-scale-allow-deny-list.json") }} | ||
{{- end }} | ||
{{- include "mc-router.envMap" (list "CONNECTION_RATE_LIMIT" .connectionRateLimit) }} | ||
{{- include "mc-router.envMap" (list "CPU_PROFILE" .cpuProfilePath) }} | ||
{{- include "mc-router.envMap" (list "DEBUG" .debug.enabled) }} | ||
|
@@ -136,13 +150,20 @@ spec: | |
port: {{ $apiPort }} | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
{{- with .Values.extraVolumes }} | ||
{{- if or .Values.minecraftRouter.autoScale.allowDeny .Values.extraVolumes }} | ||
volumeMounts: | ||
{{- if .Values.minecraftRouter.autoScale.allowDeny }} | ||
- name: autoscale-allow-deny | ||
mountPath: /etc/mc-router | ||
readOnly: true | ||
{{- end }} | ||
{{- with .Values.extraVolumes }} | ||
{{- range . }} | ||
{{- if .volumeMounts }} | ||
{{- toYaml .volumeMounts | nindent 12 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
|
@@ -157,13 +178,26 @@ spec: | |
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
|
||
{{- with .Values.extraVolumes }} | ||
{{- if or .Values.minecraftRouter.autoScale.allowDeny .Values.extraVolumes }} | ||
volumes: | ||
{{- if .Values.minecraftRouter.autoScale.allowDeny }} | ||
{{- if eq .Values.minecraftRouter.autoScale.configObject "Secret" }} | ||
- name: autoscale-allow-deny | ||
secret: | ||
secretName: {{ include "mc-router.fullname" . }}-autoscale-allow-deny | ||
{{- else if eq .Values.minecraftRouter.autoScale.configObject "ConfigMap" }} | ||
- name: autoscale-allow-deny | ||
configMap: | ||
name: {{ include "mc-router.fullname" . }}-autoscale-allow-deny | ||
{{- end }} | ||
{{- end }} | ||
{{- with .Values.extraVolumes }} | ||
{{- range . }} | ||
{{- if .volumes }} | ||
{{- toYaml .volumes | nindent 8 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- range $key, $value := .Values.extraPodSpec }} | ||
{{ $key }}: {{ tpl $value $ }} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"$schema": "http://json-schema.org/schema", | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"required": [ | ||
"minecraftRouter", | ||
"services" | ||
|
@@ -59,17 +59,51 @@ | |
|
||
"minecraftRouter": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"autoScaleUp": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regarding my backward compatibility commments, I'm not sure if the old value/object needs to be also included here. I'd have to look if JSON schema has a deprecated flag. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (This applies to all other backwards compatible comments). I'm happy to make changes to allow for backwards compatibility, but wondering how you would feel about simply bumping the chart major version and leaving this as a breaking change? I completely understand if you would prefer to make it backwards compatible, just wanted to check first 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, that is supposed to be point of major versions 😀 Even a minor version bump is probably somewhat legit for just an interface change. How about this:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that sounds good, I'll take a look at the JSON Schema because I think the |
||
"autoScale": { | ||
"type": "object", | ||
"title": "\"Wake up\" any stopped Minecraft servers.", | ||
"description": "This requires Minecraft servers to be kind: StatefulSet", | ||
"properties": { | ||
"enabled": { | ||
"anyOf": [ | ||
{ "type": "string", "enum": ["default"] }, | ||
{ "type": "boolean" } | ||
] | ||
"up": { | ||
"type": "object", | ||
"properties": { | ||
"enabled": { | ||
"title": "\"Wake up\" any stopped Minecraft servers.", | ||
"description": "This requires Minecraft servers to be kind: StatefulSet", | ||
"anyOf": [ | ||
{ "type": "string", "enum": ["default"] }, | ||
{ "type": "boolean" } | ||
] | ||
} | ||
} | ||
}, | ||
"down": { | ||
"type": "object", | ||
"properties": { | ||
"enabled": { | ||
"title": "Shut down any running Minecraft servers after there are no more connections.", | ||
"description": "This requires Minecraft servers to be kind: StatefulSet", | ||
"anyOf": [ | ||
{ "type": "string", "enum": ["default"] }, | ||
{ "type": "boolean" } | ||
] | ||
}, | ||
"after": { | ||
"type": "string", | ||
"title": "Shut down waiting period after there are no more connections.", | ||
"description": "It is recommended that this value is high enough so momentary disconnections do not result in a server shutdown" | ||
} | ||
} | ||
}, | ||
"configObject": { | ||
"type": "string", | ||
"enum": ["Secret", "ConfigMap"], | ||
"title": "Type of Kubernetes object to store autoscale allow/deny list config in." | ||
}, | ||
"allowDeny": { | ||
"title": "Specify a server allow/deny list to restrict which players may trigger the scalers.", | ||
"$comment": "Update tag below and in values.yaml comment when this file changes", | ||
"$ref": "https://raw.githubusercontent.com/itzg/mc-router/refs/tags/1.29.0/docs/allow-deny-list.schema.json" | ||
} | ||
} | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this would be a breaking change for existing chart users. You could do this as an or-expression to allow for both old and new value identifiers.