-
Notifications
You must be signed in to change notification settings - Fork 673
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
Add satellite features and add support to the user can direct which security groups are added to their workers #4953
Conversation
dcae8af
to
6ebdc51
Compare
go.mod
Outdated
@@ -237,8 +237,12 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt | |||
|
|||
replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 | |||
|
|||
replace github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20231106114255-c50117860a3c => github.com/Blintmester/container-services-go-sdk v0.0.0-20231116135145-fae5e6201d4c // for development only |
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.
I believe these can go, right?
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.
sure, my mistake, fixed it
cfc7b9e
to
b0beebd
Compare
I see the update to allow security groups on vpc create cluster. It was not obvious this PR also includes support to specify security groups on vpc worker pool create. Is that included? |
@@ -322,6 +322,14 @@ func ResourceIBMContainerVpcCluster() *schema.Resource { | |||
RequiredWith: []string{"kms_instance_id", "crk"}, | |||
}, | |||
|
|||
"cluster_security_groups": { |
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.
can we rename this argument security_groups
because the resource already indicates its a cluster
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.
sure, I renamed it
@@ -138,6 +138,18 @@ func DataSourceIBMSatelliteLocation() *schema.Resource { | |||
}, | |||
}, | |||
}, | |||
"service_subnet": { | |||
Type: schema.TypeString, |
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.
In datasource these should be computed only remove optional and forceNew.
Same for pod_subnet
also
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.
fixed it
Fix conflicts in go.mod and go.sum files |
If I can fix everything, go.mod and go.sum files will be fixed. Currently I try to add security_groups to worker_pool resource, will check in if its done! |
b566455
to
be48bc7
Compare
If everything is fine, I'll fix the go.mod conflicts too. |
936af91
to
1c72212
Compare
@hkantare I pushed the docs files too, please can you review it? |
db74ef3
to
e007250
Compare
ibm/flex/structures.go
Outdated
elems := make([]string, 0) | ||
for _, elem := range set.List() { | ||
elems = append(elems, elem.(string)) | ||
} | ||
return elems |
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.
this can be optimised a bit. if you set the capacity of the slice in the make, you can minimise the memory allocations during the appends ( https://stackoverflow.com/questions/57100525/how-does-go-slice-capacity-change-on-append )
ps: you can achieve similar results by setting the length as in FlattenZonesv2
elems := make([]string, 0) | |
for _, elem := range set.List() { | |
elems = append(elems, elem.(string)) | |
} | |
return elems | |
setList := set.List() | |
elems := make([]string, 0, len(setList)) | |
for _, elem := range setList { | |
elems = append(elems, elem.(string)) | |
} | |
return elems |
@@ -322,6 +322,14 @@ func ResourceIBMContainerVpcCluster() *schema.Resource { | |||
RequiredWith: []string{"kms_instance_id", "crk"}, | |||
}, | |||
|
|||
"security_groups": { |
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.
it looks like this parameter can only be set at create
you can use DiffSuppressFunc: flex.ApplyOnce
to ignore any changes to the parameter
or
it can be marked with forcenew to recreate the cluster if this param is changed. this means the original cluster will be deleted, so this should be handled with extra care
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.
I think we should go with ApplyOnce rather than ForceNew.
At the moment, these values can not be changed in the API. If the ability to change the security groups was added in the future and customers update the security groups outside of TF, TF would replace the cluster.
If we go with ApplyOnce, the changes would be ignored until the TF provider supported that functionality at which point we could provide guidance to customers on importing the updated changes and avoid cluster deletion.
@@ -42,7 +44,7 @@ func ResourceIBMContainerWorkerPool() *schema.Resource { | |||
"cluster"), | |||
}, | |||
|
|||
"machine_type": { | |||
"flavor": { |
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.
please don't convert this resource to vpc, there is already a vpc_worker_pool one
Elem: &schema.Schema{Type: schema.TypeString}, | ||
Set: flex.ResourceIBMVPCHash, | ||
}, | ||
|
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.
it looks like it is missing from the API, but...
should we be able to set SecurityGroupIDs to the default workerpool too?
|
||
zones { | ||
name = "us-south-1" | ||
subnet_id = "0716-2389b003-7968-41b1-833c-4d63d7165899" |
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.
please remove the real ids from the example. you can add variables instead
Optional: true, | ||
ForceNew: true, | ||
Description: "Custom subnet CIDR to provide private IP addresses for services", | ||
//Computed: true, |
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.
if it is not needed, please remove it
// flattenHostLabels .. | ||
func FlattenHostLabels(hostLabels []interface{}) map[string]string { | ||
// flatten the provided key-value pairs | ||
func FlattenKeyValues(keyValues []interface{}) map[string]string { |
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.
why did you rename this function?
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.
previously it was used only for flatten Host Labels, but I renamed it and we can use it for everything when we should flatten key-values (map[string]string), and I used it too (and it was not host labels)
@@ -280,6 +280,12 @@ func ResourceIBMSatelliteCluster() *schema.Resource { | |||
Sensitive: true, | |||
Description: "The IBM Cloud Identity and Access Management (IAM) service CRN token for the service that creates the cluster.", | |||
}, | |||
"calico_ip_autodetection": { |
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.
is it only for create too? maybe ApplyOnce or forcenew?
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.
yes, it is only for create, so I'll add ApplyOnce
3798d04
to
2348b4c
Compare
@@ -212,6 +212,14 @@ func ResourceIBMContainerVpcWorkerPool() *schema.Resource { | |||
Computed: true, | |||
Description: "Autoscaling is enabled on the workerpool", | |||
}, | |||
|
|||
"security_groups": { |
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.
can you please add the ApplyOnce diff suppress here too?
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.
sure, will do
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { acc.TestAccPreCheck(t) }, | ||
Providers: acc.TestAccProviders, | ||
// CheckDestroy: testAccCheckIBMContainerVpcClusterDestroy, |
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.
why is it commented out?
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.
the CheckDestroy function fails on every run, because it doesn't wait enough, or something else, I don't really know, but the resource (after a failed run) was destroyed successfully
@@ -212,6 +212,14 @@ func ResourceIBMContainerVpcWorkerPool() *schema.Resource { | |||
Computed: true, | |||
Description: "Autoscaling is enabled on the workerpool", | |||
}, | |||
|
|||
"security_groups": { |
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.
can you please add a test for this too?
zones = var.location_zones | ||
managed_from = var.managed_from | ||
resource_group_id = data.ibm_resource_group.group.id | ||
pod_subnet = var.pod_subnet // "10.42.0.0/16" |
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.
can you please fix the formatting in the example?
7a9e876
to
5a1368e
Compare
…ecurity groups are added to their workers
5a1368e
to
da3a879
Compare
Community Note
Relates OR Closes #0000
Output from acceptance testing: