Skip to content

Conversation

Sammcb
Copy link
Contributor

@Sammcb Sammcb commented May 4, 2025

Fixes #269

@Sammcb
Copy link
Contributor Author

Sammcb commented May 4, 2025

@itzg I verified helm lint ran successfully. I tested this by running in a local Kubernetes cluster with different combinations of the options (especially focused on the allow/deny list as that influenced a few pieces of templating) and everything worked as expected.

@Sammcb
Copy link
Contributor Author

Sammcb commented May 7, 2025

@itzg This is ready for review! Absolutely no worries if you don't have time, I'm just excited to start using the new version once it's merged 😄

Copy link
Owner

@itzg itzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay in reviewing this.

@@ -8,7 +8,7 @@ rules:
- apiGroups: [""]
resources: ["services"]
verbs: ["watch","list"]
{{- if .Values.minecraftRouter.autoScaleUp.enabled }}
{{- if .Values.minecraftRouter.autoScale.up.enabled }}
Copy link
Owner

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.

annotations:
{{- if .Values.minecraftRouter.autoScale.allowDeny }}
checksum/secret-config: {{ include (print .Template.BasePath "/secret.yaml") . | sha256sum }}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure from just this how the annotation name and secrets file relates to allow/deny list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done because for now, this secret only exists if the user specifies an auto scale allow/deny list. If the secret does exist, and the users makes changes to that list then the mc-router pod needs to be restarted to receive the changes which is what the annotation triggers. I could instead make this a TPL function called secretEnabled or something that simply wraps .Values.minecraftRouter.autoScale.allowDeny to better clarify intent?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, I had missed the sha operation, so now I understand and agree with the "checksum/" prefix. Otherwise perhaps a more descriptive name like "checksum/allow-deny-secret" would make me all the way happy.

@@ -54,7 +59,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) }}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same backward compatibility comment

volumeMounts:
{{- if .Values.minecraftRouter.autoScale.allowDeny }}
- name: secret-config
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and related to previous comment

volumes:
{{- if .Values.minecraftRouter.autoScale.allowDeny }}
- name: secret-config
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this helps answer my previous comments, however I'm not sure if that file needs to be a secret and I'm not sure if this is forcing too much convention on the users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could either be a secret or config map. If you would prefer, I'm happy to make that an additional option in the values.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, if it doesn't cause too much of a mess with the values and template, it would be nice to give the option of secret or configmap. Otherwise, just as a secret now seems decent to me.

@@ -60,16 +60,44 @@
"minecraftRouter": {
"type": "object",
"properties": {
"autoScaleUp": {
Copy link
Owner

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 😄

Copy link
Owner

Choose a reason for hiding this comment

The 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:

  • keep it as a minor version bump
  • don't worry about backward compatible handling
  • could place somewhere a condition and fail if the old value is set. (I'm not sure the best convention of where to declare such template guards)

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 additionalProperties key being false should guard against that.

@Sammcb
Copy link
Contributor Author

Sammcb commented May 8, 2025

Renamed the secret/configmap objects to better clarify their purpose. Users can now choose to use a Secret or ConfigMap for storing allow/deny list config. Also, with the addition of the "additionalProperties": false value, if a user has autoScaleUp set, they will be warned that it does not match the schema.

Copy link
Owner

@itzg itzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those updates looked great. Thanks!

@itzg itzg merged commit 4c9a8da into itzg:master May 9, 2025
1 check passed
@Sammcb Sammcb deleted the routerupdate branch May 9, 2025 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Router updates
2 participants