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

Alb fix and add Ingress status report #5160

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft

Conversation

szombi
Copy link

@szombi szombi commented Feb 29, 2024

The scope of this PR is updating the current ALB solutions based on our current API and introduce ingress status and ingress config in cluster resource and data source.
More info about the ingress status report: https://cloud.ibm.com/docs/containers?topic=containers-ingress-status

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Relates OR Closes #0000

Output from acceptance testing:

resource_ibm_container_cluster_test:
=== RUN   TestAccIBMContainerClusterIngressConfig
--- PASS: TestAccIBMContainerClusterIngressConfig (3489.21s)
PASS
ok  

resource_ibm_container_vpc_cluster_test:
=== RUN   TestAccIBMContainerVpcClusterIngressConfig
--- PASS: TestAccIBMContainerVpcClusterIngressConfig (4855.69s)
PASS
ok  

data_source_ibm_container_cluster_test:
=== RUN   TestAccIBMContainerClusterDataSourceIngressConfig
--- PASS: TestAccIBMContainerClusterDataSourceIngressConfig (2171.34s)
PASS
ok  	github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/kubernetes	2171.718s

data_source_ibm_container_vpc_cluster_test:
=== RUN   TestAccIBMContainerVPCClusterDataSourceIngressConfig
--- PASS: TestAccIBMContainerVPCClusterDataSourceIngressConfig (3884.00s)
PASS

resource_ibm_container_vpc_alb_test:
=== RUN   TestAccIBMContainerVPCClusterALBBasic
--- PASS: TestAccIBMContainerVPCClusterALBBasic (3875.44s)
PASS
ok  	github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/kubernetes	3875.678s


resource_ibm_container_vpc_alb_create_test:
=== RUN   TestAccIBMContainerVPCClusterALBCreate
--- PASS: TestAccIBMContainerVPCClusterALBCreate (3784.44s)
PASS
ok  	github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/kubernetes	3784.656s

resource_ibm_container_alb_test:
=== RUN   TestAccIBMContainerALB_Basic
--- PASS: TestAccIBMContainerALB_Basic (2477.09s)
PASS
ok  	github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/kubernetes	2477.306s

resource_ibm_container_alb_create_test:
=== RUN   TestAccIBMContainerALB_Create
--- PASS: TestAccIBMContainerALB_Create (2133.30s)
PASS
ok  	github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/kubernetes	2133.484s

data_source_ibm_container_alb_test:
=== RUN   TestAccIBMContainerALBDataSource_Basic
--- PASS: TestAccIBMContainerALBDataSource_Basic (4404.49s)
PASS
ok  	github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/kubernetes	4404.632s

@szombi szombi changed the title Alb fix Alb fix and add Ingress status report Mar 12, 2024
ibm/service/kubernetes/data_source_ibm_container_alb.go Outdated Show resolved Hide resolved

targetEnv, err := getClusterTargetHeader(d, meta)
if err != nil {
return err
}

targetEnvV2, err := getVpcClusterTargetHeader(d, meta)

Choose a reason for hiding this comment

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

Bit odd to me that we are calling a vpc function from a data source responsible for classic clusters.

Choose a reason for hiding this comment

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

+1 I believe this change should go to ibm/service/kubernetes/data_source_ibm_container_vpc_cluster.go

Copy link
Author

Choose a reason for hiding this comment

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

Discussed offline, needed because we want to use a v2 API with SDK.

// You need to set up env vars:
// export IBM_CLUSTER_VPC_ID
// export IBM_CLUSTER_VPC_RESOURCE_GROUP_ID
// export IBM_CLUSTER_VPC_SUBNET_ID

Choose a reason for hiding this comment

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

acctest.go could be updated with these filenames for these fields.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

Computed: true,
Description: "Status of the ALB",
},
"ingress_image": {

Choose a reason for hiding this comment

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

Shouldn't we call this field version?

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

ibm/service/kubernetes/resource_ibm_container_alb.go Outdated Show resolved Hide resolved
}

numOfInstances := "2"
if v, ok := d.GetOk("user_ip"); ok {
userIP = v.(string)
}
params := v1.ALBConfig{

Choose a reason for hiding this comment

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

params are only used if the user wants to enable the ALB, we should move initializing/configuring the variable there. I also don't see that setting ingress_image has any effect as it's not passed to the params.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

Type: schema.TypeString,
Computed: true,
Description: "ALB zone",
Deprecated: "Remove this attribute's configuration as it no longer is used",

Choose a reason for hiding this comment

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

Maybe

Suggested change
Deprecated: "Remove this attribute's configuration as it no longer is used",
Deprecated: "This field deprecated and no longer supported",

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

@@ -57,6 +57,11 @@ func DataSourceIBMContainerVPCClusterALB() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"ingress_image": {

Choose a reason for hiding this comment

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

same version related observation

Copy link
Author

Choose a reason for hiding this comment

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

Fixed


targetEnv, err := getClusterTargetHeader(d, meta)
if err != nil {
return err
}

targetEnvV2, err := getVpcClusterTargetHeader(d, meta)

Choose a reason for hiding this comment

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

+1 I believe this change should go to ibm/service/kubernetes/data_source_ibm_container_vpc_cluster.go

Copy link

@SzekeresB SzekeresB left a comment

Choose a reason for hiding this comment

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

General comment: The description fields are sometimes sentences with/without a . and sometimes just a few words. It would be nice to have them in a uniform way.

"version": {
Type: schema.TypeString,
Computed: true,
Description: "The type of Ingress image that you want to use for your ALB deployment.",

Choose a reason for hiding this comment

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

The type is either public or private so I do not think this a valid wording.

Suggested change
Description: "The type of Ingress image that you want to use for your ALB deployment.",
Description: "the version of the ALB image",

Maybe a pointer could be nice to acquire the current supported images, in the description.

And I believe we should change the alb_type description to a more meaningful one like: the type of ALB, available options: public, private but since it is not part of this change I can't comment there.

"version": {
Type: schema.TypeString,
Computed: true,
Description: "The type of Ingress image that you want to use for your ALB deployment.",

Choose a reason for hiding this comment

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

The type is either public or private so I do not think this a valid wording.

Suggested change
Description: "The type of Ingress image that you want to use for your ALB deployment.",
Description: "the version of the ALB image",

Maybe a pointer could be nice to acquire the current supported images, in the description.

@@ -35,7 +35,7 @@ func ResourceIBMContainerAlbCreate() *schema.Resource {
Default: true,
Description: "If set to true, the ALB is enabled by default.",
},
"ingress_image": {
"version": {

Choose a reason for hiding this comment

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

description update

Copy link

@SzucsAti SzucsAti Mar 20, 2024

Choose a reason for hiding this comment

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

As it's an already existing field, we can't just rename it. We have to handle the change properly.


numOfInstances := "2"
if v, ok := d.GetOk("user_ip"); ok {

Choose a reason for hiding this comment

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

This is also only relevant if enable == true, should be moved to the if condition.

@@ -187,7 +217,6 @@ func resourceIBMContainerALBUpdate(d *schema.ResourceData, meta interface{}) err

if d.HasChange("enable") {
enable := d.Get("enable").(bool)
disableDeployment := d.Get("disable_deployment").(bool)
albID := d.Id()
params := v1.ALBConfig{

Choose a reason for hiding this comment

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

Similarly to the other cases, params is only needed if enable == true, should be moved there.

@@ -35,7 +35,7 @@ func ResourceIBMContainerAlbCreate() *schema.Resource {
Default: true,
Description: "If set to true, the ALB is enabled by default.",
},
"ingress_image": {
"version": {
Copy link

@SzucsAti SzucsAti Mar 20, 2024

Choose a reason for hiding this comment

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

As it's an already existing field, we can't just rename it. We have to handle the change properly.

@@ -91,11 +96,13 @@ func ResourceIBMContainerAlbCreate() *schema.Resource {
Type: schema.TypeString,
Computed: true,
Description: "ALB name",
Deprecated: "Remove this attribute's configuration as it no longer is used",

Choose a reason for hiding this comment

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

There are some Deprecated descriptions in this file that should be also updated to be consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants