Skip to content

[WIP] Migrate to CRDs#61

Closed
vikaschoudhary16 wants to merge 6 commits intoopenshift:crdfrom
vikaschoudhary16:crd
Closed

[WIP] Migrate to CRDs#61
vikaschoudhary16 wants to merge 6 commits intoopenshift:crdfrom
vikaschoudhary16:crd

Conversation

@vikaschoudhary16
Copy link
Copy Markdown
Contributor

@vikaschoudhary16 vikaschoudhary16 commented Oct 12, 2018

  • Vendor CRD base cluster api
  • Make code changes to use new cluster-api and build it.
  • Local testing to verify if machine object creation using kubectl results into spawning of libvirt instance
  • Local testing to verify if deleting machine object, triggers libvirt instance deletion
  • Handle LibvirtMachineProviderStatus
  • Fix Makefile and Dockerfile
  • Fix test cases
  • Update machine object status

command to build at the moment:

go build -o bin/manager github.com/openshift/cluster-api-provider-libvirt/cmd/manager

Local testing is done using these steps:

  1. Launch cluster using minikube
  2. Create cluster-api-bootstarp.yml
[vikas@fed-node cluster-api-provider-libvirt]$ kustomize build vendor/sigs.k8s.io/cluster-api/config/default/ >> /home/vikas/cluster-api-bootstrap.yaml
  1. kubectl apply -f /home/vikas/cluster-api-bootstrap.yaml
  2. Run libvirt actuator binary:
bin/manager --kubeconfig=/root/.kube/config --alsologtostderr
  1. Create a cluster object using kubectl
apiVersion: cluster.k8s.io/v1alpha1
kind: Cluster
metadata:
  labels:
    controller-tools.k8s.io: "1.0"
  name: cluster-sample
spec:
  clusterNetwork:
    pods:
      cidrBlocks:
      - "167.1.1.0/24"
    services:
      cidrBlocks:
      - "70.1.1.0/24"
    serviceDomain: "abc.com"
  1. Create a machine object using kubectl
---
apiVersion: cluster.k8s.io/v1alpha1
kind: Machine
metadata:
  labels:
    controller-tools.k8s.io: "1.0"
  name: machine-sample2
spec:
  providerConfig:
    ValueFrom: null
    value:
      apiVersion: libvirtproviderconfig/v1alpha1
      autostart: false
      domainMemory: 2048
      domainVcpu: 2
      ignKey: "/var/lib/libvirt/images/worker.ign"
      kind: LibvirtMachineProviderConfig
      networkInterfaceAddress: 192.168.124.0/24
      networkInterfaceName: tes
      uri: qemu+tcp://192.168.122.1/system
      volume:
        baseVolumeID: "/var/lib/libvirt/images/coreos_base"
        poolName: default
  versions:
    kubelet: ''
  1. Verify results using virsh commands.

@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 12, 2018
@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 12, 2018
@openshift-ci-robot openshift-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Oct 12, 2018
@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 12, 2018
@vikaschoudhary16 vikaschoudhary16 changed the title [WIP] Use CRD based cluster-api [WIP] Migrate to CRDs Oct 12, 2018
Comment thread Dockerfile Outdated
COPY --from=builder /go/bin/machine-controller /go/bin/controller-manager /
WORKDIR /root/
COPY --from=builder /go/src/github.com/openshift/cluster-api-provider-libvirt/manager .
ENTRYPOINT ["./manager"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why we are adding entrypoint?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There are still parts to be cleaned up. Dockerfile nad Makefile i mentioned explicitly in description. Will cleanup soon.

Comment thread Dockerfile

# Final container
FROM openshift/origin-base
RUN yum install -y ca-certificates libvirt-libs openssh-clients
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Aren't those libraries needed to connect to libvirt hypervisor via qemu+ssh method?

Comment thread Dockerfile Outdated
RUN mkdir -p /go/src/github.com/openshift/cluster-api-provider-libvirt
# Copy in the go src
WORKDIR /go/src/github.com/openshift/cluster-api-provider-libvirt
COPY pkg/ pkg/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What does it do?

Comment thread Makefile Outdated

# Run go vet against code
vet:
go vet ./pkg/... ./cmd/...
Copy link
Copy Markdown
Contributor

@paulfantom paulfantom Oct 12, 2018

Choose a reason for hiding this comment

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

Why this changed from using hack/go-vet.sh script?

Comment thread Makefile Outdated

# Run go fmt against code
fmt:
go fmt ./pkg/... ./cmd/...
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why this changed from using hack/go-fmt.sh script?

Comment thread Makefile
.PHONY: all
all: build images check

NO_DOCKER ?= 0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why this is removed?

Comment thread Makefile

.PHONY: test
test: # Run unit test
$(DOCKER_CMD) go test -race -cover ./cmd/... ./cloud/...
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Running go should be containerized to ensure local test env is identical with CI one.

Copy link
Copy Markdown
Contributor

@frobware frobware Oct 12, 2018

Choose a reason for hiding this comment

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

Running go should be containerized to ensure local test env is identical with CI one.

I think our Makefile's are upside down. They should favour the developer who types a lot of make commands. In dev, I just want a local binary.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Produced binary is preserved in bin/ directory and our makefiles allow to use non-containerized builds.

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 14, 2018
@paulfantom
Copy link
Copy Markdown
Contributor

Shouldn't this PR use crd as target branch instead of master?

@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 18, 2018
@vikaschoudhary16 vikaschoudhary16 changed the base branch from master to crd October 18, 2018 08:52
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: vikaschoudhary16

If they are not already assigned, you can assign the PR to them by writing /assign @vikaschoudhary16 in a comment when ready.

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

The pull request process is described here

Details 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
Copy link
Copy Markdown
Contributor

@vikaschoudhary16: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/unit 6b2f3f0 link /test unit
ci/jenkins/e2e 6b2f3f0 link /test e2e

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.

Details

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.

@enxebre
Copy link
Copy Markdown
Member

enxebre commented Oct 19, 2018

@vikaschoudhary16 please shout when this is ready for review :)
can you please before rebase into reasonable commits? this is the ones we used on aws for consistency

  • revendor for CRDs
  • add kubebuilder generated skeleton
  • drop old machine controller and build new one
  • move provider config for new layout
  • update actuator for using new provider config
  • update docker and Makefile
  • fix lints

Previously we suited the layout on master moving the cloud folder into packages
Also you'll want to revendor the cluster api to pick kubernetes-sigs/cluster-api#546
cc @ingvagabund

@ingvagabund
Copy link
Copy Markdown
Member

Closing in favor of #72

@vikaschoudhary16
Copy link
Copy Markdown
Contributor Author

oh, this was very aggressive overtake.

  1. It was holiday in India on Friday
  2. I was not well throughout week but was still planning to work on this during weekend that i told Alberto too.

@ingvagabund
Copy link
Copy Markdown
Member

Sorry about that Vikas :( Alberto restructured his PR during the week with additional changes that we discussed, the e2e framework has changed, some downstream patches were applied. I did not want you to spend time duplicating the same job we did with Alberto.

@vikaschoudhary16 vikaschoudhary16 deleted the crd branch October 22, 2018 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

7 participants