Repository navigation
Avoid importing k8s.io/kubernetes from pkg/helm - #4499
Conversation
Ran `glide update` and `glide install --strip-vendor`. Added version specifications to k8s.io/apimachienery and k8s.io/apiserver according to helm's glide.lock https://github.com/helm/helm/blob/cc7cc1087f586f64d0b0d08aa516a003ced2d85b/glide.lock#L457 to prevent build errors. The huge k8s.io/kubernetes dependency is introduced due to the upstream issue, helm/helm#4499. It should be changed to our own fork, and the removed in the future once the upstream incorporates the fix. Resolves databus23#81
Ran `glide update` and `glide install --strip-vendor`. Added version specifications to k8s.io/apimachienery and k8s.io/apiserver according to helm's glide.lock https://github.com/helm/helm/blob/cc7cc1087f586f64d0b0d08aa516a003ced2d85b/glide.lock#L457 to prevent build errors. The huge k8s.io/kubernetes dependency is introduced due to the upstream issue, helm/helm#4499. It should be changed to our own fork, and the removed in the future once the upstream incorporates the fix. Resolves databus23#81
|
Hm, copying error strings around seems somewhat risky. Perhaps a better fix would be to move the error wrappers to their own package that didn't import the rest of kube? You can leave an alias behind to avoid breaking working code. |
|
@novas0x2a Hmm, ok we could do that. Keep in mind that this is only used the |
|
I agree with @novas0x2a's assertion; I don't like the thought of duplicating code to get around a library issue. I sympathize and understand the use case but duplicating code (and maintenance) doesn't sit well with me. Any way we can move this to a separate package? |
|
@bacongobbler Sure. I updated the branch as requested. |
|
|
||
| var ( | ||
| // ErrReleaseNotFound indicates that a release is not found. | ||
| ErrReleaseNotFound = func(release string) error { return fmt.Errorf("release: %q not found", release) } |
There was a problem hiding this comment.
can we do a ErrReleaseNotFound = storageerrors.ErrReleaseNotFound? That way we won't break other users relying on this API.
diff --git a/pkg/storage/driver/driver.go b/pkg/storage/driver/driver.go
index 7ad28770..017468d6 100644
--- a/pkg/storage/driver/driver.go
+++ b/pkg/storage/driver/driver.go
@@ -17,9 +17,20 @@ limitations under the License.
package driver // import "k8s.io/helm/pkg/storage/driver"
import (
+ storageerrors "k8s.io/helm/pkg/storage/errors"
+
rspb "k8s.io/helm/pkg/proto/hapi/release"
)
+var (
+ // ErrReleaseNotFound has been deprecated; please use storageerrors.ErrReleaseNotFound instead.
+ ErrReleaseNotFound = storageerrors.ErrReleaseNotFound
+ // ErrReleaseExists has been deprecated; please use storageerrors.ErrReleaseExists instead.
+ ErrReleaseExists = storageerrors.ErrReleaseExists
+ // ErrInvalidKey has been deprecated; please use storageerrors.ErrInvalidKey instead.
+ ErrInvalidKey = storageerrors.ErrInvalidKey
+)
+
// Creator is the interface that wraps the Create method.
//
// Create stores the release or returns ErrReleaseExists
|
Thanks @databus23! One last change and it looks good to go. |
When writing a helm client (e.g. a helm plugin) that talks to tiller importing k8s.io/helm/pkg/helm to get the grpc client is key. This pkg should not have a dependency to the k8s.io/kubernetes to avoid pulling in a lot of code that is only used within tiller and blow up binary sizes. Signed-off-by: Fabian Ruff <[email protected]>
Signed-off-by: Fabian Ruff <[email protected]>
Signed-off-by: Fabian Ruff <[email protected]>
Signed-off-by: Fabian Ruff <[email protected]>
Signed-off-by: Fabian Ruff <[email protected]>
|
@bacongobbler done |
* Avoid importing k8s.io/kubernetes from pkg/helm When writing a helm client (e.g. a helm plugin) that talks to tiller importing k8s.io/helm/pkg/helm to get the grpc client is key. This pkg should not have a dependency to the k8s.io/kubernetes to avoid pulling in a lot of code that is only used within tiller and blow up binary sizes. Signed-off-by: Fabian Ruff <[email protected]> * Add references to pull request in errors message Signed-off-by: Fabian Ruff <[email protected]> * copy helper function from pkg/storage/driver Signed-off-by: Fabian Ruff <[email protected]> * Move storage errors to seperate package Signed-off-by: Fabian Ruff <[email protected]> * Keep old error variables for backward compatibility Signed-off-by: Fabian Ruff <[email protected]> # Conflicts: # cmd/helm/upgrade.go # pkg/helm/fake.go
* Avoid importing k8s.io/kubernetes from pkg/helm When writing a helm client (e.g. a helm plugin) that talks to tiller importing k8s.io/helm/pkg/helm to get the grpc client is key. This pkg should not have a dependency to the k8s.io/kubernetes to avoid pulling in a lot of code that is only used within tiller and blow up binary sizes. Signed-off-by: Fabian Ruff <[email protected]> * Add references to pull request in errors message Signed-off-by: Fabian Ruff <[email protected]> * copy helper function from pkg/storage/driver Signed-off-by: Fabian Ruff <[email protected]> * Move storage errors to seperate package Signed-off-by: Fabian Ruff <[email protected]> * Keep old error variables for backward compatibility Signed-off-by: Fabian Ruff <[email protected]> Signed-off-by: Sebastien Plisson <[email protected]>
* Avoid importing k8s.io/kubernetes from pkg/helm When writing a helm client (e.g. a helm plugin) that talks to tiller importing k8s.io/helm/pkg/helm to get the grpc client is key. This pkg should not have a dependency to the k8s.io/kubernetes to avoid pulling in a lot of code that is only used within tiller and blow up binary sizes. Signed-off-by: Fabian Ruff <[email protected]> * Add references to pull request in errors message Signed-off-by: Fabian Ruff <[email protected]> * copy helper function from pkg/storage/driver Signed-off-by: Fabian Ruff <[email protected]> * Move storage errors to seperate package Signed-off-by: Fabian Ruff <[email protected]> * Keep old error variables for backward compatibility Signed-off-by: Fabian Ruff <[email protected]> Signed-off-by: Sebastien Plisson <[email protected]>
* Avoid importing k8s.io/kubernetes from pkg/helm When writing a helm client (e.g. a helm plugin) that talks to tiller importing k8s.io/helm/pkg/helm to get the grpc client is key. This pkg should not have a dependency to the k8s.io/kubernetes to avoid pulling in a lot of code that is only used within tiller and blow up binary sizes. Signed-off-by: Fabian Ruff <[email protected]> * Add references to pull request in errors message Signed-off-by: Fabian Ruff <[email protected]> * copy helper function from pkg/storage/driver Signed-off-by: Fabian Ruff <[email protected]> * Move storage errors to seperate package Signed-off-by: Fabian Ruff <[email protected]> * Keep old error variables for backward compatibility Signed-off-by: Fabian Ruff <[email protected]>
* Avoid importing k8s.io/kubernetes from pkg/helm When writing a helm client (e.g. a helm plugin) that talks to tiller importing k8s.io/helm/pkg/helm to get the grpc client is key. This pkg should not have a dependency to the k8s.io/kubernetes to avoid pulling in a lot of code that is only used within tiller and blow up binary sizes. Signed-off-by: Fabian Ruff <[email protected]> * Add references to pull request in errors message Signed-off-by: Fabian Ruff <[email protected]> * copy helper function from pkg/storage/driver Signed-off-by: Fabian Ruff <[email protected]> * Move storage errors to seperate package Signed-off-by: Fabian Ruff <[email protected]> * Keep old error variables for backward compatibility Signed-off-by: Fabian Ruff <[email protected]>
When writing a helm client (e.g. a helm plugin) that talks to tiller importing k8s.io/helm/pkg/helm to get the grpc client is key.
This pkg should not have a dependency to
k8s.io/kubernetesto avoid pulling in a lot of code that is only used within tiller and that blows up resulting binary sizes considerably.Seems like this happen accidentally within the 2.10 development process.
We had something like this happen accidentally before: #2685