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

adding edge-native example #395

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
5 changes: 2 additions & 3 deletions examples/e2e/edge-native/kubectl.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
resource "local_file" "kubeconfig" {
content = spectrocloud_cluster_edge_native.cluster.kubeconfig
filename = "kubeconfig_ne-2"
content = local.cluster_kubeconfig
filename = "kubeconfig_edge-1"
file_permission = "0644"
directory_permission = "0755"
# sensitive_content = true
}
26 changes: 7 additions & 19 deletions examples/e2e/edge-native/resource_cluster.tf
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
resource "spectrocloud_cluster_edge_native" "cluster" {
name = "edge-native-example"
skip_completion = true
name = "edge-native-tf-1"
skip_completion = false

cluster_profile {
id = data.spectrocloud_cluster_profile.profile.id
id = spectrocloud_cluster_profile.profile.id
}

cloud_config {
ssh_key = "spectro2022"
# For Multiple ssh_keys
# ssh_keys = ["spectro2022","spectro2023"]
vip = "192.168.100.15"
ssh_keys = ["spectro2023","spectro2024"]
vip = var.vip
}

machine_pool {
Expand All @@ -19,19 +17,9 @@ resource "spectrocloud_cluster_edge_native" "cluster" {
name = "master-pool"

edge_host {
host_uid = spectrocloud_appliance.appliance0.uid
static_ip = "126.10.10.23"
host_uid = var.edge_id
#static_ip = "123.45.67.89"
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's put some description about use-cases where static IP may be optional.

Copy link
Contributor

Choose a reason for hiding this comment

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

Overall I would wait for overlay feature to land before we revisit this example.

}

}

machine_pool {
name = "worker-pool"

edge_host {
host_uid = spectrocloud_appliance.appliance1.uid
static_ip = "136.10.10.24"
}
}

}
69 changes: 64 additions & 5 deletions examples/e2e/edge-native/resource_clusterprofile.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,66 @@
data "spectrocloud_cluster_profile" "profile" {
name = "edge-native-infra"
#Define a public repo as registry for packs
data "spectrocloud_registry" "registry" {
name = "Public Repo"
}

output "same" {
value = data.spectrocloud_cluster_profile.profile
}
data "spectrocloud_pack" "cni" {
registry_uid = data.spectrocloud_registry.registry.id
name = "cni-calico"
version = "3.26.1"
}

data "spectrocloud_pack" "k8s" {
registry_uid = data.spectrocloud_registry.registry.id
name = "edge-k3s"
version = "1.27.2"
}

data "spectrocloud_pack" "os" {
registry_uid = data.spectrocloud_registry.registry.id
name = "edge-native-byoi"
version = "1.0.0"
}

resource "spectrocloud_cluster_profile" "profile" {
name = "edge-profile-tf"
description = "basic cp"
tags = ["dev", "department:devops", "owner:alice"]
cloud = "edge-native"
type = "cluster"

pack {
name = data.spectrocloud_pack.os.name
tag = data.spectrocloud_pack.os.version
uid = data.spectrocloud_pack.os.id
#values = data.spectrocloud_pack.os.values
values = <<-EOT
pack:
content:
images:
- image: "{{.spectro.pack.edge-native-byoi.options.system.uri}}"
options:
system.uri: "{{ .spectro.pack.edge-native-byoi.options.system.registry }}/{{ .spectro.pack.edge-native-byoi.options.system.repo }}:{{ .spectro.pack.edge-native-byoi.options.system.k8sDistribution }}-{{ .spectro.system.kubernetes.version }}-{{ .spectro.pack.edge-native-byoi.options.system.peVersion }}-{{ .spectro.pack.edge-native-byoi.options.system.customTag }}"
system.registry: HERE-GOES-YOUR-REGISTRY
system.repo: ubuntu
system.k8sDistribution: k3s
system.osName: ubuntu
system.peVersion: v4.1.2
system.customTag: HERE-GOES-YOUR-CUSTOM-TAG
system.osVersion: 22
EOT
}

pack {
name = data.spectrocloud_pack.k8s.name
tag = data.spectrocloud_pack.k8s.version
uid = data.spectrocloud_pack.k8s.id
values = data.spectrocloud_pack.k8s.values
}

pack {
name = data.spectrocloud_pack.cni.name
tag = data.spectrocloud_pack.cni.version
uid = data.spectrocloud_pack.cni.id
values = data.spectrocloud_pack.cni.values
}
}
5 changes: 4 additions & 1 deletion examples/e2e/edge-native/variables.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Cluster
variable "cluster_ssh_key_name" {
default = "spectro2020"
default = "spectro2024"
}

variable "vip" {}
variable "edge_id" {}

#variable "master_appliance_name" {}

#variable "worker_appliance_name" {}