Skip to content

Conversation

@riptide-01
Copy link
Member

@riptide-01 riptide-01 commented Dec 9, 2025

It provides settings validator hook

func check(_ context.Context, input settingscheck.Input) settingscheck.Result {
	replicas := input.Settings.Get("replicas").Int()
	if replicas == 0 {
		return settingscheck.Reject("replicas cannot be 0")
	}

	var warnings []string
	if replicas == 2 {
		warnings = append(warnings, "replicas cannot be greater than 3")
	}

	if replicas > 3 {
		return settingscheck.Reject("replicas cannot be greater than 3")
	}

	return settingscheck.Allow(warnings...)
}

func main() {
	app.Run(app.WithSettingsCheck(check))
}

@riptide-01 riptide-01 requested a review from ipaqsa December 9, 2025 09:03
@riptide-01 riptide-01 self-assigned this Dec 9, 2025
Signed-off-by: Smyslov Maxim <maksim.smyslov@flant.com>
@riptide-01 riptide-01 force-pushed the feature/values-validation branch from 9b0043b to 78cb1a9 Compare December 9, 2025 09:06
@ipaqsa ipaqsa changed the title values check hook [feature] package settings validator hooks Dec 9, 2025
@ipaqsa ipaqsa requested a review from ldmonster December 9, 2025 09:55
@ipaqsa ipaqsa added enhancement New feature or request go Pull requests that update go code labels Dec 9, 2025
Signed-off-by: Smyslov Maxim <maksim.smyslov@flant.com>
Signed-off-by: Smyslov Maxim <maksim.smyslov@flant.com>
@riptide-01 riptide-01 force-pushed the feature/values-validation branch from b3c6a39 to 65cf21a Compare December 9, 2025 12:32
@riptide-01 riptide-01 marked this pull request as ready for review December 9, 2025 12:32
Signed-off-by: Smyslov Maxim <maksim.smyslov@flant.com>
@riptide-01 riptide-01 force-pushed the feature/values-validation branch from 65cf21a to 52b4f4c Compare December 9, 2025 12:41
@ipaqsa ipaqsa force-pushed the feature/values-validation branch 3 times, most recently from 92846a4 to 165d5e7 Compare December 12, 2025 12:49
@ipaqsa ipaqsa changed the title [feature] package settings validator hooks [feature] package settings chekcer Dec 12, 2025
Signed-off-by: Stepan Paksashvili <stepan.paksashvili@flant.com>
@ipaqsa ipaqsa force-pushed the feature/values-validation branch from 165d5e7 to 4a30b39 Compare December 12, 2025 12:53
@ipaqsa ipaqsa changed the title [feature] package settings chekcer [feature] package settings checks Dec 15, 2025
Added a new example for module hooks demonstrating settings checking. Updated the main README to include a link to this new example.

Signed-off-by: Smyslov Maxim <maksim.smyslov@flant.com>
@riptide-01 riptide-01 force-pushed the feature/values-validation branch from cf714e8 to 1e597e7 Compare December 15, 2025 14:51
Signed-off-by: Stepan Paksashvili <stepan.paksashvili@flant.com>
Signed-off-by: Stepan Paksashvili <stepan.paksashvili@flant.com>
Signed-off-by: Stepan Paksashvili <stepan.paksashvili@flant.com>
Signed-off-by: Stepan Paksashvili <stepan.paksashvili@flant.com>
@ipaqsa ipaqsa merged commit 74a8869 into main Dec 17, 2025
23 checks passed
@ldmonster ldmonster deleted the feature/values-validation branch December 17, 2025 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants