Skip to content

Commit

Permalink
BET-4856: BET-4857: BET-4883: Fixing plan and apply for libvirt addin…
Browse files Browse the repository at this point in the history
…g min/max for TKE.

* BET-4856: BET-4857: fix update plan and apply.

* BET-4856: BET-4857: fix libvirt example.

* BET-4883: min and max properties added for TKE.
  • Loading branch information
nikchern authored Apr 19, 2022
1 parent 663cc42 commit 9caa256
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 12 deletions.
51 changes: 49 additions & 2 deletions examples/edge/config/cluster/cluster-edge-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,65 @@ profiles:
name: withoutcreds-full
cloud_config:
ssh_key: spectro2022

cluster_rbac_binding:
- type: "ClusterRoleBinding"
role:
kind: "ClusterRole"
name: "testRole3"
subjects:
- type: "User"
name: "testRoleUser3"
- type: "Group"
name: "testRoleGroup3"
- type: "ServiceAccount"
name: "testrolesubject3"
namespace: "testrolenamespace"
- type: "RoleBinding"
namespace: "test5ns"
role:
kind: "Role"
name: "testRoleFromNS3"
subjects:
- type: "User"
name: "testUserRoleFromNS3"
- type: "Group"
name: "testGroupFromNS3"
- type: "ServiceAccount"
name: "testrolesubject3"
namespace: "testrolenamespace"

namespaces:
- name: "test5ns"
resource_allocation:
cpu_cores: "2"
memory_MiB: "2048"

node_groups:
- name: master-pool
control_plane: true
control_plane_as_worker: true
count: 1
placements:
- appliance: "edge-mar-6"
- appliance: "edge-apr-5"

- name: worker-pool
count: 1
placements:
- appliance: "edge-mar-6"
- appliance: "edge-apr-5"

additional_labels:
#name: "worker"
addlabel: "addlabelval1"


taints:
- key: "taintkey1"
value: "taintvalue1"
effect: "PreferNoSchedule"
- key: "taintkey2"
value: "taintvalue2"
effect: "NoSchedule"

scan_policy:
configuration_scan_schedule: "0 0 * * SUN"
Expand Down
8 changes: 4 additions & 4 deletions examples/edge/config/profile/profile-withoutcreds-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ packs:
pack:
content:
images:
- gcr.io/spectro-images-public/calico/kube-controllers:v3.19.0
- gcr.io/spectro-images-public/calico/node:v3.19.0
- gcr.io/spectro-images-public/calico/cni:v3.19.0
- gcr.io/spectro-images-public/calico/pod2daemon-flexvol:v3.19.0
- image: gcr.io/spectro-images-public/calico/kube-controllers:v3.19.0
- image: gcr.io/spectro-images-public/calico/node:v3.19.0
- image: gcr.io/spectro-images-public/calico/cni:v3.19.0
- image: gcr.io/spectro-images-public/calico/pod2daemon-flexvol:v3.19.0
manifests:
calico:
Expand Down
2 changes: 0 additions & 2 deletions examples/libvirt/config/cluster/cluster-libvirt-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ node_groups:
- appliance: "libvirt-nik-mar-21"
network_type: "bridge"
network_names: "br0"
network: "br"
image_storage_pool: "ehl_images"
target_storage_pool: "ehl_images"
data_storage_pool: "ehl_data"
Expand All @@ -80,7 +79,6 @@ node_groups:
- appliance: "libvirt-nik-mar-21"
network_type: "bridge"
network_names: "br0"
network: "br"
image_storage_pool: "ehl_images"
target_storage_pool: "ehl_images"
data_storage_pool: "ehl_data"
Expand Down
3 changes: 0 additions & 3 deletions spectro-appliance.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ locals {
all_appliance_uids = setsubtract(local.cluster_appliance_uids, [""])
}

output "cluster_appliance_uids" {
value = local.all_appliance_uids
}

data "spectrocloud_appliance" "this" {
for_each = local.all_appliance_uids
Expand Down
3 changes: 3 additions & 0 deletions spectro-cluster-edge-vsphere.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ resource "spectrocloud_cluster_edge_vsphere" "this" {
content {
name = pack.value.name
tag = try(pack.value.version, "")
registry_uid = try(local.all_registry_map[pack.value.registry][0], "")
type = (try(pack.value.is_manifest_pack, false)) ? "manifest" : "spectro"
values = (try(pack.value.is_manifest_pack, false)) ? local.cluster-profile-pack-map[format("%s-%s", each.value.profiles.infra.name, pack.value.name)].values : (pack.value.override_type == "values") ? pack.value.values : (pack.value.override_type == "params" ? local.infra-pack-params-replaced[format("%s-%s-%s", each.value.name, each.value.profiles.infra.name, pack.value.name)] : local.infra-pack-template-params-replaced[format("%s-%s-%s", each.value.name, each.value.profiles.infra.name, pack.value.name)])

Expand All @@ -81,6 +82,7 @@ resource "spectrocloud_cluster_edge_vsphere" "this" {
content {
name = pack.value.name
tag = try(pack.value.version, "")
registry_uid = try(local.all_registry_map[pack.value.registry][0], "")
type = (try(pack.value.is_manifest_pack, false)) ? "manifest" : "spectro"
values = (try(pack.value.is_manifest_pack, false)) ? local.cluster-profile-pack-map[format("%s-%s", each.value.profiles.system.name, pack.value.name)].values : (pack.value.override_type == "values") ? pack.value.values : (pack.value.override_type == "params" ? local.infra-pack-params-replaced[format("%s-%s-%s", each.value.name, each.value.profiles.system.name, pack.value.name)] : local.infra-pack-template-params-replaced[format("%s-%s-%s", each.value.name, each.value.profiles.system.name, pack.value.name)])

Expand Down Expand Up @@ -109,6 +111,7 @@ resource "spectrocloud_cluster_edge_vsphere" "this" {
content {
name = pack.value.name
tag = try(pack.value.version, "")
registry_uid = try(local.all_registry_map[pack.value.registry][0], "")
type = (try(pack.value.is_manifest_pack, false)) ? "manifest" : "spectro"
values = (try(pack.value.is_manifest_pack, false)) ? local.cluster-profile-pack-map[format("%s-%s", cluster_profile.value.name, pack.value.name)].values : (pack.value.override_type == "values") ? pack.value.values : (pack.value.override_type == "params" ? local.addon_pack_params_replaced[format("%s-%s-%s", each.value.name, cluster_profile.value.name, pack.value.name)] : local.addon_pack_template_params_replaced[format("%s-%s-%s", each.value.name, cluster_profile.value.name, pack.value.name)])

Expand Down
3 changes: 3 additions & 0 deletions spectro-cluster-edge.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ resource "spectrocloud_cluster_edge" "this" {
content {
name = pack.value.name
tag = try(pack.value.version, "")
registry_uid = try(local.all_registry_map[pack.value.registry][0], "")
type = (try(pack.value.is_manifest_pack, false)) ? "manifest" : "spectro"
values = (try(pack.value.is_manifest_pack, false)) ? local.cluster-profile-pack-map[format("%s-%s", each.value.profiles.infra.name, pack.value.name)].values : (pack.value.override_type == "values") ? pack.value.values : (pack.value.override_type == "params" ? local.infra-pack-params-replaced[format("%s-%s-%s", each.value.name, each.value.profiles.infra.name, pack.value.name)] : local.infra-pack-template-params-replaced[format("%s-%s-%s", each.value.name, each.value.profiles.infra.name, pack.value.name)])

Expand All @@ -75,6 +76,7 @@ resource "spectrocloud_cluster_edge" "this" {
content {
name = pack.value.name
tag = try(pack.value.version, "")
registry_uid = try(local.all_registry_map[pack.value.registry][0], "")
type = (try(pack.value.is_manifest_pack, false)) ? "manifest" : "spectro"
values = (try(pack.value.is_manifest_pack, false)) ? local.cluster-profile-pack-map[format("%s-%s", each.value.profiles.system.name, pack.value.name)].values : (pack.value.override_type == "values") ? pack.value.values : (pack.value.override_type == "params" ? local.infra-pack-params-replaced[format("%s-%s-%s", each.value.name, each.value.profiles.system.name, pack.value.name)] : local.infra-pack-template-params-replaced[format("%s-%s-%s", each.value.name, each.value.profiles.system.name, pack.value.name)])

Expand Down Expand Up @@ -103,6 +105,7 @@ resource "spectrocloud_cluster_edge" "this" {
content {
name = pack.value.name
tag = try(pack.value.version, "")
registry_uid = try(local.all_registry_map[pack.value.registry][0], "")
type = (try(pack.value.is_manifest_pack, false)) ? "manifest" : "spectro"
values = (try(pack.value.is_manifest_pack, false)) ? local.cluster-profile-pack-map[format("%s-%s", cluster_profile.value.name, pack.value.name)].values : (pack.value.override_type == "values") ? pack.value.values : (pack.value.override_type == "params" ? local.addon_pack_params_replaced[format("%s-%s-%s", each.value.name, cluster_profile.value.name, pack.value.name)] : local.addon_pack_template_params_replaced[format("%s-%s-%s", each.value.name, cluster_profile.value.name, pack.value.name)])

Expand Down
2 changes: 2 additions & 0 deletions spectro-cluster-eks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ resource "spectrocloud_cluster_eks" "this" {
content {
name = pack.value.name
tag = try(pack.value.version, "")
registry_uid = try(local.all_registry_map[pack.value.registry][0], "")
type = (try(pack.value.is_manifest_pack, false)) ? "manifest" : "spectro"
values = (try(pack.value.is_manifest_pack, false)) ? local.cluster-profile-pack-map[format("%s-%s", each.value.profiles.infra.name, pack.value.name)].values : (pack.value.override_type == "values") ? pack.value.values : (pack.value.override_type == "params" ? local.infra-pack-params-replaced[format("%s-%s-%s", each.value.name, each.value.profiles.infra.name, pack.value.name)] : local.infra-pack-template-params-replaced[format("%s-%s-%s", each.value.name, each.value.profiles.infra.name, pack.value.name)])

Expand All @@ -36,6 +37,7 @@ resource "spectrocloud_cluster_eks" "this" {
content {
name = pack.value.name
tag = try(pack.value.version, "")
registry_uid = try(local.all_registry_map[pack.value.registry][0], "")
type = (try(pack.value.is_manifest_pack, false)) ? "manifest" : "spectro"
values = (try(pack.value.is_manifest_pack, false)) ? local.cluster-profile-pack-map[format("%s-%s", cluster_profile.value.name, pack.value.name)].values : (pack.value.override_type == "values") ? pack.value.values : (pack.value.override_type == "params" ? local.addon_pack_params_replaced[format("%s-%s-%s", each.value.name, cluster_profile.value.name, pack.value.name)] : local.addon_pack_template_params_replaced[format("%s-%s-%s", each.value.name, cluster_profile.value.name, pack.value.name)])

Expand Down
5 changes: 4 additions & 1 deletion spectro-cluster-libvirt.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ resource "spectrocloud_cluster_libvirt" "this" {
content {
name = pack.value.name
tag = try(pack.value.version, "")
registry_uid = try(local.all_registry_map[pack.value.registry][0], "")
type = (try(pack.value.is_manifest_pack, false)) ? "manifest" : "spectro"
values = (try(pack.value.is_manifest_pack, false)) ? local.cluster-profile-pack-map[format("%s-%s", each.value.profiles.infra.name, pack.value.name)].values : (pack.value.override_type == "values") ? pack.value.values : (pack.value.override_type == "params" ? local.infra-pack-params-replaced[format("%s-%s-%s", each.value.name, each.value.profiles.infra.name, pack.value.name)] : local.infra-pack-template-params-replaced[format("%s-%s-%s", each.value.name, each.value.profiles.infra.name, pack.value.name)])

Expand All @@ -77,6 +78,7 @@ resource "spectrocloud_cluster_libvirt" "this" {
content {
name = pack.value.name
tag = try(pack.value.version, "")
registry_uid = try(local.all_registry_map[pack.value.registry][0], "")
type = (try(pack.value.is_manifest_pack, false)) ? "manifest" : "spectro"
values = (try(pack.value.is_manifest_pack, false)) ? local.cluster-profile-pack-map[format("%s-%s", each.value.profiles.system.name, pack.value.name)].values : (pack.value.override_type == "values") ? pack.value.values : (pack.value.override_type == "params" ? local.infra-pack-params-replaced[format("%s-%s-%s", each.value.name, each.value.profiles.system.name, pack.value.name)] : local.infra-pack-template-params-replaced[format("%s-%s-%s", each.value.name, each.value.profiles.system.name, pack.value.name)])

Expand Down Expand Up @@ -105,6 +107,7 @@ resource "spectrocloud_cluster_libvirt" "this" {
content {
name = pack.value.name
tag = try(pack.value.version, "")
registry_uid = try(local.all_registry_map[pack.value.registry][0], "")
type = (try(pack.value.is_manifest_pack, false)) ? "manifest" : "spectro"
values = (try(pack.value.is_manifest_pack, false)) ? local.cluster-profile-pack-map[format("%s-%s", cluster_profile.value.name, pack.value.name)].values : (pack.value.override_type == "values") ? pack.value.values : (pack.value.override_type == "params" ? local.addon_pack_params_replaced[format("%s-%s-%s", each.value.name, cluster_profile.value.name, pack.value.name)] : local.addon_pack_template_params_replaced[format("%s-%s-%s", each.value.name, cluster_profile.value.name, pack.value.name)])

Expand Down Expand Up @@ -151,7 +154,7 @@ resource "spectrocloud_cluster_libvirt" "this" {
image_storage_pool = placements.value.image_storage_pool
target_storage_pool = placements.value.target_storage_pool
data_storage_pool = placements.value.data_storage_pool
network = placements.value.network
network = try(placements.value.network, "")
}
}

Expand Down
4 changes: 4 additions & 0 deletions spectro-cluster-tke.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ resource "spectrocloud_cluster_tke" "this" {
content {
name = pack.value.name
tag = try(pack.value.version, "")
registry_uid = try(local.all_registry_map[pack.value.registry][0], "")
type = (try(pack.value.is_manifest_pack, false)) ? "manifest" : "spectro"
values = (try(pack.value.is_manifest_pack, false)) ? local.cluster-profile-pack-map[format("%s-%s", each.value.profiles.infra.name, pack.value.name)].values : (pack.value.override_type == "values") ? pack.value.values : (pack.value.override_type == "params" ? local.infra-pack-params-replaced[format("%s-%s-%s", each.value.name, each.value.profiles.infra.name, pack.value.name)] : local.infra-pack-template-params-replaced[format("%s-%s-%s", each.value.name, each.value.profiles.infra.name, pack.value.name)])

Expand All @@ -36,6 +37,7 @@ resource "spectrocloud_cluster_tke" "this" {
content {
name = pack.value.name
tag = try(pack.value.version, "")
registry_uid = try(local.all_registry_map[pack.value.registry][0], "")
type = (try(pack.value.is_manifest_pack, false)) ? "manifest" : "spectro"
values = (try(pack.value.is_manifest_pack, false)) ? local.cluster-profile-pack-map[format("%s-%s", cluster_profile.value.name, pack.value.name)].values : (pack.value.override_type == "values") ? pack.value.values : (pack.value.override_type == "params" ? local.addon_pack_params_replaced[format("%s-%s-%s", each.value.name, cluster_profile.value.name, pack.value.name)] : local.addon_pack_template_params_replaced[format("%s-%s-%s", each.value.name, cluster_profile.value.name, pack.value.name)])

Expand Down Expand Up @@ -101,6 +103,8 @@ resource "spectrocloud_cluster_tke" "this" {
content {
name = machine_pool.value.name
count = machine_pool.value.count
min = try(machine_pool.value.min, "")
max = try(machine_pool.value.max, "")
instance_type = machine_pool.value.instance_type
az_subnets = machine_pool.value.worker_subnets
disk_size_gb = machine_pool.value.disk_size_gb
Expand Down

0 comments on commit 9caa256

Please sign in to comment.