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

Migrate to the KubeOneCluster API #390

Merged
merged 26 commits into from
May 1, 2019
Merged

Conversation

xmudrii
Copy link
Member

@xmudrii xmudrii commented Apr 28, 2019

What this PR does / why we need it:

Migrate to the KubeOneCluster API implemented in #353 and proposed in the following proposal.

This PR brings breaking changes as some fields are removed or renamed. The new API is a Kubernetes-style API and supports API versioning, which allows us to make changes to the API without affecting the end users and breaking the backwards compatibility.

The new API is called KubeOneCluster, the API group is kubeone.io and the initial version is v1alpha1.

Once this PR is merged it will not be possible to create KubeOne clusters using the old configuration file and API. The following changes must be made in order to migrate to the new API:

  • apiVersion and kind must be added at the top of the configuration file:
apiVersion: kubeone.io/v1alpha1
kind: KubeOneCluster
  • The following fields at the root level are renamed, so they follow the Kubernetes-style of naming fields and structures:
    • apiserver -> apiEndpoints
    • provider -> cloudProvider
    • network -> clusterNetwork
    • machine_controller -> machineController
  • All hosts fields must be changed to the camel case:
    • public_address -> publicAddress
    • private_address -> privateAddress
    • ssh_port -> sshPort
    • ssh_username -> sshUsername
    • ssh_private_key_file -> sshPrivateKeyFile
    • ssh_agent_socket -> sshAgentSocket
  • The apiserver structure is replaced with the apiEndpoint structure which contains the following fields:
    • host - address or hostname of the API endpoint (by default load balancer DNS)
    • port - port of the API (by default 6443)
  • All cloudProvider (prev. provider) fields must be changed to the camel case:
    • cloud_config -> cloudConfig
  • The network structure is renamed to clusterNetwork, all existing fields are renamed to follow the camel case and a new field is added:
    • pod_subnet -> podSubnet
    • service_subnet -> serviceSubnet
    • node_port_range -> nodePortRange
    • [NEW] serviceDomainName -> isn't used currently
  • http_proxy and https_proxy fields in the proxy structure are renamed to drop the _proxy suffix and no_proxy is renamed to follow the camel case:
    • http_proxy -> http
    • https_proxy -> https
    • no_proxy -> noProxy
  • The credentials field from machineController structure (prev. machine_controller) is moved to the root level.
  • All fields in the features structure are renamed to follow the camel case:
    • pod_security_policy -> podSecurityPolicy
    • dynamic_audit_log -> dynamicAuditLog
    • metrics_server -> metricsServer
    • openid_connect -> openidConnect
  • All openidConnect fields are renamed to follow the camel case.
  • workers.Config is renamed to workers.providerSpec.

Changes affecting using KubeOne as a Go library:

  • Structures are renamed to follow the camel case and some structures are changed or removed (see above points for more details),
  • WorkerConfig.Config.CloudProviderSpec and WorkerConfig.Config.OperatingSystemSpec are taking json.RawMessage instead of map[string]interface{},
  • All fields in the Features structure are now pointers. All fields for enabling the feature are called Enable and are type of bool (prev. pointer on bool),
  • MachineController is now a pointer of MachineControllerConfig (prev. non-pointer MachineControllerConfig),
  • MachineController.Deploy is now bool instead of pointer on bool.

The following changes should be considered before merging the PR:

  • Make serviceDomainName working.
  • Support more than one API endpoint (a follow-up).
  • Is openidConnect a correct JSON tag or should it be openIdConnect?
  • Fix a typo in apiEndpoint (should be apiEndpoints).
  • Make sure that the cluster is updated after the hostname or operating system is changed.
  • Remove the old API (pkg/config) (a follow-up).
  • Build a migration tool for migrating from the old API to the new KubeOneCluster API (a follow-up).
  • Update documentation and examples (a follow-up).

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
xref #259
The issue will be closed once the old API is removed.

Documentation:

Documentation is up to be updated.

Release note:

[BREAKING CHANGES] Migrate to the new KubeOneCluster API. Disable the old API.

/assign @kron4eg
cc @scheeles

/hold
until we don't agree on the final API structure

@xmudrii xmudrii requested a review from kron4eg April 28, 2019 19:11
@kubermatic-bot kubermatic-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 28, 2019
@xmudrii xmudrii force-pushed the api-migration/migrate branch 2 times, most recently from b4dc950 to 4e523ed Compare April 30, 2019 09:19
@xmudrii
Copy link
Member Author

xmudrii commented Apr 30, 2019

@kron4eg Removed the hack and committed the appropriate fix. ServiceDomainName is now usable as well.

@xmudrii xmudrii changed the title [WIP] Migrate to the KubeOneCluster API Migrate to the KubeOneCluster API Apr 30, 2019
@kubermatic-bot kubermatic-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 30, 2019
@xmudrii
Copy link
Member Author

xmudrii commented Apr 30, 2019

/hold cancel
Issues will be created for other tasks once the PR is merged

@kubermatic-bot kubermatic-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 30, 2019
config.yaml.dist Outdated Show resolved Hide resolved
config.yaml.dist Outdated Show resolved Hide resolved
@xmudrii
Copy link
Member Author

xmudrii commented Apr 30, 2019

/test pull-kubeone-build

The Terraform integration in the new API will be disabled until the
migration is finished

Signed-off-by: Marko Mudrinić <[email protected]>
Signed-off-by: Marko Mudrinić <[email protected]>
Signed-off-by: Marko Mudrinić <[email protected]>
Signed-off-by: Marko Mudrinić <[email protected]>
Signed-off-by: Marko Mudrinić <[email protected]>
Signed-off-by: Marko Mudrinić <[email protected]>
Signed-off-by: Marko Mudrinić <[email protected]>
Signed-off-by: Marko Mudrinić <[email protected]>
Signed-off-by: Marko Mudrinić <[email protected]>
Signed-off-by: Marko Mudrinić <[email protected]>
Signed-off-by: Marko Mudrinić <[email protected]>
Signed-off-by: Marko Mudrinić <[email protected]>
@kubermatic-bot kubermatic-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 1, 2019
Signed-off-by: Marko Mudrinić <[email protected]>
Signed-off-by: Marko Mudrinić <[email protected]>
@xmudrii
Copy link
Member Author

xmudrii commented May 1, 2019

/retest

@xmudrii
Copy link
Member Author

xmudrii commented May 1, 2019

One DNS flake and one DO API flake.
/retest

Copy link
Member

@kron4eg kron4eg left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@kubermatic-bot kubermatic-bot added the lgtm Indicates that a PR is ready to be merged. label May 1, 2019
@kubermatic-bot
Copy link
Contributor

LGTM label has been added.

Git tree hash: f6e7aa01f1b20bb2fa626e1d315cf33c0de46bc7

@kubermatic-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kron4eg

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

@kubermatic-bot kubermatic-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 1, 2019
@kubermatic-bot kubermatic-bot merged commit ec8bf30 into master May 1, 2019
@kubermatic-bot kubermatic-bot deleted the api-migration/migrate branch May 1, 2019 09:41
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. dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

3 participants