Skip to content

Commit

Permalink
K8s-9382 optional server group setting for node deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
multi-io committed Mar 25, 2024
1 parent 6ba753e commit 16fd208
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ DOMAIN=syseleven.de
NAMESPACE=syseleven
PKG_NAME=metakube
BINARY=terraform-provider-${PKG_NAME}
VERSION=5.1.0
VERSION=5.3.0
PLATFORM?=darwin_arm64
SWEEP_DIR?=./metakube
SWEEP?=all
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.30.0
github.com/mitchellh/go-homedir v1.1.0
github.com/syseleven/go-metakube v0.0.0-20230901105753-2acbd56de0ef
github.com/syseleven/go-metakube v0.0.0-20240214142853-81d7b38e0508
go.uber.org/zap v1.19.0
golang.org/x/mod v0.14.0
)
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PK
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/syseleven/go-metakube v0.0.0-20230901105753-2acbd56de0ef h1:vHHN4hkSmM1hkdDwO3/Ty3Ywwk5KHF69POdzRmo5sgk=
github.com/syseleven/go-metakube v0.0.0-20230901105753-2acbd56de0ef/go.mod h1:Wmf9qWGkFXBGAJxXuwGH+SH6eq9txahkGRpTUz/JFhY=
github.com/syseleven/go-metakube v0.0.0-20240211202621-277eddb8f1a0 h1:pJzmO6gQjkg7z+vWCbZTyOD2V0i2qcJQt5zFCFjlRaA=
github.com/syseleven/go-metakube v0.0.0-20240211202621-277eddb8f1a0/go.mod h1:Wmf9qWGkFXBGAJxXuwGH+SH6eq9txahkGRpTUz/JFhY=
github.com/syseleven/go-metakube v0.0.0-20240214142853-81d7b38e0508 h1:rScPM+QK5iFQgm9rKo88jI9HuDMS9F5MWy22VgLhGVE=
github.com/syseleven/go-metakube v0.0.0-20240214142853-81d7b38e0508/go.mod h1:Wmf9qWGkFXBGAJxXuwGH+SH6eq9txahkGRpTUz/JFhY=
github.com/syseleven/terraform-plugin-sdk/v2 v2.31.0-sys11-2 h1:vywVVW9AnKcEiqgbZe16wwuaQaZ8VtMe+xmNBdvdMnU=
github.com/syseleven/terraform-plugin-sdk/v2 v2.31.0-sys11-2/go.mod h1:i2C41tszDjiWfziPQDL5R/f3Zp0gahXe5No/MIO9rCE=
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
Expand Down
11 changes: 11 additions & 0 deletions metakube/resource_node_deployment_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,17 @@ func matakubeResourceNodeDeploymentCloudOpenstackSchema() map[string]*schema.Sch
Description: "Specifies how long should the controller check if instance is ready before timing out",
ValidateDiagFunc: isNonEmptyDurationString,
},
"server_group_id": {
Type: schema.TypeString,
Optional: true,
Default: "",
DiffSuppressFunc: func(k, oldValue, newValue string, d *schema.ResourceData) bool {
// if the value is set in the state and unset in the config, the update will not change it
// => suppress the diff
return oldValue != "" && newValue == ""
},
Description: "Specifies the ID of the server group for nodes in the nodes deployment. Defaults to the cluster setting",
},
}
}

Expand Down
10 changes: 10 additions & 0 deletions metakube/resource_node_deployment_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ func metakubeNodeDeploymentFlattenOpenstackSpec(in *models.OpenstackNodeSpec) []
att["disk_size"] = in.RootDiskSizeGB
}

if in.ServerGroupID != "" {
att["server_group_id"] = in.ServerGroupID
}

return []interface{}{att}
}

Expand Down Expand Up @@ -670,6 +674,12 @@ func metakubeNodeDeploymentExpandOpenstackSpec(p []interface{}) *models.Openstac
}
}

if v, ok := in["server_group_id"]; ok {
if vv, ok := v.(string); ok {
obj.ServerGroupID = vv
}
}

return obj
}

Expand Down

0 comments on commit 16fd208

Please sign in to comment.