Skip to content

Commit

Permalink
Merge pull request #120 from cybozu-go/cleanup
Browse files Browse the repository at this point in the history
Preparation for 2.0.0
  • Loading branch information
morimoto-cybozu authored Oct 12, 2020
2 parents 44def64 + d592e47 commit c4a9bb1
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand Down
56 changes: 56 additions & 0 deletions docs/coil-migrator.md
Original file line number Diff line number Diff line change
@@ -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.
```
9 changes: 9 additions & 0 deletions v2/config/cke/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resources:
- ../crd
- ../rbac
- ../pod
- ../webhook
- ./webhook-secret.yaml

patchesStrategicMerge:
- ./webhook_manifests_patch.yaml
7 changes: 7 additions & 0 deletions v2/config/cke/webhook-secret.yaml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions v2/config/cke/webhook_manifests_patch.yaml
Original file line number Diff line number Diff line change
@@ -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"
---
6 changes: 5 additions & 1 deletion v2/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion v2/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c4a9bb1

Please sign in to comment.