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

Update Helm and client-go deps #1662

Merged
merged 7 commits into from
Jul 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/run-acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ jobs:
dotnetversion:
- 3.1.x
goversion:
- 1.15.x
- 1.16.x
language:
- nodejs
- python
Expand All @@ -353,7 +353,7 @@ jobs:
strategy:
matrix:
platform: [ ubuntu-latest ]
go-version: [ 1.15.x ]
go-version: [ 1.16.x ]
node-version: [ 14.x ]
python-version: [ 3.7 ]
dotnet-version: [ 3.1.x ]
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## HEAD (Unreleased)

- Update Helm and client-go deps (https://github.com/pulumi/pulumi-kubernetes/pull/1662)

## 3.5.2 (July 29, 2021)

- Update pulumi dependencies v3.7.0 (https://github.com/pulumi/pulumi-kubernetes/pull/1651)
Expand Down
23 changes: 12 additions & 11 deletions provider/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ go 1.16

require (
github.com/ahmetb/go-linq v3.0.0+incompatible
github.com/evanphx/json-patch v4.9.0+incompatible
github.com/evanphx/json-patch v4.11.0+incompatible
github.com/golang/protobuf v1.5.2
github.com/googleapis/gnostic v0.4.1
github.com/googleapis/gnostic v0.5.1
github.com/imdario/mergo v0.3.11
github.com/onsi/ginkgo v1.12.0 // indirect
github.com/onsi/gomega v1.9.0 // indirect
Expand All @@ -15,19 +15,20 @@ require (
github.com/pulumi/pulumi/sdk/v3 v3.9.0
github.com/stretchr/testify v1.7.0
google.golang.org/grpc v1.37.0
helm.sh/helm/v3 v3.5.4
k8s.io/api v0.20.4
k8s.io/apimachinery v0.20.4
k8s.io/cli-runtime v0.20.4
k8s.io/client-go v0.20.4
k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd
k8s.io/kubectl v0.20.4
sigs.k8s.io/kustomize/api v0.4.1
helm.sh/helm/v3 v3.6.3
k8s.io/api v0.21.0
k8s.io/apimachinery v0.21.0
k8s.io/cli-runtime v0.21.0
k8s.io/client-go v0.21.0
k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e
k8s.io/kubectl v0.21.0
sigs.k8s.io/kustomize/api v0.8.11
sigs.k8s.io/kustomize/kyaml v0.11.0
sigs.k8s.io/yaml v1.2.0
)

replace (
github.com/docker/distribution => github.com/docker/distribution v0.0.0-20191216044856-a8371794149d
github.com/docker/docker => github.com/moby/moby v17.12.0-ce-rc1.0.20200618181300-9dc6525e6118+incompatible
github.com/evanphx/json-patch => github.com/evanphx/json-patch v4.9.0+incompatible
github.com/evanphx/json-patch => github.com/evanphx/json-patch v4.11.0+incompatible
)
308 changes: 94 additions & 214 deletions provider/go.sum

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions provider/pkg/openapi/openapi.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2018, Pulumi Corporation.
// Copyright 2016-2021, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -26,7 +26,6 @@ import (
"k8s.io/apimachinery/pkg/util/strategicpatch"
"k8s.io/cli-runtime/pkg/resource"
"k8s.io/client-go/discovery"
"k8s.io/client-go/dynamic"
"k8s.io/kube-openapi/pkg/util/proto"
"k8s.io/kubectl/pkg/scheme"
"k8s.io/kubectl/pkg/util/openapi"
Expand Down Expand Up @@ -149,10 +148,9 @@ func MergePatch(
}

// SupportsDryRun returns true if the given GVK supports dry-run applies.
func SupportsDryRun(client discovery.CachedDiscoveryInterface, dynamicClient dynamic.Interface,
gvk schema.GroupVersionKind) bool {
func SupportsDryRun(dryRunVerifier *resource.DryRunVerifier, gvk schema.GroupVersionKind) bool {
// If an error is returned, DryRun is not supported.
if err := resource.VerifyDryRun(gvk, dynamicClient, client); err != nil {
if err := dryRunVerifier.HasSupport(gvk); err != nil {
return false
}
return true
Expand Down
8 changes: 4 additions & 4 deletions provider/pkg/provider/invoke_kustomize.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2020, Pulumi Corporation.
// Copyright 2016-2021, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -21,9 +21,9 @@ import (
"github.com/pkg/errors"
"github.com/pulumi/pulumi-kubernetes/provider/v3/pkg/clients"
"github.com/pulumi/pulumi/sdk/v3/go/common/workspace"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/krusty"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

// kustomizeDirectory takes a path to a kustomization directory, either a local directory or a folder in a git repo,
Expand Down Expand Up @@ -55,9 +55,9 @@ func kustomizeDirectory(directory string, clientSet *clients.DynamicClientSet) (
DoPrune: false,
}

k := krusty.MakeKustomizer(fSys, opts)
k := krusty.MakeKustomizer(opts)

rm, err := k.Run(path)
rm, err := k.Run(fSys, path)
if err != nil {
return nil, errors.Wrapf(err, "kustomize failed for directory %q", path)
}
Expand Down
32 changes: 18 additions & 14 deletions provider/pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
"os/user"
"path/filepath"
"reflect"
"regexp"
"strings"
"sync"

jsonpatch "github.com/evanphx/json-patch"
pbempty "github.com/golang/protobuf/ptypes/empty"
structpb "github.com/golang/protobuf/ptypes/struct"
Expand All @@ -42,27 +53,18 @@ import (
pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"io/ioutil"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/sets"
k8sresource "k8s.io/cli-runtime/pkg/resource"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
clientapi "k8s.io/client-go/tools/clientcmd/api"
k8sopenapi "k8s.io/kubectl/pkg/util/openapi"
"net/http"
"net/url"
"os"
"os/user"
"path/filepath"
"reflect"
"regexp"
"sigs.k8s.io/yaml"
"strings"
"sync"
)

// --------------------------------------------------------------------------
Expand Down Expand Up @@ -125,9 +127,10 @@ type kubeProvider struct {

config *rest.Config // Cluster config, e.g., through $KUBECONFIG file.

clientSet *clients.DynamicClientSet
logClient *clients.LogClient
k8sVersion cluster.ServerVersion
clientSet *clients.DynamicClientSet
dryRunVerifier *k8sresource.DryRunVerifier
logClient *clients.LogClient
k8sVersion cluster.ServerVersion

resources k8sopenapi.Resources
resourcesMutex sync.RWMutex
Expand Down Expand Up @@ -520,6 +523,7 @@ func (k *kubeProvider) Configure(_ context.Context, req *pulumirpc.ConfigureRequ
return nil, err
}
k.clientSet = cs
k.dryRunVerifier = k8sresource.NewDryRunVerifier(cs.GenericClient, cs.DiscoveryClientCached)
lc, err := clients.NewLogClient(k.config)
if err != nil {
return nil, err
Expand Down Expand Up @@ -2278,7 +2282,7 @@ func (k *kubeProvider) supportsDryRun(gvk schema.GroupVersionKind) bool {
return false
}
// Ensure that the cluster is reachable and supports the server-side diff feature.
if k.clusterUnreachable || !openapi.SupportsDryRun(k.clientSet.DiscoveryClientCached, k.clientSet.GenericClient, gvk) {
if k.clusterUnreachable || !openapi.SupportsDryRun(k.dryRunVerifier, gvk) {
logger.V(9).Infof("server cannot dry run %v", gvk)
return false
}
Expand Down
Loading