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

[wmco] WMC controller #15

Conversation

ravisantoshgudimetla
Copy link
Contributor

@ravisantoshgudimetla ravisantoshgudimetla commented Mar 3, 2020

Initial implementation of WMC controller. This will fail because some files are present, fixing tests in progress but the code skeleton & structure can reviewed.

/cc @aravindhp

@openshift-ci-robot openshift-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Mar 3, 2020
@ravisantoshgudimetla ravisantoshgudimetla changed the title [wmco] WMC controller [wmco] [wip]WMC controller Mar 3, 2020
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 3, 2020
@ravisantoshgudimetla
Copy link
Contributor Author

/approve cancel

@openshift-ci-robot openshift-ci-robot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 3, 2020
Copy link
Contributor

@aravindhp aravindhp left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, @ravisantoshgudimetla. The structure looks good more or less. Please address my comments.

go.mod Show resolved Hide resolved
export CLUSTER_ADDR=$(oc cluster-info | head -n1 | sed 's/.*\/\/api.//g'| sed 's/:.*//g')

# Get operator-sdk binary.
# TODO: Make this to download the same version we have in godeps
Copy link
Contributor

Choose a reason for hiding this comment

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

This TODO makes no sense.

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.

@@ -0,0 +1,26 @@
# Script that downloads a file from the server to the output location ignoring the server certificate
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be in an internal assets package?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll change it to internal. When I was working on this, I had this idea of using bindata

@@ -0,0 +1,139 @@
package nodeconfig
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the filename be nodeconfig.go?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see both the patterns in the code bases that I worked I will change the file name to nodeconfig just to be in sync with windowsvm.go. For reference

}

// Handle the node CSR
// Note: for the product we want to get the node name from the instance information
Copy link
Contributor

Choose a reason for hiding this comment

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

This should become a story

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

if err != nil {
return errors.Wrapf(err, "unable to create remote directory %v", remoteDir)
}
file := "pkg/controller/windowsmachineconfig/powershell/wget-ignore-cert.ps1"
Copy link
Contributor

Choose a reason for hiding this comment

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

I am assuming you will use a well know location like payload eventually and the test setup / Dockerfile will copy it over.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is right.


// runBootstrapper copies the bootstrapper and runs the code on the remote Windows VM
func (vm *windowsVM) runBootstrapper() error {
// TODO: This is well known location, we should make sure wmcb exists here
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not for TODOs for stuff like this because it all falls under validation and it is scattered all over the code. Won't it be easier to just do it at least in this instance?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, what I meant was, we can do validation at a single place but until that happens, there should be a TODO.

Comment on lines 59 to 61
if err != nil {
return errors.Wrap(err, "error running bootstrapper")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not sufficient. You should also inspect stderr. I think we are doing some checking like this in our WSU / WMCB test cases. This comment applies to all instances where you are not checking the output of stderr

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the test case scenario, we're running the test binary which gives us strings like FAIL or PANIC etc to validate. So, we cannot have them validated. In case of stderr, as of now, I'm changing the code to check the length of the stderr and if it's greater than 0, I'm returning error.

// runBootstrapper copies the bootstrapper and runs the code on the remote Windows VM
func (vm *windowsVM) runBootstrapper() error {
// TODO: This is well known location, we should make sure wmcb exists here
if err := vm.CopyFile("/payload/wmcb.exe", remoteDir); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use a constant for the exe. Applies to all places where we are using something from the payload directory.


var wmcoTestFramework wmcoFramework

func TestWMCOE2E(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would like this to be split up so that we can test scale up and scale down.

Copy link
Contributor

@sebsoto sebsoto left a comment

Choose a reason for hiding this comment

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

Cool stuff @ravisantoshgudimetla, left a partial review, will check it out more later

k8sclientset *kubernetes.Clientset
}

func NewNodeConfig(clientset *kubernetes.Clientset) *nodeConfig {
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs doc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

// HandleCSRs handles the approval of bootstrap and node CSRs
func (nc *nodeConfig) HandleCSRs() error {
// Handle the bootstrap CSR
err := nc.handleCSR("system:serviceaccount:openshift-machine-config-operator:node-bootstrapper")
Copy link
Contributor

Choose a reason for hiding this comment

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

Move system:serviceaccount:openshift-machine-config-operator:node-bootstrapper to a constant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

return nil
}

// findCSR finds the CSR that matches the requestor filter
Copy link
Contributor

Choose a reason for hiding this comment

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

This finds the CSR that contains the requestor filter, not matches. Seems like this could cause issues if we're not looking for an exact match

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since in our case the machine api won't intervene, this may not be a problem for bootstrap CSRs however we can narrow down the filter to point to node we created. That's part of TODO

if instance.Spec.AWS == nil && instance.Spec.Azure == nil {
return reconcile.Result{}, errors.New("both the supported cloud providers are nil")
}
// As of now think of AWS implementation.
Copy link
Contributor

Choose a reason for hiding this comment

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

I am thinking of it, what now? :P
Not sure what this comment is saying.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted.

if instance.Spec.AWS != nil {
// We assume the cloud provider secret has been mounted to "~/.awscredentials` path
r.cloudProvider, err = cloudprovider.CloudProviderFactory(os.Getenv("KUBECONFIG"),
// We assume the credential path is `/etc/aws/credentials` mounted as a secret.
Copy link
Contributor

Choose a reason for hiding this comment

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

This contradicts the above comment We assume the cloud provider secret has been mounted to "~/.awscredentials path`

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

// populate the windowsVM map here from configmap as source of truth
r.windowsVM = make(map[types.WindowsVM]bool)
}
if r.k8sclientset == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

When would this happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Defensive programming :)

if r.k8sclientset == nil {
return reconcile.Result{}, nil
}
nodes, err := r.k8sclientset.CoreV1().Nodes().List(metav1.ListOptions{LabelSelector: "node.openshift.io/os_id=Windows"})
Copy link
Contributor

Choose a reason for hiding this comment

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

Move label to constant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

// TODO: This can be decomposed further.
// TIP: Have a single method with operation like deletion, creation as argument
if desired < current {
hasDeletionFailed := r.deleteWindowsVMs(current - desired)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Could just call this deletionFailed since its a bool

// Let's not requeue the result for now. We can get the list of errors
hasCreationFailed := r.createWindowsVMs(desired - current)
//r.reconcileCredentials()
return hasCreationFailed
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Could just call this creationFailed since its a bool

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the variable for now altogether, we can add it when we have error slices later.

},
// TODO: If properly done, we should reconcile for creds here :).
// TIP: We can fail on VM creation/deletion reconciliation still reach here to make it more readable
/*if err := r.reconcileCredentials(); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Commented out code 😱

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it, I wanted to give some inputs to @aravindhp so that he can get started on the configmap

Copy link
Contributor

@sebsoto sebsoto left a comment

Choose a reason for hiding this comment

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

Whew lot of code. Good work @ravisantoshgudimetla PTAL at my comments

// deleteWindowsVMs returns the instance IDs of the successfully created Windows VMs
func (r *ReconcileWindowsMachineConfig) deleteWindowsVMs(count int) bool {
hasVMDeletionFailed := false
// From the list of Windows VMs choose randomly count number of VMs. As of now sequential
Copy link
Contributor

Choose a reason for hiding this comment

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

Can reword the comment to be more clear:


// Delete a number of VMs from the list of Windows VMs. VMs to be deleted are picked randomly.
// TODO: Right now VMs are picked sequentially, we should pick the VMs randomly

continue
}
// Delete the Windows VM from cloud provider
log.Info("deleting the Windows VM", instancedID)
Copy link
Contributor

Choose a reason for hiding this comment

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

You provided a variable but no verb here
Try deleting the Windows VM %s, instanceID


// deleteWindowsVMs returns the instance IDs of the successfully created Windows VMs
func (r *ReconcileWindowsMachineConfig) deleteWindowsVMs(count int) bool {
hasVMDeletionFailed := false
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Since its a bool could just do vmDeletionFailed

// TODO: Return a slice of errors and unwrap it at the call site.
func (r *ReconcileWindowsMachineConfig) createWindowsVMs(count int) bool {
// TODO: hasVMCreationfailed should be removed when we move to collect slice of errors.
hasVMCreationfailed := false
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Since its a bool could just do vmCreationFailed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the logic to return bool depending on slice of errors that we can get for each create operation. So no need for that now.

hasVMCreationfailed = true
log.Error(err, "error while creating windows VM", err)
}
log.V(5).Info("created the Windows VM", createdVM.GetCredentials().GetInstanceId())
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: You're changing the way you log when deleting and creating the VMs
log.Info("deleting the Windows VM", instancedID) I think we should stay consistent with this.

Specifically with logging before the action, and using the same command log.Info, as these are actions of equal importance.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also need the verb here as well

test/e2e/wmco_test.go Outdated Show resolved Hide resolved
test/e2e/wmco_test.go Outdated Show resolved Hide resolved
nodes, err := kubeclient.CoreV1().Nodes().List(metav1.ListOptions{LabelSelector: "node.openshift.io/os_id=Windows"})
if err != nil {
if apierrors.IsNotFound(err) {
log.Printf("Waiting for availability of %d windows nodes\n", expectedNodeCount)
Copy link
Contributor

Choose a reason for hiding this comment

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

A newline shouldnt be needed for log statements i thought, they should be on their own line automatically?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think not with Printf but with Println.

log.Println("Created the required number of Windows worker nodes")
return true, nil
}
log.Printf("still waiting for %d number of Windows worker nodes to be created\n", expectedNodeCount)
Copy link
Contributor

Choose a reason for hiding this comment

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

("%d/%d Windows worker nodes created", len(nodes.Items),expectedNodeCount)

test/e2e/wmco_test.go Outdated Show resolved Hide resolved
@sebsoto
Copy link
Contributor

sebsoto commented Mar 6, 2020

/test images

return nil
}

// deleteWindowsVMs returns the instance IDs of the successfully created Windows VMs
Copy link
Member

Choose a reason for hiding this comment

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

seems like the comment needs to be updated, the function is returning a bool and it logs the instance Id of successfully deleted VM.

@sebsoto
Copy link
Contributor

sebsoto commented Mar 9, 2020

/test images

Copy link
Contributor Author

@ravisantoshgudimetla ravisantoshgudimetla left a comment

Choose a reason for hiding this comment

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

Folks - I've addressed most of your comments. PTAL. I am still working on the e2e test suite to make it more extensible. Will send an update soon.

go.mod Show resolved Hide resolved
export CLUSTER_ADDR=$(oc cluster-info | head -n1 | sed 's/.*\/\/api.//g'| sed 's/:.*//g')

# Get operator-sdk binary.
# TODO: Make this to download the same version we have in godeps
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.

@@ -0,0 +1,26 @@
# Script that downloads a file from the server to the output location ignoring the server certificate
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll change it to internal. When I was working on this, I had this idea of using bindata

@@ -0,0 +1,139 @@
package nodeconfig
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see both the patterns in the code bases that I worked I will change the file name to nodeconfig just to be in sync with windowsvm.go. For reference

k8sclientset *kubernetes.Clientset
}

func NewNodeConfig(clientset *kubernetes.Clientset) *nodeConfig {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 59 to 61
if err != nil {
return errors.Wrap(err, "error running bootstrapper")
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the test case scenario, we're running the test binary which gives us strings like FAIL or PANIC etc to validate. So, we cannot have them validated. In case of stderr, as of now, I'm changing the code to check the length of the stderr and if it's greater than 0, I'm returning error.

// TODO: As of now, getting cluster address from the environment var, remove it.
// Download the worker ignition to C:\Windows\Tenp\ using the script that ignores the server cert
ClusterAddress := os.Getenv("CLUSTER_ADDR")
stdout, stderr, err := vm.Run(wgetIgnoreCertCmd+" -server https://api-int."+ClusterAddress+":22623/config/worker"+" -output "+winTemp+"worker.ign", true)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}
file := "pkg/controller/windowsmachineconfig/powershell/wget-ignore-cert.ps1"
if err := vm.CopyFile(file, remoteDir); err != nil {
log.Error(err, "error while copying powershell script")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I am returning it now.

// Download the worker ignition to C:\Windows\Tenp\ using the script that ignores the server cert
ClusterAddress := os.Getenv("CLUSTER_ADDR")
stdout, stderr, err := vm.Run(wgetIgnoreCertCmd+" -server https://api-int."+ClusterAddress+":22623/config/worker"+" -output "+winTemp+"worker.ign", true)
log.V(5).Info("stdout associated with the node", "stdout", stdout)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

ClusterAddress := os.Getenv("CLUSTER_ADDR")
stdout, stderr, err := vm.Run(wgetIgnoreCertCmd+" -server https://api-int."+ClusterAddress+":22623/config/worker"+" -output "+winTemp+"worker.ign", true)
log.V(5).Info("stdout associated with the node", "stdout", stdout)
log.V(5).Info("stderr associated with the node", "stderr", stderr)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@ravisantoshgudimetla
Copy link
Contributor Author

/retest

1 similar comment
@ravisantoshgudimetla
Copy link
Contributor Author

/retest

@ravisantoshgudimetla ravisantoshgudimetla force-pushed the add-wmc-controller branch 4 times, most recently from 6213fb1 to 7a17966 Compare March 11, 2020 17:34

// If any of the Windows VM fails to get deleted consider this as a failure and return false
if len(errs) > 0 {
return false
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we log these errors to track how many VMs failed and why?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes please print the errs variable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't want to do it as it's the job of the caller. In future, we'll return this slice altogether for it to be unwrapped by the caller.

Copy link
Contributor

@sebsoto sebsoto left a comment

Choose a reason for hiding this comment

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

Thanks @ravisantoshgudimetla! Looks mostly good. Looks like test code still isnt finished so I'll wait to review that.

apiVersion: v1
kind: Namespace
metadata:
name: wmco
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you using wmco acronym here and windows-machine-config-operator everywhere else in deploy (SA, deployment etc.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I'll change it. It was something I created for my testing purpose.

@@ -0,0 +1,18 @@
package wellknownlocations
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an odd package name

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Maybe change it to paths

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean well known paths? If it's a nit, I want to ignore that for now may be we can come back with a better naming later.


export CLUSTER_ADDR=$(oc cluster-info | head -n1 | sed 's/.*\/\/api.//g'| sed 's/:.*//g')

# Copy the cloud credentials and KUBESSH key path so that it can be used by operator
Copy link
Contributor

Choose a reason for hiding this comment

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

so that it can -> so that they can

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

package wellknownlocations

const (
// CloudCredentialsPath contains the path to file where cloud credentials are stored. This would've been mounted
Copy link
Contributor

Choose a reason for hiding this comment

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

contains the path to the file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

// PrivateKeyPath contains the path to the private key which is used in decrypting password in case of AWS
// cloud provider. This would have been mounted as a secret by user
PrivateKeyPath = "/etc/private-key.pem"
// WmcbPath contains the path of the Windows Machine Config bootstrapper binary. The container image should already
Copy link
Contributor

Choose a reason for hiding this comment

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

bootstrapper -> Bootstrapper

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

log.Info(fmt.Sprintf("deleting the Windows VM: %s", instancedID))
if err := r.cloudProvider.DestroyWindowsVM(instancedID); err != nil {
log.Error(err, "error while deleting windows VM %s", instancedID)
errs = append(errs, errors.Wrap(err, "One of the VM deletions failed, will reconcile..."))
Copy link
Contributor

Choose a reason for hiding this comment

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

please add which VM failed to delete

Copy link
Contributor

Choose a reason for hiding this comment

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

A wrapped error shouldnt end with "..." else you'll get something like "will reconcile...: bad thing happened"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A wrapped error shouldnt end with "..." else you'll get something like "will reconcile...: bad thing happened"

You're right, copy-paste error.

please add which VM failed to delete

We'll have that information in the cloud provider return error. The error wrapper should add more context.


// If any of the Windows VM fails to get deleted consider this as a failure and return false
if len(errs) > 0 {
return false
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes please print the errs variable

createdVM, err := r.cloudProvider.CreateWindowsVM()
if err != nil {
errs = append(errs, errors.Wrap(err, "error creating windows VM"))
log.Error(err, "error while creating windows VM")
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't log here, just print errs at the end

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean log.Printf? Why?

if err := nc.Configure(); err != nil {
// TODO: Unwrap to extract correct error
errs = append(errs, errors.Wrap(err, "configuring Windows VM failed"))
log.Error(err, "configuring Windows VM failed", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't log here, just print errs at the end

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The error will have information related to node.

test/e2e/wmco_test.go Show resolved Hide resolved
// Delete the Windows VM from cloud provider
log.Info("deleting the Windows VM", instancedID)
log.Info(fmt.Sprintf("deleting the Windows VM: %s", instancedID))
if err := r.cloudProvider.DestroyWindowsVM(instancedID); err != nil {
log.Error(err, "error while deleting windows VM %s", instancedID)
Copy link
Member

Choose a reason for hiding this comment

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

missed a ":" here -> log.Error(err, "error while deleting windows VM : %s", instancedID)

hasVMCreationfailed = true
log.Error(err, "error while creating windows VM", err)
errs = append(errs, errors.Wrap(err, "error creating windows VM"))
log.Error(err, "error while creating windows VM")
Copy link
Member

@mansikulkarni96 mansikulkarni96 Mar 11, 2020

Choose a reason for hiding this comment

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

nit : could remove the word "while" for consistency?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@sebsoto sebsoto left a comment

Choose a reason for hiding this comment

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

Subtest changes look good

test/e2e/wmco_test.go Outdated Show resolved Hide resolved
@@ -2,6 +2,7 @@ package e2e

import (
"context"
"github.com/pkg/errors"
Copy link
Contributor

Choose a reason for hiding this comment

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

Separate standard libs and imported

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, done

test/e2e/wmco_test.go Show resolved Hide resolved
@ravisantoshgudimetla
Copy link
Contributor Author

To see, if openshift/release#7609 has taken effect.

/retest

@mansikulkarni96
Copy link
Member

lgtm, thank you @ravisantoshgudimetla for the PR and addressing the comments.

@sebsoto
Copy link
Contributor

sebsoto commented Mar 13, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 13, 2020
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Mar 13, 2020
@ravisantoshgudimetla
Copy link
Contributor Author

/retest

5 similar comments
@ravisantoshgudimetla
Copy link
Contributor Author

/retest

@sebsoto
Copy link
Contributor

sebsoto commented Mar 13, 2020

/retest

@sebsoto
Copy link
Contributor

sebsoto commented Mar 13, 2020

/retest

@ravisantoshgudimetla
Copy link
Contributor Author

/retest

@ravisantoshgudimetla
Copy link
Contributor Author

/retest

@ravisantoshgudimetla
Copy link
Contributor Author

/test images

2 similar comments
@ravisantoshgudimetla
Copy link
Contributor Author

/test images

@ravisantoshgudimetla
Copy link
Contributor Author

/test images

@ravisantoshgudimetla
Copy link
Contributor Author

/test e2e-operator

@sebsoto
Copy link
Contributor

sebsoto commented Mar 13, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 13, 2020
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Mar 13, 2020
@ravisantoshgudimetla
Copy link
Contributor Author

/approve

Self approving based on 2 lgtms.

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ravisantoshgudimetla

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [ravisantoshgudimetla]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 13, 2020
The WMCO can watch WMC object called instance and
react to the changes to it. It spins up and down
Windows VMs in existing cloud provider and
makes them as Windows worker nodes in the
cluster. Also, added a e2e test suite
which validates the creation and deletion of the Windows VMs.
@mansikulkarni96
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 16, 2020
@openshift-merge-robot openshift-merge-robot merged commit 2a1c20a into openshift:master Mar 16, 2020
wgahnagl pushed a commit to wgahnagl/windows-machine-config-operator that referenced this pull request Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants