From 0905aa7394ffd53ff6864a204c24af279b123260 Mon Sep 17 00:00:00 2001 From: Nic Cope Date: Wed, 7 Nov 2018 17:10:07 -0800 Subject: [PATCH 1/2] Add license headers --- cmd/draino/draino.go | 16 ++++++++++++++++ internal/kubernetes/drainer.go | 16 ++++++++++++++++ internal/kubernetes/drainer_test.go | 16 ++++++++++++++++ internal/kubernetes/eventhandler.go | 22 +++++++++++++++++++--- internal/kubernetes/eventhandler_test.go | 16 ++++++++++++++++ internal/kubernetes/nodefilters.go | 16 ++++++++++++++++ internal/kubernetes/nodefilters_test.go | 16 ++++++++++++++++ internal/kubernetes/podfilters.go | 16 ++++++++++++++++ internal/kubernetes/podfilters_test.go | 16 ++++++++++++++++ internal/kubernetes/util.go | 16 ++++++++++++++++ internal/kubernetes/watch.go | 16 ++++++++++++++++ internal/kubernetes/watch_test.go | 16 ++++++++++++++++ 12 files changed, 195 insertions(+), 3 deletions(-) diff --git a/cmd/draino/draino.go b/cmd/draino/draino.go index 2030cb8f..d2328c22 100644 --- a/cmd/draino/draino.go +++ b/cmd/draino/draino.go @@ -1,3 +1,19 @@ +/* +Copyright 2018 Planet Labs Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing permissions +and limitations under the License. +*/ + package main import ( diff --git a/internal/kubernetes/drainer.go b/internal/kubernetes/drainer.go index 22309350..85f05e5d 100644 --- a/internal/kubernetes/drainer.go +++ b/internal/kubernetes/drainer.go @@ -1,3 +1,19 @@ +/* +Copyright 2018 Planet Labs Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing permissions +and limitations under the License. +*/ + package kubernetes import ( diff --git a/internal/kubernetes/drainer_test.go b/internal/kubernetes/drainer_test.go index 804ff7e4..ac9e4e60 100644 --- a/internal/kubernetes/drainer_test.go +++ b/internal/kubernetes/drainer_test.go @@ -1,3 +1,19 @@ +/* +Copyright 2018 Planet Labs Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing permissions +and limitations under the License. +*/ + package kubernetes import ( diff --git a/internal/kubernetes/eventhandler.go b/internal/kubernetes/eventhandler.go index dd525ba6..f12c7193 100644 --- a/internal/kubernetes/eventhandler.go +++ b/internal/kubernetes/eventhandler.go @@ -1,3 +1,19 @@ +/* +Copyright 2018 Planet Labs Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing permissions +and limitations under the License. +*/ + package kubernetes import ( @@ -69,9 +85,9 @@ func WithDrainBuffer(d time.Duration) DrainingResourceEventHandlerOption { // NewDrainingResourceEventHandler returns a new DrainingResourceEventHandler. func NewDrainingResourceEventHandler(d CordonDrainer, e record.EventRecorder, ho ...DrainingResourceEventHandlerOption) *DrainingResourceEventHandler { h := &DrainingResourceEventHandler{ - l: zap.NewNop(), - d: d, - e: e, + l: zap.NewNop(), + d: d, + e: e, lastDrainScheduledFor: time.Now(), buffer: DefaultDrainBuffer, } diff --git a/internal/kubernetes/eventhandler_test.go b/internal/kubernetes/eventhandler_test.go index 93c42326..142738a1 100644 --- a/internal/kubernetes/eventhandler_test.go +++ b/internal/kubernetes/eventhandler_test.go @@ -1,3 +1,19 @@ +/* +Copyright 2018 Planet Labs Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing permissions +and limitations under the License. +*/ + package kubernetes import ( diff --git a/internal/kubernetes/nodefilters.go b/internal/kubernetes/nodefilters.go index f5acce0b..a4ca8013 100644 --- a/internal/kubernetes/nodefilters.go +++ b/internal/kubernetes/nodefilters.go @@ -1,3 +1,19 @@ +/* +Copyright 2018 Planet Labs Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing permissions +and limitations under the License. +*/ + package kubernetes import ( diff --git a/internal/kubernetes/nodefilters_test.go b/internal/kubernetes/nodefilters_test.go index 6da3c5cb..05b150e0 100644 --- a/internal/kubernetes/nodefilters_test.go +++ b/internal/kubernetes/nodefilters_test.go @@ -1,3 +1,19 @@ +/* +Copyright 2018 Planet Labs Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing permissions +and limitations under the License. +*/ + package kubernetes import ( diff --git a/internal/kubernetes/podfilters.go b/internal/kubernetes/podfilters.go index 452a25a7..2d5aaad5 100644 --- a/internal/kubernetes/podfilters.go +++ b/internal/kubernetes/podfilters.go @@ -1,3 +1,19 @@ +/* +Copyright 2018 Planet Labs Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing permissions +and limitations under the License. +*/ + package kubernetes import ( diff --git a/internal/kubernetes/podfilters_test.go b/internal/kubernetes/podfilters_test.go index 49448610..d18e0cde 100644 --- a/internal/kubernetes/podfilters_test.go +++ b/internal/kubernetes/podfilters_test.go @@ -1,3 +1,19 @@ +/* +Copyright 2018 Planet Labs Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing permissions +and limitations under the License. +*/ + package kubernetes import ( diff --git a/internal/kubernetes/util.go b/internal/kubernetes/util.go index 0f3c768e..912a9b1f 100644 --- a/internal/kubernetes/util.go +++ b/internal/kubernetes/util.go @@ -1,3 +1,19 @@ +/* +Copyright 2018 Planet Labs Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing permissions +and limitations under the License. +*/ + package kubernetes import ( diff --git a/internal/kubernetes/watch.go b/internal/kubernetes/watch.go index e35dd18a..ba087abf 100644 --- a/internal/kubernetes/watch.go +++ b/internal/kubernetes/watch.go @@ -1,3 +1,19 @@ +/* +Copyright 2018 Planet Labs Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing permissions +and limitations under the License. +*/ + package kubernetes import ( diff --git a/internal/kubernetes/watch_test.go b/internal/kubernetes/watch_test.go index a9813032..d5f0a17b 100644 --- a/internal/kubernetes/watch_test.go +++ b/internal/kubernetes/watch_test.go @@ -1,3 +1,19 @@ +/* +Copyright 2018 Planet Labs Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing permissions +and limitations under the License. +*/ + package kubernetes import ( From 63a0a4e5980bdcc30a614125b90c14176eaf85fc Mon Sep 17 00:00:00 2001 From: Nic Cope Date: Wed, 7 Nov 2018 17:11:58 -0800 Subject: [PATCH 2/2] Update import path --- Dockerfile | 2 +- README.md | 2 +- cmd/draino/draino.go | 2 +- glide.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 73d783d6..44d3d80e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM golang:1.10-alpine3.8 AS build RUN apk update && apk add git -WORKDIR /go/src/github.com/negz/draino +WORKDIR /go/src/github.com/planetlabs/draino COPY . . RUN go get -u github.com/Masterminds/glide diff --git a/README.md b/README.md index 171bfa14..0d5ffe96 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# draino [![Docker Pulls](https://img.shields.io/docker/pulls/negz/draino.svg)](https://hub.docker.com/r/negz/draino/) [![Godoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/negz/draino) [![Travis](https://img.shields.io/travis/com/negz/draino.svg?maxAge=300)](https://travis-ci.com/negz/draino/) [![Codecov](https://img.shields.io/codecov/c/github/negz/draino.svg?maxAge=3600)](https://codecov.io/gh/negz/draino/) +# draino [![Docker Pulls](https://img.shields.io/docker/pulls/negz/draino.svg)](https://hub.docker.com/r/negz/draino/) [![Godoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/planetlabs/draino) [![Travis](https://img.shields.io/travis/com/negz/draino.svg?maxAge=300)](https://travis-ci.com/negz/draino/) [![Codecov](https://img.shields.io/codecov/c/github/negz/draino.svg?maxAge=3600)](https://codecov.io/gh/negz/draino/) Draino automatically drains Kubernetes nodes based on labels and node conditions. Nodes that match _all_ of the supplied labels and _any_ of the supplied node conditions will be cordoned immediately and drained after a diff --git a/cmd/draino/draino.go b/cmd/draino/draino.go index d2328c22..9cb44a7b 100644 --- a/cmd/draino/draino.go +++ b/cmd/draino/draino.go @@ -34,7 +34,7 @@ import ( client "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/cache" - "github.com/negz/draino/internal/kubernetes" + "github.com/planetlabs/draino/internal/kubernetes" ) // TODO(negz): Use leader election? We don't really want more than one draino diff --git a/glide.yaml b/glide.yaml index 41c4999b..b9812daf 100644 --- a/glide.yaml +++ b/glide.yaml @@ -1,4 +1,4 @@ -package: github.com/negz/draino +package: github.com/planetlabs/draino import: - package: github.com/julienschmidt/httprouter version: v1.1