diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4ca44f18..51e32407 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -35,6 +35,9 @@ jobs: - run: make test-founat timeout-minutes: 10 - run: make check-generate + - name: Build coil-migrator + run: go build . + working-directory: coil-migrator e2e: name: End-to-end Test strategy: diff --git a/CHANGELOG.md b/CHANGELOG.md index 251cc0d7..929c9682 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Added + +- `coil-migrator`: a utility to help live migration from v1 to v2 (#119). +- Install option for [CKE](https://github.com/cybozu-go/cke) (#120). + ## [2.0.0-rc.1] - 2020-10-05 Coil version 2 is a complete rewrite of Coil version 1. diff --git a/README.md b/README.md index cb0e76df..ddff625a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![GitHub release](https://img.shields.io/github/release/cybozu-go/coil.svg?maxAge=60)][releases] ![CI](https://github.com/cybozu-go/coil/workflows/CI/badge.svg) -[![PkgGoDev](https://pkg.go.dev/badge/github.com/cybozu-go/coil?tab=overview)](https://pkg.go.dev/github.com/cybozu-go/coil?tab=overview) +[![PkgGoDev](https://pkg.go.dev/badge/github.com/cybozu-go/coil?tab=overview)](https://pkg.go.dev/github.com/cybozu-go/coil/v2?tab=subdirectories) [![Go Report Card](https://goreportcard.com/badge/github.com/cybozu-go/coil)](https://goreportcard.com/report/github.com/cybozu-go/coil) Coil @@ -17,9 +17,7 @@ private IPv4 addresses for the remaining pods. ## Status -Version 2 is under **active development**. It conforms to [CNI spec 0.4.0](https://github.com/containernetworking/cni/blob/spec-v0.4.0/SPEC.md). - -Version 1 is maintained in [release-1.1](https://github.com/cybozu-go/coil/tree/release-1.1) branch. +Version 2 is generally available (GA). It conforms to [CNI spec 0.4.0](https://github.com/containernetworking/cni/blob/spec-v0.4.0/SPEC.md). ## Dependencies diff --git a/docs/coil-migrator.md b/docs/coil-migrator.md new file mode 100644 index 00000000..eb855964 --- /dev/null +++ b/docs/coil-migrator.md @@ -0,0 +1,56 @@ +coil-migrator +============= + +`coil-migrator` is a helper to migrate existing Coil v1 cluster to v2. + +It has two sub commands: `dump` and `replace`. + +See [design.md](design.md#upgrading-from-v1) for the design and +[#119](https://github.com/cybozu-go/coil/pull/119#issuecomment-704674318) for the usage. + +### dump sub command + +This command does the followings: + +- Remove Coil v1 resources from the cluster. +- Annotate namespaces using non-default address pools. +- Convert v1 data into v2 and dump them as YAML. + +These steps are idempotent and can be run multiple times. + +``` +Usage: + coil-migrator dump [flags] + +Flags: + --etcd-endpoints endpoints comma-separated list of URLs (default http://127.0.0.1:2379) + --etcd-password string password for etcd authentication + --etcd-prefix string prefix for etcd keys (default "/coil/") + --etcd-timeout string dial timeout to etcd (default "2s") + --etcd-tls-ca string filename of etcd server TLS CA + --etcd-tls-cert string filename of etcd client certficate + --etcd-tls-key string filename of etcd client private key + --etcd-username string username for etcd authentication + -h, --help help for dump + --skip-uninstall DANGER!! do not uninstall Coil v1 + +Global Flags: + --kubeconfig string Paths to a kubeconfig. Only required if out-of-cluster. +``` + +### replace sub command + +This command finalizes the migration from v1 to v2 by deleting +all the currently running Pods and then deleting reserved blocks. + +``` +Usage: + coil-migrator replace [flags] + +Flags: + -h, --help help for replace + --interval duration interval before starting to remove pods on the next node (default 10s) + +Global Flags: + --kubeconfig string Paths to a kubeconfig. Only required if out-of-cluster. +``` diff --git a/v2/config/cke/kustomization.yaml b/v2/config/cke/kustomization.yaml new file mode 100644 index 00000000..cce14146 --- /dev/null +++ b/v2/config/cke/kustomization.yaml @@ -0,0 +1,9 @@ +resources: +- ../crd +- ../rbac +- ../pod +- ../webhook +- ./webhook-secret.yaml + +patchesStrategicMerge: +- ./webhook_manifests_patch.yaml diff --git a/v2/config/cke/webhook-secret.yaml b/v2/config/cke/webhook-secret.yaml new file mode 100644 index 00000000..6275f0aa --- /dev/null +++ b/v2/config/cke/webhook-secret.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Secret +metadata: + name: coilv2-webhook-server-cert + namespace: system + annotations: + cke.cybozu.com/issue-cert: coilv2-webhook-service diff --git a/v2/config/cke/webhook_manifests_patch.yaml b/v2/config/cke/webhook_manifests_patch.yaml new file mode 100644 index 00000000..93506d82 --- /dev/null +++ b/v2/config/cke/webhook_manifests_patch.yaml @@ -0,0 +1,14 @@ +apiVersion: admissionregistration.k8s.io/v1beta1 +kind: MutatingWebhookConfiguration +metadata: + name: coilv2-mutating-webhook-configuration + annotations: + cke.cybozu.com/inject-cacert: "true" +--- +apiVersion: admissionregistration.k8s.io/v1beta1 +kind: ValidatingWebhookConfiguration +metadata: + name: coilv2-validating-webhook-configuration + annotations: + cke.cybozu.com/inject-cacert: "true" +--- diff --git a/v2/kustomization.yaml b/v2/kustomization.yaml index 022683a4..cb72c1f7 100644 --- a/v2/kustomization.yaml +++ b/v2/kustomization.yaml @@ -1,10 +1,14 @@ images: - name: coil - newTag: 2.0.0-rc.1 + newTag: 2.0.0 newName: ghcr.io/cybozu-go/coil resources: - config/default +# If you are using CKE (github.com/cybozu-go/cke) and wwant to use +# its webhook installation feature, comment the above line and +# uncomment the below line. +#- config/cke # If you want to enable coil-router, uncomment the following line. # Note that coil-router can work only for clusters where all the diff --git a/v2/version.go b/v2/version.go index 3809a93b..a7e5bf5e 100644 --- a/v2/version.go +++ b/v2/version.go @@ -5,7 +5,7 @@ import ( "strings" ) -const version = "2.0.0-rc.1" +const version = "2.0.0" // Version returns the semantic versioning string of Coil. func Version() string {