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

WINC-740: Configure kube-proxy with WICD #1160

Merged
merged 5 commits into from Sep 14, 2022

Conversation

sebsoto
Copy link
Contributor

@sebsoto sebsoto commented Aug 5, 2022

  • Adds functionality for WICD to run PowerShell scripts to resolve service variables
  • Moves network configuration into a PowerShell script, a requirement for it to be done by WICD
  • Moves kube-proxy configuration into WICD

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 5, 2022
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 5, 2022
@sebsoto sebsoto force-pushed the betterWicdKP branch 2 times, most recently from ad7ddc9 to 5895c78 Compare August 5, 2022 11:26
@sebsoto
Copy link
Contributor Author

sebsoto commented Aug 5, 2022

/approve cancel

@openshift-ci openshift-ci bot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 5, 2022
@sebsoto sebsoto force-pushed the betterWicdKP branch 2 times, most recently from dc342d0 to bcc37ca Compare August 5, 2022 14:08
@sebsoto sebsoto changed the title [WIP] Move CNI commands to PS script Move Node network setup to PS script Aug 5, 2022
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 5, 2022
@sebsoto
Copy link
Contributor Author

sebsoto commented Aug 8, 2022

/retest

@sebsoto sebsoto changed the title Move Node network setup to PS script [WIP] Move Node network setup to PS script Aug 9, 2022
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 9, 2022
@sebsoto
Copy link
Contributor Author

sebsoto commented Aug 10, 2022

/retest

@sebsoto sebsoto changed the title [WIP] Move Node network setup to PS script Move Node network setup to PS script Aug 19, 2022
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 19, 2022
Copy link
Contributor

@jrvaldes jrvaldes left a comment

Choose a reason for hiding this comment

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

Mostly, LGTM. Just minor comments.

Great work @sebsoto

@@ -82,3 +84,39 @@ func NewFileInfo(path string) (*FileInfo, error) {
SHA256: fmt.Sprintf("%x", sha256.Sum256(contents)),
}, nil
}

// Validate ensures all required payload files exist
func Validate() error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you anticipate more validations to be included here? Otherwise, I don't feel the Validate() function is needed just to hold the collection of files. You can call directly checkIfFilesExist.

@@ -1,25 +1 @@
package main
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to keep the empty file?

@sebsoto sebsoto changed the title Move Node network setup to PS script [WIP] Move Node network setup to PS script Aug 26, 2022
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 26, 2022
@sebsoto sebsoto force-pushed the betterWicdKP branch 2 times, most recently from f28a609 to a130a45 Compare August 26, 2022 14:00
@sebsoto sebsoto changed the title [WIP] Move Node network setup to PS script WINC-740: Configure kube-proxy with WICD Aug 26, 2022
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 26, 2022
@sebsoto sebsoto changed the title WINC-740: Configure kube-proxy with WICD [WIP] WINC-740: Configure kube-proxy with WICD Aug 26, 2022
Copy link
Contributor

@saifshaikh48 saifshaikh48 left a comment

Choose a reason for hiding this comment

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

LGTM aside from the network-config script testing. I am fine with the CNI configuration and kube-proxy starting being separated at a later time.


// Cannot use a cached client as no manager will be started to populate cache
directClient, err := controller.NewDirectClient(cfg)
sc, err := controller.NewServiceController(context.TODO(), "", controller.Options{Config: cfg})
Copy link
Contributor

Choose a reason for hiding this comment

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

out of scope of this PR: we should not have to create a service controller object to run bootstrap

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a good point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@saifshaikh48 I'm not sure what you mean. I'm not introducing that behavior here. Bootstrap is a method of the service controller struct.
see code in current master:

if err := sc.Bootstrap(desiredVersion); 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.

Sorry, I wasn't clear. My comment is a general comment -- ideally we shouldn't have Bootstrap be a method on a controller object. Just something to keep in mind as future work.

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 create a tech debt story around this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@saifshaikh48 saifshaikh48 left a comment

Choose a reason for hiding this comment

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

just one comment, LGTM otherwise

// CNIConfigTemplatePath is the path for CNI config template
CNIConfigTemplatePath = payloadDirectory + cniDirectory + "cni-conf-template.json"
// NetworkConfigurationScript is the path for generated Network configuration Script
NetworkConfigurationScript = payloadDirectory + "/generated/network-conf.ps1"
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 add this to the dockerfile payload diagram?

#├── generated
#│   └── network-conf.ps1

Copy link
Contributor Author

@sebsoto sebsoto Sep 12, 2022

Choose a reason for hiding this comment

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

Added the generated directory, as the diagram is describing how the dockerfile is building the payload, not WMCO

Copy link
Contributor

@alinaryan alinaryan left a comment

Choose a reason for hiding this comment

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

Looking good so far. Just curious, why isn’t WICD able to run PS commands like WMCO does? Also, how are you testing?

This commit introduces the Options struct for the controller package.
This is a pattern that is seen throughout various kubernetes libraries.
All parameters for NewServiceController() that can be made to have a
reasonable default value have been moved into this struct which will be
passed into the function instead.

The purpose of doing this is to provide a cleaner interface for users
calling NewServiceController, by reducing the amount of parameters that
may not be necessary for the caller, and thus reducing copy pasted
repeat code.
Resolves PowerShell variables present in the Windows service configmap
when starting Windows services.
@sebsoto sebsoto force-pushed the betterWicdKP branch 3 times, most recently from cf47841 to 86ee678 Compare September 12, 2022 13:03
@sebsoto
Copy link
Contributor Author

sebsoto commented Sep 12, 2022

Just curious, why isn’t WICD able to run PS commands like WMCO does?

WICD is designed to enact policy as described by WMCO. Any scripting required to configure a service must be done through the windows-services configmap, as that is what defines what WICD must do to sucessfully configure a node.

Also, how are you testing?

The powershell functionality is being tested through the added WICD unit tests. The kube-proxy changes are being tested through the existing e2e test suite.

@mansikulkarni96
Copy link
Member

LGTM

1 similar comment
@alinaryan
Copy link
Contributor

LGTM

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.

Nice work, @sebsoto


// Cannot use a cached client as no manager will be started to populate cache
directClient, err := controller.NewDirectClient(cfg)
sc, err := controller.NewServiceController(context.TODO(), "", controller.Options{Config: cfg})
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 create a tech debt story around this?

pkg/nodeconfig/payload/payload.go Show resolved Hide resolved
@@ -547,18 +535,18 @@ func (vm *windows) ConfigureAzureCloudNodeManager(nodeName string) error {
}

func (vm *windows) ConfigureKubeProxy(nodeName, hostSubnet string) error {
endpointIP, err := vm.createHNSEndpoint()
endpointIP, err := vm.Run(NetworkConfScriptPath, true)
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you create a follow up story to separate this out i.e. introduce allowing WICD to run PowerShell scripts.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 12, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aravindhp

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:

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 12, 2022
This commit moves the CNI configuration and HNS network setup into a
new Powershell script network-conf.ps1.
This is required in order to enable the transition of responsibilities
from WMCO to WICD. WICD cannot run arbitrary Powershell commands in the
same way WMCO does. Instead any required commands must be made part of
a script which is ran before starting a specific service.

The script `network-conf.ps1` is being generated at runtime. This
enables the use of variable replacement for values that will not change
while WMCO is running.
This commit moves the responsibility of configuring kube-proxy out of
WMCO, and into WICD. WMCO still needs to wait for kube-proxy to be
running, as it is currently responsible for uncordoning the node, and
applying the version annotation on it, indicating the node has been
sucessfully configured.
@alinaryan
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 12, 2022
@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD 5928b62 and 2 for PR HEAD 95a2c52 in total

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD 1a1f09b and 1 for PR HEAD 95a2c52 in total

@sebsoto
Copy link
Contributor Author

sebsoto commented Sep 13, 2022

/retest

@sebsoto
Copy link
Contributor Author

sebsoto commented Sep 13, 2022

/test vsphere-e2e-operator

@sebsoto
Copy link
Contributor Author

sebsoto commented Sep 13, 2022

/test gcp-e2e-operator

@sebsoto
Copy link
Contributor Author

sebsoto commented Sep 14, 2022

/retest-required

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 14, 2022

@sebsoto: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit 7ae5e7f into openshift:master Sep 14, 2022
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants