Skip to content
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

Blueprint jsonnet #214

Merged
merged 4 commits into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions blueprint.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
local cpNodes = std.objectValues(context.cluster.controlplanes.nodes);

// Pick "the first" node in the object as a fallback. If there are no nodes,
// you can default to something known or raise an error.
local firstNode = if std.length(cpNodes) > 0 then
cpNodes[0]
else
error "No controlplane nodes defined";

{
kind: "Blueprint",
apiVersion: "blueprints.windsorcli.dev/v1alpha1",
metadata: {
name: "local",
description: "This blueprint outlines resources in the local context",
},
sources: [
{
name: "core",
url: "github.com/windsorcli/core",
ref: "v0.1.0",
},
],
terraform: [
{
path: "cluster/talos",
values: {
kubernetes_version: "1.30.3",
talos_version: "1.7.6",
cluster_endpoint: "https://"+firstNode.node+":6443",
controlplanes: std.map(function(node)
node, std.objectValues(context.cluster.controlplanes.nodes)),
workers: std.map(function(node)
node, std.objectValues(context.cluster.workers.nodes))
},
variables: {
context_path: {
type: "string",
description: "The path to the context folder, where kubeconfig and talosconfig are stored",
default: "",
},
os_type: {
type: "string",
description: "The operating system type, must be either 'unix' or 'windows'",
default: "unix",
},
kubernetes_version: {
type: "string",
description: "The kubernetes version to deploy.",
default: "1.30.3",
},
talos_version: {
type: "string",
description: "The talos version to deploy.",
default: "1.7.6",
},
cluster_name: {
type: "string",
description: "The name of the cluster.",
default: "talos",
},
cluster_endpoint: {
type: "string",
description: "The external controlplane API endpoint of the kubernetes API.",
default: "https://localhost:6443",
},
controlplanes: {
type: "list(any)",
description: "A list of machine configuration details for control planes.",
default: [],
},
workers: {
type: "list(any)",
description: "A list of machine configuration details",
default: [],
},
common_config_patches: {
type: "string",
description: "A YAML string of common config patches to apply. Can be an empty string or valid YAML.",
default: "",
},
controlplane_config_patches: {
type: "string",
description: "A YAML string of controlplane config patches to apply. Can be an empty string or valid YAML.",
default: "",
},
worker_config_patches: {
type: "string",
description: "A YAML string of worker config patches to apply. Can be an empty string or valid YAML.",
default: "",
},
}
}
],
}
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/compose-spec/compose-go v1.20.2
github.com/getsops/sops/v3 v3.9.2
github.com/goccy/go-yaml v1.15.7
github.com/google/go-jsonnet v0.20.0
github.com/hashicorp/hcl/v2 v2.23.0
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/spf13/cobra v1.8.1
Expand Down Expand Up @@ -141,5 +142,7 @@ require (
google.golang.org/grpc/stats/opentelemetry v0.0.0-20241028142157-ada6787961b3 // indirect
google.golang.org/protobuf v1.36.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
sigs.k8s.io/yaml v1.1.0 // indirect
)
70 changes: 6 additions & 64 deletions go.sum

Large diffs are not rendered by default.

Loading
Loading