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

Support for ODF Worker Replace #4600

Merged
merged 2 commits into from
Jun 14, 2023

Conversation

aayushsss1
Copy link
Contributor

This allows user to easily replace worker nodes with openshift-data-foundation installed through terraform.

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:

$ make testacc TESTARGS='-run=TestAccXXX'

...

@aayushsss1 aayushsss1 marked this pull request as ready for review June 5, 2023 04:21
@aayushsss1 aayushsss1 force-pushed the tf-odf-worker-replace branch 4 times, most recently from 00a53d1 to 62568a6 Compare June 7, 2023 04:03
func int32Ptr(i int32) *int32 { return &i }

// To execute a given template using the openshift go client
func ExecuteTemplate(osdID string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets discuss this function over webex once.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah sure!

@aayushsss1 aayushsss1 force-pushed the tf-odf-worker-replace branch from 62568a6 to ef430ad Compare June 9, 2023 05:30
@aayushsss1 aayushsss1 force-pushed the tf-odf-worker-replace branch 2 times, most recently from 9b8b7bf to 863a5e1 Compare June 12, 2023 12:01
@@ -635,3 +689,23 @@ func vpcClusterVpcWorkersVersionRefreshFunc(client v2.Workers, workerID, cluster
return worker, versionUpdating, nil
}
}

func validateSoftwareDefinedStorage(sds string) error {
var sdsList []string = []string{"ODF", "PTX"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove PTX from here and create a global/constant variable to save these strings.

set[v] = true
}
if !set[strings.ToUpper(sds)] {
return fmt.Errorf("[ERROR] Software Defined Storage not found!")
Copy link
Contributor

Choose a reason for hiding this comment

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

On error, also print the supported values for this parameter.

)

// ODF Struct Defined
type Odf struct{}
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete this.

@hasan4791
Copy link
Contributor

@hkantare Please take a look at this PR. I've completed odf related reviews.

@aayushsss1 aayushsss1 force-pushed the tf-odf-worker-replace branch from c5cffff to 5a9596c Compare June 13, 2023 05:32
@@ -65,6 +71,45 @@ func ResourceIBMContainerVpcWorker() *schema.Resource {
Description: "Cluster name",
},

"sds": {
Type: schema.TypeString,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Introducing a required field wil be breaking change.
sds is a mandatory to provision a worker?

Copy link
Contributor

@hasan4791 hasan4791 Jun 13, 2023

Choose a reason for hiding this comment

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

@aayushsss1 sds parameter should be an optional field. The schema has to be similar to this "check_ptx_status" parameter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated it

@@ -161,10 +215,15 @@ func resourceIBMContainerVpcWorkerCreate(d *schema.ResourceData, meta interface{
return fmt.Errorf("[ERROR] Invalid kubeconfig,, failed to create clientset: %s", err)
}
//3. List pods from kube-system namespace
_, err = clientset.CoreV1().Pods("default").List(context.TODO(), metav1.ListOptions{})
_, err = clientset.CoreV1().Pods("").List(context.TODO(), metav1.ListOptions{})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Pods("") this will pods from all namespaces?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated it to get pods from kube-system

@aayushsss1 aayushsss1 force-pushed the tf-odf-worker-replace branch 5 times, most recently from a5d4c03 to 72b363a Compare June 14, 2023 09:20
@@ -65,6 +71,46 @@ func ResourceIBMContainerVpcWorker() *schema.Resource {
Description: "Cluster name",
},

"sds": {
Type: schema.TypeString,
Required: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Its still showing required!!

Required: true,
ForceNew: true,
Optional: true,
Description: "Name of Software Defined Storage",
Copy link
Contributor

Choose a reason for hiding this comment

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

Also include diff supress for this parameter.

@@ -65,6 +71,46 @@ func ResourceIBMContainerVpcWorker() *schema.Resource {
Description: "Cluster name",
},

"sds": {
Copy link
Contributor

Choose a reason for hiding this comment

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

"sds" & "kube_config_path" parameter are dependent to each other. So update the schema with "RequiredWith" also.

@aayushsss1 aayushsss1 force-pushed the tf-odf-worker-replace branch from 72b363a to 79e2978 Compare June 14, 2023 10:28
secrets added

secrets.baseline modified

Example/Openshift-Data_Foundation Updated

input.tfvars updated

Dev note added

docs reverted

deployment fix

docs updated

mod and sum updated

doc updated

naming convention

WaitFor functions added

doc updated

Review Comments added

secrets and struct updated

Further updates (#3)

* Updates

* file renamed

* Return error

validate function added

review comments added

comments removed

optional field added for sds

pods from kube-system

secrets baseline updated

sds schema updated

schema updated
@aayushsss1 aayushsss1 force-pushed the tf-odf-worker-replace branch from 79e2978 to b61ba2b Compare June 14, 2023 10:33
@hkantare hkantare merged commit a50a192 into IBM-Cloud:master Jun 14, 2023
omaraibrahim pushed a commit to omaraibrahim/terraform-provider-ibm that referenced this pull request Jul 20, 2023
* ODF Worker Replace

secrets added

secrets.baseline modified

Example/Openshift-Data_Foundation Updated

input.tfvars updated

Dev note added

docs reverted

deployment fix

docs updated

mod and sum updated

doc updated

naming convention

WaitFor functions added

doc updated

Review Comments added

secrets and struct updated

Further updates (IBM-Cloud#3)

* Updates

* file renamed

* Return error

validate function added

review comments added

comments removed

optional field added for sds

pods from kube-system

secrets baseline updated

sds schema updated

schema updated

* schema updated
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