turtles/examples
Furkat Gofurov 7f4250dd35
Bump k8s dependencies to v1.32.x series
Signed-off-by: Furkat Gofurov <furkat.gofurov@suse.com>
2025-10-01 13:16:43 +03:00
..
applications Rename `HelmApp` to `HelmOp` in examples folder 2025-08-15 13:01:59 +03:00
clusterclasses Bump k8s dependencies to v1.32.x series 2025-10-01 13:16:43 +03:00
clusters/docker/rke2 Bump k8s dependencies to v1.32.x series 2025-10-01 13:16:43 +03:00
README.md Add ability to run examples CLI with `go run` from tag (#1454) 2025-06-10 14:28:56 +02:00
go.mod chore(deps): Bump github.com/spf13/pflag 2025-09-08 05:27:35 +00:00
go.sum chore(deps): Bump github.com/spf13/pflag 2025-09-08 05:27:35 +00:00
main.go Add examples tooling (#1388) 2025-05-26 11:39:38 +00:00

README.md

Examples CLI Tool

This CLI tool is designed to extract and apply cluster class examples.

Usage

From the examples/ directory, configure the go workspace and download the dependencies:

go work use ./
go mod download

Run the program with:

go run main.go <search_key>

<search_key>: The key to search for in the available cluster classes. In case of an incorrect ClusterClass key used, the closest matching key will be suggested.

Flags

  • -l, --list: List available cluster class names from examples.
  • -r, --regex: ClusterClass search regex.

Examples

List available cluster classes

go run main.go -l

Example output:

Available classes: [azure-aks-example azure-example azure-rke2-example]

Search for a specific cluster class

go run main.go azure-aks

Search for cluster classes using a regex

go run main.go -r "azure"

Note: Regex search can return multiple examples.

To apply the extracted examples, you can use the following command:

go run main.go <search_key> | kubectl apply -f -

Running from tag or latest

You can run the examples CLI tool using go run. This method allows you to execute the tool directly from the module path without needing to clone the repository locally first.

Using a specific tag (@<tag>) is recommended for reproducible results, while @latest will always fetch the most recent version.

To run the latest version:

go run github.com/rancher/turtles/examples@latest

To run from a specific tag:

go run github.com/rancher/turtles/examples@<tag>

Make sure to replace <tag> with the desired tag name.

Example: applying a specific cluster class from a specific tag

Apply examples from the azure-aks cluster class in the default namespace:

go run github.com/rancher/turtles/examples@<tag> azure-aks | kubectl apply -f -

Apply all azure example cluster classes in a custom namespace:

go run github.com/rancher/turtles/examples@<tag> -r azure | kubectl apply -f -n <namespace> -