[wmco] Barebone WMCO initialization - #1
Conversation
|
/cc @aravindhp @openshift/openshift-team-windows-containers |
aravindhp
left a comment
There was a problem hiding this comment.
Thanks for working on this, @ravisantoshgudimetla.
Please add the operator-sdk commands that you ran to initialize the repo. Also shouldn't you add WindowsMachine CR first given you are going to be working on that next?
| metadata: | ||
| name: windowsoperatorconfigs.winoperators.config.openshift.io | ||
| spec: | ||
| group: winoperators.config.openshift.io |
There was a problem hiding this comment.
This has been resolved over slack. As per @deads2k, config.openshift.io must lifecycle on an OpenShift release cadence. and that the configuration should live with the component.
I'll pick it up later when I pick that story. I want to not block you. Also, I wasn't sure, if we have to remove certain fields in the CR, so I did not want to block this PR on that. |
Given we are waiting on @deads2k it makes sense to add your CRD first and I can add the |
I added link to the commands I've run. Do you want me to add the exact commands as well? |
Yes please. |
8144acb to
e4ff810
Compare
aravindhp
left a comment
There was a problem hiding this comment.
Thanks for the PR, @ravisantoshgudimetla. Mostly LGTM.
| // Replicas represent how many Windows nodes to be added to the | ||
| // OpenShift cluster |
| // sshPrivateKey is the name of the secret which contains ssh key | ||
| // to decrypt the password | ||
| sshPrivateKey string `json:"sshprivatekey"` | ||
| // cloudProviderCreds is the name of the secret which contains | ||
| // credentials of the cloud provider. | ||
| cloudProviderCredentials string `json:"cloudprovidercredentials,omitempty"` |
There was a problem hiding this comment.
Please indicate in the variable name that we are using a secret.
There was a problem hiding this comment.
It would be better to create a struct for AWS as this is just going to grow. We can add a struct for Azure when we start working on adding Azure support.
sebsoto
left a comment
There was a problem hiding this comment.
Seems cool, thanks @ravisantoshgudimetla
| // InstanceType represents the flavor of instance to be used while | ||
| // creating the virtual machines. Please note that this is common | ||
| // across all the Windows nodes in the cluster | ||
| InstanceType string `json:"instancetype,omitempty"` |
There was a problem hiding this comment.
For the json tags we should use a set naming convention. Kubernetes uses camel case so I suggest we go with that :)
There was a problem hiding this comment.
Good catch. I just looked OpenShift api and we moved to that. Thnx.
| InstanceType string `json:"instancetype,omitempty"` | ||
| // sshkeyPair is the sshKeyPair associated with cloudprovider. AWS | ||
| // asks a keypair to be present for encrypting the Windows VM password | ||
| sshkeyPair string `json:"sshkeypair"` |
| // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. | ||
|
|
||
| // WindowsMachineConfigSpec defines the desired state of WindowsMachineConfig | ||
| type WindowsMachineConfigSpec struct { |
There was a problem hiding this comment.
Should Windows build number be added as a field here?
According to the link:
The Windows Server version used by each pod must match that of the node
It seems that there are multiple builds (versions) for Windows Server 2019. Based on that it would seem that we should keep note of the build number so that we would know if a pod could be scheduled on the node or not due to version reasons.
There was a problem hiding this comment.
As of now, the focus is on getting the Windows Server 2019 to the cluster(that's why I am not exposing the image to be used as of now). We may not go to the granular level of matching builds in future but we can always increase the surface area of api if we want to.
suhanime
left a comment
There was a problem hiding this comment.
Thank you for the PR @ravisantoshgudimetla. The ground work looks solid.
| // Get a config to talk to the apiserver | ||
| cfg, err := config.GetConfig() | ||
| if err != nil { | ||
| log.Error(err, "") |
There was a problem hiding this comment.
Why are the errors swallowed here and in the following sections?
There was a problem hiding this comment.
We're not swallowing them, we're not adding context however remember that this PR is just what sdk generates. I'll make code changes in the next PR.
217b901 to
50a0923
Compare
| // across all the Windows nodes in the cluster | ||
| InstanceType string `json:"instanceType,omitempty"` | ||
| // AWSProvider holds AWS specific cloud provider information. | ||
| AWSProvider *AWSProvider `json:"AWSProvider"` |
There was a problem hiding this comment.
From what I understand, this should be awsProvider in the JSON. You can check with the API folks to confirm.
Please remove the provider suffix.
There was a problem hiding this comment.
Anything works, in json that we need to edit, the user needs to provide AWSProvider.
| // AWSProvider holds AWS specific cloud provider information. | ||
| AWSProvider *AWSProvider `json:"AWSProvider"` | ||
| // AzureProvider holds Azure specific cloud provider information | ||
| AzureProvider *AzureProvider `json:"AzureProvider"` |
There was a problem hiding this comment.
Rename to Azure and make it azure in the JSON
| type AWSProvider struct { | ||
| // SshKeyPair is the sshKeyPair associated with cloudprovider. AWS | ||
| // asks a keypair to be present for encrypting the Windows VM password | ||
| SshKeyPair string `json:"sshKeyPair"` |
There was a problem hiding this comment.
should this be SSHKeyPair?
| SshKeyPair string `json:"sshKeyPair"` | ||
| // SshPrivateKey is the name of the secret which contains ssh key | ||
| // to decrypt the password | ||
| SshPrivateKey string `json:"sshPrivateKey"` |
There was a problem hiding this comment.
No strong preference. I'll change it to SSH.
| // to decrypt the password | ||
| SshPrivateKey string `json:"sshPrivateKey"` | ||
| // CredentialAccountID is account id associated with AWS provider | ||
| CredentialAccountID string `json:credentialAccountDd"` |
There was a problem hiding this comment.
Please change to credentialAccountId in the JSON.
ravisantoshgudimetla
left a comment
There was a problem hiding this comment.
@aravindhp - I addressed your comments. PTAL
| // across all the Windows nodes in the cluster | ||
| InstanceType string `json:"instanceType,omitempty"` | ||
| // AWSProvider holds AWS specific cloud provider information. | ||
| AWSProvider *AWSProvider `json:"AWSProvider"` |
There was a problem hiding this comment.
Anything works, in json that we need to edit, the user needs to provide AWSProvider.
| SshKeyPair string `json:"sshKeyPair"` | ||
| // SshPrivateKey is the name of the secret which contains ssh key | ||
| // to decrypt the password | ||
| SshPrivateKey string `json:"sshPrivateKey"` |
There was a problem hiding this comment.
No strong preference. I'll change it to SSH.
|
/lgtm |
Followed the steps at https://github.com/operator-framework/operator-sdk/blob/master/doc/user-guide.md to initialize the repo, as of now, following items are added: - A new apiVersion called wmc.openshift.io/v1alpha1 - A new kind called WindowsMachineConfig - A deployable CRD, CR, rbac and sa - Controller which watches for WindowsMachineConfig CRs The goal is to have the operator watch for windowsMachineConfig CR and windowsMachineConfig Configmap in future. As of now, we're just going to watch for the windowsConfig CR(which is singleton) Following are the commands, that I ran: - operator-sdk new windows-machine-config-operator \ --repo=github.com/example-inc/memcached-operator - operator-sdk add api --api-version=wmc.openshift.io/v1alpha1 \ --kind=WindowsMachineConfig - operator-sdk generate k8s - operator-sdk generate crds - operator-sdk add controller --api-version=wmc.openshift.io/v1alpha1 \ --kind=WindowsMachineConfig
ce86de1 to
053f52b
Compare
|
/lgtm |
Create OWNERS file
Followed the steps at https://github.com/operator-framework/operator-sdk/blob/master/doc/user-guide.md to initialize the repo, as of now, following items are added:
The goal is to have the operator watch for windowsMachineConfig CR and windowsMachineConfig Configmap in future. As of now, we're just going to watch for the windowsConfig CR(which is singleton)
Following are the commands, that I ran: