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

[WIP] Convert machineset templates to actual objects #567

Closed
wants to merge 2 commits into from

Conversation

rajatchopra
Copy link

@rajatchopra rajatchopra commented Oct 29, 2018

The templates used to build machineset assets are being replaced with actual objects. The benefit will be across other projects as well as it is easier to work with objects rather than template string expansion.

TODO:

  • Vendor cluster-api, cluster-api-aws-provider, cluster-api-libvirt-provider
  • Convert AWS worker template
  • Convert AWS master template
  • Convert Libvirt worker template
  • Convert Libvirt master template

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 29, 2018
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rajatchopra

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-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 29, 2018
Rajat Chopra added 2 commits October 29, 2018 18:39
…bjects

Import the cluster-api v1alpha1 object types to be used by master/worker instances
Import the cluster-api-aws-provider package for use by aws instance generation
Provide the function to be used for building machine set instance list, instead of using templates
@openshift-ci-robot
Copy link
Contributor

@rajatchopra: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/gofmt 6f53ddc link /test gofmt

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

@rajatchopra
Copy link
Author

/cc @abhinavdahiya

ms.Spec.Template = template

// add the machineset to items
items = append(items, runtime.RawExtension{Object: &ms})
Copy link
Member

Choose a reason for hiding this comment

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

Why the local items vs.:

list.Items = append(list.Items, runtime.RawExtension{Object: &ms})

?

Copy link
Author

Choose a reason for hiding this comment

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

Just logically constructing the all the structures leaf-up along. No particular reason here.

Copy link
Member

Choose a reason for hiding this comment

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

Just logically constructing the all the structures leaf-up along.

I'm fine with that approach if you want to shift the root type declaration down to the end of the function. But I'd rather not have both a beginning-of-the-function root declaration and leaf local variables.

template.Spec.ProviderConfig = clusterapi.ProviderConfig{Value: &runtime.RawExtension{Object: &provider}}
template.Spec.Versions = clusterapi.MachineVersionInfo{
Kubelet: "",
ControlPlane: "",
Copy link
Member

Choose a reason for hiding this comment

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

Does setting these to their zero value do anything? Do we need to populate Spec.Versions at all?

Copy link
Author

Choose a reason for hiding this comment

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

That is how it was in the template. I am guessing we do want to write the correct values at some point. Next to no harm for now.

Copy link
Member

Choose a reason for hiding this comment

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

That is how it was in the template.

Presumably because the upstream type is missing some omitempty.

I am guessing we do want to write the correct values at some point. Next to no harm for now.

I'd rather address that with FIXME comments in the code and/or GitHub issues to track the planned future work. Leaving empty strings here doesn't seem like an obvious way to track future work.

list.Items = items
return list
}

// WorkerMachineSetsTmpl is template for worker machinesets.
var WorkerMachineSetsTmpl = template.Must(template.New("aws-worker-machinesets").Parse(`
Copy link
Member

Choose a reason for hiding this comment

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

Can we drop this now?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, forthcoming commit, when I tie this all up with other templates.

"text/template"

awsprovider "sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1"
clusterapi "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1"
Copy link
Member

Choose a reason for hiding this comment

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

Looks like an inconsistent indent issue here.

@abhinavdahiya
Copy link
Contributor

/close
in favor of #573

@openshift-ci-robot
Copy link
Contributor

@abhinavdahiya: Closing this PR.

In response to this:

/close
in favor of #573

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.

@rajatchopra rajatchopra deleted the clusterapi branch January 15, 2019 18:42
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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants