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

✨ Start implementing create workflow for KubeadmControlPlane controller #1856

Merged
merged 1 commit into from
Dec 13, 2019

Conversation

detiber
Copy link
Member

@detiber detiber commented Dec 6, 2019

What this PR does / why we need it:

  • Starts implementing the Create workflow for the KubeadmControlPlane CAEP

Related to: #1756

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 6, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: detiber

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 6, 2019
@detiber detiber force-pushed the kcpCreate branch 3 times, most recently from e0639c9 to d81f46e Compare December 6, 2019 21:24
controllers/cluster_controller_phases.go Outdated Show resolved Hide resolved
controllers/kubeadm_control_plane_controller.go Outdated Show resolved Hide resolved
Copy link
Contributor

@chuckha chuckha left a comment

Choose a reason for hiding this comment

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

Any interest in merging the field changes & CRD changes before working on the implementation? could reduce the size of the PR as I expect this will be growing significantly. Anything we can do to merge things piecemeal will be helpful to reviewers

@detiber
Copy link
Member Author

detiber commented Dec 10, 2019

Any interest in merging the field changes & CRD changes before working on the implementation? could reduce the size of the PR as I expect this will be growing significantly. Anything we can do to merge things piecemeal will be helpful to reviewers

Yes, I can break this up. I'd like to finish up rounding out a few of the rough edges first, though.

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 10, 2019
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 10, 2019
@detiber detiber changed the title [WIP] ✨ Start implementing create workflow for KubeadmControlPlane controller ✨ Start implementing create workflow for KubeadmControlPlane controller Dec 10, 2019
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 10, 2019
@detiber
Copy link
Member Author

detiber commented Dec 10, 2019

@ncdc @chuckha refactored into smaller (and should be easier to review PRs). With the following configs, I can stand up a single control plane instance:

---
kind: AWSCluster
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
metadata:
  name: test-cluster
  namespace: default
spec:
  region: us-east-1
---
kind: Cluster
apiVersion: cluster.x-k8s.io/v1alpha3
metadata:
  name: test-cluster
  namespace: default
spec:
  clusterNetwork:
    pods:
      cidrBlocks: ["192.168.0.0/16"]
  infrastructureRef:
    kind: AWSCluster
    apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
    name: test-cluster
    namespace: default
  controlPlaneRef:
    kind: KubeadmControlPlane
    apiVersion: cluster.x-k8s.io/v1alpha3
    name: kcp-1
    namespace: default
---
kind: AWSMachineTemplate
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
metadata:
  name: kcp-infra-template
  namespace: default
spec:
  template:
    spec:
      instanceType: t3.large
      iamInstanceProfile: "control-plane.cluster-api-provider-aws.sigs.k8s.io"
---
kind: KubeadmControlPlane
apiVersion: cluster.x-k8s.io/v1alpha3
metadata:
  name: kcp-1
  namespace: default
  labels:
    cluster.x-k8s.io/cluster-name: test-cluster
spec:
  infrastructureTemplate:
    kind: AWSMachineTemplate
    apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
    name: kcp-infra-template
    namespace: default
  kubeadmConfigSpec:
    initConfiguration:
      nodeRegistration:
        name: '{{ ds.meta_data.local_hostname }}'
        kubeletExtraArgs:
          cloud-provider: aws
    clusterConfiguration:
      apiServer:
        extraArgs:
          cloud-provider: aws
      controllerManager:
        extraArgs:
          cloud-provider: aws
    joinConfiguration:
      nodeRegistration:
        name: '{{ ds.meta_data.local_hostname }}'
        kubeletExtraArgs:
          cloud-provider: aws
  version: v1.16.2

Copy link
Contributor

@chuckha chuckha left a comment

Choose a reason for hiding this comment

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

looks really great!

controllers/cluster_controller_phases.go Outdated Show resolved Hide resolved
util/secret/certificates.go Show resolved Hide resolved
controllers/kubeadm_control_plane_controller.go Outdated Show resolved Hide resolved
util/secret/certificates.go Outdated Show resolved Hide resolved
controllers/cluster_controller_phases.go Show resolved Hide resolved
@detiber detiber force-pushed the kcpCreate branch 5 times, most recently from 266eef8 to 0ef9660 Compare December 13, 2019 20:26
@detiber
Copy link
Member Author

detiber commented Dec 13, 2019

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 13, 2019
@detiber
Copy link
Member Author

detiber commented Dec 13, 2019

/hold cancel
fixed an issue with secret/kubeconfig generation where the name and namespace were swapped.

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 13, 2019
@ncdc
Copy link
Contributor

ncdc commented Dec 13, 2019

LGTM

Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

LGTM

controllers/cluster_controller_phases.go Outdated Show resolved Hide resolved
- Update API Types for KubeadmControlPlane
  - Add Spec.ControlPlaneRef to Cluster
  - Add Status.ControlPlaneReady to Cluster
  - Remove omitempty from KubeadmControlPlane.Status.Initialized and KubeadmControlPlane.Status.Ready
- [Cluster Controller] Add external reconciliation of Control Plane
  - Add reconcileControlPlane method to phases
  - Only reconcile the Kubeconfig if Spec.ControlPlaneRef is not set
  - Adds an IsInitialized function to the external utilities
- Migrate bootstrap secret utilities for additional use in KubeadmControlPlane
  - Move secret utilities from bootstrap/kubeadm/internal/cluster to util/secret
  - Refactor to remove hardcoded ownerRefs to KubeadmConfig
- Update kubeconfig utils to handle different ownerRefs
- [KubeadmControlPlane] Fetch owning cluster
- [KubeadmControlPlane] build and set Machine selector
- [KubeadmControlPlane] fetch list of owned Machines
- [KubeadmControlPlane] Create Cluster secrets if needed
- [KubeadmControlPlane] Handle initialization of first control plane instance
@chuckha
Copy link
Contributor

chuckha commented Dec 13, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 13, 2019
@k8s-ci-robot k8s-ci-robot merged commit 1bb8132 into kubernetes-sigs:master Dec 13, 2019
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants