-
Notifications
You must be signed in to change notification settings - Fork 9
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
dmitry-spectro
wants to merge
16
commits into
main
Choose a base branch
from
doc-updates
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
17eca04
adding edge-native example
dmitry-spectro 0c50d1a
Merge branch 'main' into doc-updates
nikchern 7ee32b7
DOC-889 adding cluster_vsphere example to template as requested by Karl
dmitry-spectro 361e93e
Merge branch 'doc-updates' of github.com:spectrocloud/terraform-provi…
dmitry-spectro 1bedb75
DOC-894 adding cluster_edge_native template
dmitry-spectro 83be222
DOC-968 adding vSphere and edge cluster profiles
dmitry-spectro f9fe6d3
DOC-908 adding an example of addon deployment
dmitry-spectro cd21552
DOC-967 adding cloudaccount_coxedge example
dmitry-spectro 8632608
DOC-953 adding example for cluster_coxedge
dmitry-spectro 774ad00
DOC-889 adding feedback from Nikolay and Karl: including examples in …
dmitry-spectro 30020ba
DOC-894 adding tffile inclusion for edge-native
dmitry-spectro cdefa4b
DOC-968 moving three cluster profiles to corresponding locations and …
dmitry-spectro 13392a3
DOC-908 providing examples of adding an add-on profile and applying i…
dmitry-spectro fb8d01d
DOC-967 adding cloudaccount_coxedge example
dmitry-spectro 796a68a
DOC-953 adding template and examples for coxedge cluster and profile …
dmitry-spectro f0387ee
DOC-889 modifying headers as suggested by Karl
dmitry-spectro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
terraform { | ||
required_providers { | ||
spectrocloud = { | ||
version = ">= 0.1" | ||
source = "spectrocloud/spectrocloud" | ||
} | ||
} | ||
} | ||
|
||
variable "sc_host" { | ||
description = "Spectro Cloud Endpoint" | ||
default = "api.spectrocloud.com" | ||
} | ||
|
||
variable "sc_api_key" { | ||
description = "Spectro Cloud API key" | ||
} | ||
|
||
variable "sc_project_name" { | ||
description = "Spectro Cloud Project (e.g: Default)" | ||
default = "Default" | ||
} | ||
|
||
provider "spectrocloud" { | ||
host = var.sc_host | ||
api_key = var.sc_api_key | ||
project_name = var.sc_project_name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
data "spectrocloud_cloudaccount_coxedge" "account" { | ||
name = var.shared_coxedge_cloud_account_name | ||
} | ||
|
||
resource "spectrocloud_cloudaccount_coxedge" "account" { | ||
name = "coxedge-account" | ||
organization_id = var.organization_id | ||
environment = var.environment | ||
service = var.service | ||
api_base_url = var.api_base_url | ||
api_key = var.api_key | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
resource "spectrocloud_cluster_coxedge" "cluster" { | ||
name = "tf-coxedge-cluster01" | ||
cloud_account_id = data.spectrocloud_cloudaccount_coxedge.account.id | ||
|
||
cluster_profile { | ||
id = spectrocloud_cluster_profile.profile.id | ||
} | ||
|
||
cloud_config { | ||
environment = "dev" | ||
organization_id = "abcd-efg-hij-klm" | ||
ssh_keys = [ | ||
"ssh-rsa ", | ||
] | ||
|
||
lb_config { | ||
pops = [ | ||
"LAS", | ||
] | ||
} | ||
|
||
worker_lb { | ||
pops = [ | ||
"LAS", | ||
] | ||
} | ||
} | ||
machine_pool { | ||
control_plane = true | ||
control_plane_as_worker = true | ||
name = "master-pool" | ||
count = 1 | ||
cox_config { | ||
spec = "SP-4" | ||
} | ||
} | ||
|
||
machine_pool { | ||
name = "worker-basic" | ||
count = 1 | ||
cox_config { | ||
spec = "SP-4" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
data "spectrocloud_registry" "registry" { | ||
name = "Public Repo" | ||
} | ||
|
||
data "spectrocloud_pack" "csi" { | ||
name = "csi-longhorn" | ||
registry_uid = data.spectrocloud_registry.registry.id | ||
version = "1.5.1" | ||
} | ||
|
||
data "spectrocloud_pack" "cni" { | ||
name = "cni-calico" | ||
registry_uid = data.spectrocloud_registry.registry.id | ||
version = "3.26.1" | ||
} | ||
|
||
data "spectrocloud_pack" "k8s" { | ||
name = "kubernetes-coxedge" | ||
registry_uid = data.spectrocloud_registry.registry.id | ||
version = "1.27.2" | ||
} | ||
|
||
data "spectrocloud_pack" "ubuntu" { | ||
name = "ubuntu-coxedge" | ||
registry_uid = data.spectrocloud_registry.registry.id | ||
version = "20.04" | ||
} | ||
|
||
resource "spectrocloud_cluster_profile" "profile" { | ||
name = "coxedge-profile-tf" | ||
description = "basic cp" | ||
cloud = "coxedge" | ||
type = "cluster" | ||
|
||
pack { | ||
name = "ubuntu-coxedge" | ||
tag = data.spectrocloud_pack.ubuntu.version | ||
uid = data.spectrocloud_pack.ubuntu.id | ||
values = data.spectrocloud_pack.ubuntu.values | ||
} | ||
|
||
pack { | ||
name = "kubernetes-coxedge" | ||
tag = data.spectrocloud_pack.k8s.version | ||
uid = data.spectrocloud_pack.k8s.id | ||
values = data.spectrocloud_pack.k8s.values | ||
} | ||
|
||
pack { | ||
name = "cni-calico" | ||
tag = data.spectrocloud_pack.cni.version | ||
uid = data.spectrocloud_pack.cni.id | ||
values = data.spectrocloud_pack.cni.values | ||
} | ||
|
||
pack { | ||
name = "csi-longhorn" | ||
tag = data.spectrocloud_pack.csi.version | ||
uid = data.spectrocloud_pack.csi.id | ||
values = data.spectrocloud_pack.csi.values | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
variable "organization_id" {} | ||
variable "environment" {} | ||
variable "service" {} | ||
variable "api_key" {} | ||
variable "api_base_url" { | ||
default = "https://portal.coxedge.com/api/v2" | ||
} | ||
|
||
variable "shared_coxedge_cloud_account_name" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
resource "spectrocloud_addon_deployment" "depl" { | ||
cluster_uid = spectrocloud_cluster_edge_native.cluster.id | ||
context = "project" | ||
|
||
cluster_profile { | ||
id = spectrocloud_cluster_profile.profile-addon.id | ||
pack { | ||
name = data.spectrocloud_pack.dashboard.name | ||
tag = data.spectrocloud_pack.dashboard.version | ||
uid = data.spectrocloud_pack.dashboard.id | ||
values = data.spectrocloud_pack.dashboard.values | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: harbor.mycompany.tld | ||
system.repo: ubuntu | ||
system.k8sDistribution: k3s | ||
system.osName: ubuntu | ||
system.peVersion: v4.1.2 | ||
system.customTag: mytag | ||
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
data "spectrocloud_pack" "dashboard" { | ||
registry_uid = data.spectrocloud_registry.registry.id | ||
name = "spectro-k8s-dashboard" | ||
version = "2.7.1" | ||
} | ||
|
||
resource "spectrocloud_cluster_profile" "profile-addon" { | ||
name = "edge-profile-addon-tf" | ||
description = "addon cp" | ||
tags = ["dev", "department:devops", "owner:alice"] | ||
cloud = "edge-native" | ||
type = "add-on" | ||
|
||
pack { | ||
name = data.spectrocloud_pack.dashboard.name | ||
tag = data.spectrocloud_pack.dashboard.version | ||
uid = data.spectrocloud_pack.dashboard.id | ||
values = data.spectrocloud_pack.dashboard.values | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.