-
Notifications
You must be signed in to change notification settings - Fork 3
For internal review only #41
base: review-base
Are you sure you want to change the base?
Conversation
Accept vSphere's server, datacenter, cluster setting by flags "vsphere-server", "vsphere-datacenter", and "vsphere-resource-pool". Username and password can be set by environment variables: "VSPHERE_USERNAME" and "VSPHERE_PASSWORD".
1. Check the emptiness of VSPHERE_USERNAME and VSPHERE_PASSWORD 2. Move vSphere specific fields from clusterSpec to clusterSpec.CloudConfig
…ed conversion files. To make sure the vSphere fields in CloudConfiguration can be successfully serialized and output into config file.
Implemented CreateLinkClonedVM cloud interface to create a link cloned VM from a template VM. The code checks if the template VM has a snapshot, if no it creates it before creating a link cloned VM. If snapshot already exists, it uses it to create the link cloned VM. Testing done: 1. kops cluster create goes through fine and creates the link cloned VM for the master and worker. Verified that it creates the snapshot on the template VM if it does not exists before creating a link cloned VM. In case the snapshot exists, it uses it to create the link cloned VM. 2. "make ci" is successful.
…akefile. (#1) * Add vSphere volumes to protokube. Update vSphere testing doc and makefile. * Updated vsphere_volume to get correct IP. Addressed comments.
* Add support of CoreDNS for vSphere provider. * Add instructions about how to setup CoreDNS for vSphere provider. * Address comments for CoreDNS support code.
AttachISO task creates the user-data/meta-data cloud init files and creates cloud-init.iso file using "genisoimage" tool. It then uploads it to the datastore where the master/worker VM resides and inserts it into the cd-rom device of the master/worker VM. When the master/worker VM powers on, the cloud-init package in it runs the bootstrap script that downloads nodeup and runs it. Also removed redundant VirtualMachineModelBuilder that does nothing. Testing done: 1. Tested end to end that the master and worker VMs executes the cloud-init script successfully. 2, "make ci" is successful.
* Enable CoreDNS in nodeup/protokube. * Address comments.
…vSphere VM (#11) * Added code to enable nodeup and protokube building and execution for vSphere VM. * Fixed nodeup template for vSphere.
22063fe
to
da16a9b
Compare
Add vm-uuid in cloud-config file required by Kubernetes vSphere CloudProvider
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks solid for first draft. Terrific work everyone!
Some minor comments, mostly clarifying questions. We can discuss in-person as well.
Few general suggestions:
- Add file header comments with purpose of code in that file.
- Add function header comments for exported functions (that will be called from outside)
- Did we run golint?
@@ -202,6 +213,14 @@ func NewCmdCreateCluster(f *util.Factory, out io.Writer) *cobra.Command { | |||
cmd.Flags().StringVar(&options.MasterTenancy, "master-tenancy", options.MasterTenancy, "The tenancy of the master group on AWS. Can either be default or dedicated.") | |||
cmd.Flags().StringVar(&options.NodeTenancy, "node-tenancy", options.NodeTenancy, "The tenancy of the node group on AWS. Can be either default or dedicated.") | |||
|
|||
if featureflag.VSphereCloudProvider.Enabled() { | |||
// vSphere flags | |||
cmd.Flags().StringVar(&options.VSphereServer, "vsphere-server", options.VSphereServer, "vsphere-server is required for vSphere. Set vCenter URL Ex: 10.192.10.30 or myvcenter.io (without https://)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Port? I believe we had customer using kube-anywhere with vCenter running on different port. CHeck with Divyen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No the vCenter port is not necessary. And it has been deprecated after this PR:
https://github.com/kubernetes/kubernetes/pull/42024/files
Even without the port there is no problem to talk to vCenter.
The kube-anywhere readme should be updated too.
cmd.Flags().StringVar(&options.VSphereDatacenter, "vsphere-datacenter", options.VSphereDatacenter, "vsphere-datacenter is required for vSphere. Set the name of the datacenter in which to deploy Kubernetes VMs.") | ||
cmd.Flags().StringVar(&options.VSphereResourcePool, "vsphere-resource-pool", options.VSphereDatacenter, "vsphere-resource-pool is required for vSphere. Set a valid Cluster, Host or Resource Pool in which to deploy Kubernetes VMs.") | ||
cmd.Flags().StringVar(&options.VSphereCoreDNSServer, "vsphere-coredns-server", options.VSphereCoreDNSServer, "vsphere-coredns-server is required for vSphere.") | ||
cmd.Flags().StringVar(&options.VSphereDatastore, "vsphere-datastore", options.VSphereDatastore, "vsphere-datastore is required for vSphere. Set a valid datastore in which to store dynamic provision volumes.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is optional rt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The datastore field seems is necessary for v1.5.3 support. @abrarshivani Hi Abrar, can you confirm this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current stable versions for vSphere Cloud Provider requires datastore
} | ||
cluster.Spec.CloudConfig.VSphereCoreDNSServer = fi.String(c.VSphereCoreDNSServer) | ||
|
||
if c.VSphereDatastore == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is optional rt?
} | ||
|
||
if dnsRecord != nil && string(dnsRecord.Type()) == string(k.RecordType) { | ||
glog.V(8).Infof("Found matching record: %s %s", k.RecordType, fqdn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move it to just before cs.Remove and change to glog.V(2) and "Deleting resource record: ..." to be consistent with AWS L495
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
docs/development/vsphere-dev.md
Outdated
### Pre-requisites | ||
+ vSphere with at least one ESX, having sufficient free disk space on attached datastore. ESX VM's should have internet connectivity. | ||
+ Setup DNS following steps given in relevant Section above. | ||
+ Create the VM using this template (TBD). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Steps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
defaultNodeMachineTypeGCE = "n1-standard-2" | ||
defaultNodeMachineTypeAWS = "t2.medium" | ||
defaultNodeMachineTypeGCE = "n1-standard-2" | ||
defaultNodeMachineTypeVSphere = "vsphere_node" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is configuration of node defined?
defaultMasterMachineTypeAWS = "m3.medium" | ||
defaultMasterMachineTypeVSphere = "vsphere_master" | ||
|
||
defaultVSphereNodeImage = "ubuntu_16_04" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see AMI Id for AWS then why do we have vSphereNodeImage here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prashima Now we can use --image to define the image to be used. Do we still need defaultVSphereNodeImage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to fix default image name extraction for vSphere. Here is the relevant issue #50.
We can remove this default image from here, but note that that will make '--image' a mandatory flag for vSphere cluster create operation.
hack/vsphere/set_env
Outdated
export KOPS_FEATURE_FLAGS=+VSphereCloudProvider | ||
|
||
# If set, coredns will be used for vsphere cloud provider. | ||
export VSPHERE_DNS=coredns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You already have CLI option "--dns=private --vsphere-coredns-server" so do we still need these environment variable?
|
||
func (c *VSphereCloud) DNS() (dnsprovider.Interface, error) { | ||
// TODO: this is a temporary flag to toggle between CoreDNS and Route53, before CoreDNS is stable | ||
dns_provider := os.Getenv("VSPHERE_DNS") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We pass this info to KOPS CLI rt? Why do we need env variable?
lines = append(lines, " echo \"nameserver "+dnsHost+"\" >> /etc/resolvconf/resolv.conf.d/head") | ||
lines = append(lines, " resolvconf -u") | ||
dnsUpdateStr := strings.Join(lines, "\n") | ||
data = strings.Replace(data, "$DNS_SCRIPT", dnsUpdateStr, -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use sprintf or equivalent rather than strings.XXX???
Makefile
Outdated
# Build protokube and nodeup. Pushes protokube to DOCKER_REGISTRY and scp nodeup binary to the TARGET. Uncomment ssh part to run nodeup at set TARGET. | ||
push-vsphere: nodeup protokube-push | ||
scp -C .build/dist/nodeup ${TARGET}:~/ | ||
# ssh -t [email protected] 'export AWS_ACCESS_KEY_ID="AKIAJ6UOKB6BGYLIQJEQ"; export AWS_SECRET_ACCESS_KEY="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"; export AWS_REGION="us-west-2"; SKIP_PACKAGE_UPDATE=1 ~/nodeup --conf=/var/cache/kubernetes-install/kube_env.yaml --v=8' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This "push-vsphere" is not needed anymore rt? @prashima
Address review comments and add installing instructions
When Environment variable S3_ENDPOINT is not empty, kops will use the bucket on this specific s3 endpoint, instead of using AWS S3 by default.
Support user-defined s3 endpoint
Implements delete cluster and toolbox dumper command
Change vm_uuid file location
Change the default image name for vsphere provider and other minor fix
DON'T MERGE!
This is a review for vSphere support code in kops before upstreaming.
Please refer the following guide for an easier review :)
For those who never use or read about kops before, the following docs might be helpful for a high-level understanding:
https://github.com/kubernetes/kops/blob/master/docs/development/how_it_works.md
https://github.com/kubernetes/kops/blob/master/docs/philosophy.md
About how to use kops with AWS:
https://github.com/kubernetes/kops/blob/master/docs/aws.md
About how to use kops on vSphere:
https://github.com/vmware/kops/blob/vsphere-develop/docs/development/vsphere-dev.md
The changes to support vSphere mainly include 5 parts: