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

Stop importing the k8s.io/kubernetes module. #6411

Merged
merged 7 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 1 addition & 2 deletions cmd/asset-syncer/server/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
httpclient "github.com/vmware-tanzu/kubeapps/pkg/http-client"
"github.com/vmware-tanzu/kubeapps/pkg/kube"
log "k8s.io/klog/v2"
"k8s.io/kubernetes/pkg/credentialprovider"
)

func Sync(serveOpts Config, version string, args []string) error {
Expand Down Expand Up @@ -41,7 +40,7 @@ func Sync(serveOpts Config, version string, args []string) error {
authorizationHeader := serveOpts.AuthorizationHeader
// The auth header may be a dockerconfig that we need to parse
if serveOpts.DockerConfigJson != "" {
dockerConfig := &credentialprovider.DockerConfigJSON{}
dockerConfig := &kube.DockerConfigJSON{}
err = json.Unmarshal([]byte(serveOpts.DockerConfigJson), dockerConfig)
if err != nil {
return fmt.Errorf("Error: %v", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import (
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
corev1 "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/gen/core/packages/v1alpha1"
"github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/plugins/pkg/connecterror"
"github.com/vmware-tanzu/kubeapps/pkg/kube"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
log "k8s.io/klog/v2"
"k8s.io/kubernetes/pkg/credentialprovider"
)

const (
Expand Down Expand Up @@ -592,8 +592,8 @@ func newLocalOpaqueSecret(ownerRepo types.NamespacedName) *apiv1.Secret {
}

func encodeDockerAuth(credentials *corev1.DockerCredentials) ([]byte, error) {
config := &credentialprovider.DockerConfigJSON{
Auths: map[string]credentialprovider.DockerConfigEntry{
config := &kube.DockerConfigJSON{
Auths: map[string]kube.DockerConfigEntry{
credentials.Server: {
Username: credentials.Username,
Password: credentials.Password,
Expand All @@ -605,7 +605,7 @@ func encodeDockerAuth(credentials *corev1.DockerCredentials) ([]byte, error) {
}

func decodeDockerAuth(dockerjson []byte) (*corev1.DockerCredentials, error) {
config := &credentialprovider.DockerConfigJSON{}
config := &kube.DockerConfigJSON{}
if err := json.Unmarshal(dockerjson, config); err != nil {
return nil, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/bufbuild/connect-go"
"github.com/vmware-tanzu/kubeapps/pkg/helm"
"github.com/vmware-tanzu/kubeapps/pkg/kube"

apprepov1alpha1 "github.com/vmware-tanzu/kubeapps/cmd/apprepository-controller/pkg/apis/apprepository/v1alpha1"
corev1 "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/gen/core/packages/v1alpha1"
Expand All @@ -24,7 +25,6 @@ import (
"k8s.io/client-go/kubernetes"
v1 "k8s.io/client-go/kubernetes/typed/core/v1"
log "k8s.io/klog/v2"
"k8s.io/kubernetes/pkg/credentialprovider"
)

const (
Expand Down Expand Up @@ -844,8 +844,8 @@ func decodeBearerAuth(auth string) (token string, ok bool) {
}

func encodeDockerAuth(credentials *corev1.DockerCredentials) ([]byte, error) {
config := &credentialprovider.DockerConfigJSON{
Auths: map[string]credentialprovider.DockerConfigEntry{
config := &kube.DockerConfigJSON{
Auths: map[string]kube.DockerConfigEntry{
credentials.Server: {
Username: credentials.Username,
Password: credentials.Password,
Expand All @@ -857,7 +857,7 @@ func encodeDockerAuth(credentials *corev1.DockerCredentials) ([]byte, error) {
}

func decodeDockerAuth(dockerjson []byte) (*corev1.DockerCredentials, error) {
config := &credentialprovider.DockerConfigJSON{}
config := &kube.DockerConfigJSON{}
if err := json.Unmarshal(dockerjson, config); err != nil {
return nil, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"context"
"encoding/json"
"fmt"

"github.com/vmware-tanzu/kubeapps/pkg/chart/models"
"github.com/vmware-tanzu/kubeapps/pkg/dbutils"
"github.com/vmware-tanzu/kubeapps/pkg/kube"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/pkg/credentialprovider"
)

const (
Expand Down Expand Up @@ -64,7 +65,7 @@ func RegistrySecretsPerDomain(ctx context.Context, appRepoSecrets []string, name
return nil, fmt.Errorf("AppRepository secret must have a data map with a key %q. Secret %q did not", dockerConfigJSONKey, secretName)
}

dockerConfigJSON := credentialprovider.DockerConfigJSON{}
dockerConfigJSON := kube.DockerConfigJSON{}
if err := json.Unmarshal(dockerConfigJSONBytes, &dockerConfigJSON); err != nil {
return nil, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"time"

"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/kubernetes/pkg/credentialprovider"

k8scorev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -26,6 +25,7 @@ import (
corev1 "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/gen/core/packages/v1alpha1"
kappcorev1 "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/gen/plugins/kapp_controller/packages/v1alpha1"
"github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/plugins/pkg/pkgutils"
"github.com/vmware-tanzu/kubeapps/pkg/kube"
)

const REPO_REF_ANNOTATION = "packaging.carvel.dev/package-repository-ref"
Expand Down Expand Up @@ -534,8 +534,8 @@ func isDockerAuth(secret *k8scorev1.Secret) bool {
}

func toDockerConfig(docker *corev1.DockerCredentials) ([]byte, error) {
dockerConfig := &credentialprovider.DockerConfigJSON{
Auths: map[string]credentialprovider.DockerConfigEntry{
dockerConfig := &kube.DockerConfigJSON{
Auths: map[string]kube.DockerConfigEntry{
docker.Server: {
Username: docker.Username,
Password: docker.Password,
Expand All @@ -551,7 +551,7 @@ func toDockerConfig(docker *corev1.DockerCredentials) ([]byte, error) {
}

func fromDockerConfig(dockerjson []byte) (*corev1.DockerCredentials, error) {
dockerConfig := &credentialprovider.DockerConfigJSON{}
dockerConfig := &kube.DockerConfigJSON{}
if err := json.Unmarshal(dockerjson, dockerConfig); err != nil {
return nil, err
}
Expand Down
52 changes: 13 additions & 39 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,6 @@ module github.com/vmware-tanzu/kubeapps

go 1.19

replace (
// k8s.io/kubernetes is not intended to be used as a module, so versions are not being properly resolved.
// This replacement is requiredƒ, see https://github.com/kubernetes/kubernetes/issues/79384
// As we support new k8s versions, this replacements should be also updated accordingly.
k8s.io/api => k8s.io/api v0.26.1
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.26.1
k8s.io/apimachinery => k8s.io/apimachinery v0.26.1
k8s.io/apiserver => k8s.io/apiserver v0.26.1
k8s.io/cli-runtime => k8s.io/cli-runtime v0.26.1
k8s.io/client-go => k8s.io/client-go v0.26.1
k8s.io/cloud-provider => k8s.io/cloud-provider v0.26.1
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.26.1
k8s.io/code-generator => k8s.io/code-generator v0.26.1
k8s.io/component-base => k8s.io/component-base v0.26.1
k8s.io/component-helpers => k8s.io/component-helpers v0.26.1
k8s.io/controller-manager => k8s.io/controller-manager v0.26.1
k8s.io/cri-api => k8s.io/cri-api v0.26.1
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.26.1
k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.26.1
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.26.1
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.26.1
k8s.io/kube-proxy => k8s.io/kube-proxy v0.26.1
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.26.1
k8s.io/kubectl => k8s.io/kubectl v0.26.1
k8s.io/kubelet => k8s.io/kubelet v0.26.1
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.26.1
k8s.io/metrics => k8s.io/metrics v0.26.1
k8s.io/mount-utils => k8s.io/mount-utils v0.26.1
k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.26.1
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.26.1
)

require (
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/Masterminds/semver/v3 v3.2.1
Expand Down Expand Up @@ -72,7 +40,7 @@ require (
github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c
github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef
github.com/stretchr/testify v1.8.4
github.com/vmware-tanzu/carvel-kapp v0.57.1
github.com/vmware-tanzu/carvel-kapp v0.56.0
github.com/vmware-tanzu/carvel-kapp-controller v0.46.1
github.com/vmware-tanzu/carvel-vendir v0.34.3
golang.org/x/net v0.11.0
Expand All @@ -83,15 +51,14 @@ require (
google.golang.org/protobuf v1.31.0
gopkg.in/yaml.v3 v3.0.1
helm.sh/helm/v3 v3.11.3
k8s.io/api v0.27.2
k8s.io/api v0.26.6
k8s.io/apiextensions-apiserver v0.26.3
k8s.io/apimachinery v0.27.3
k8s.io/apiserver v0.26.2
k8s.io/apiserver v0.26.3
k8s.io/cli-runtime v0.26.1
k8s.io/client-go v0.27.2
k8s.io/client-go v0.26.6
k8s.io/klog/v2 v2.100.1
k8s.io/kubectl v0.26.1
k8s.io/kubernetes v1.26.5
k8s.io/utils v0.0.0-20230220204549-a5ecb0141aa5
oras.land/oras-go v1.2.3
oras.land/oras-go/v2 v2.2.0
Expand Down Expand Up @@ -126,7 +93,6 @@ require (
github.com/aws/aws-sdk-go-v2/service/sts v1.18.7 // indirect
github.com/aws/smithy-go v1.13.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/carvel-dev/semver/v4 v4.0.1-0.20230221220520-8090ce423695 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chai2010/gettext-go v1.0.2 // indirect
Expand Down Expand Up @@ -254,10 +220,18 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/component-base v0.26.2 // indirect
k8s.io/component-base v0.26.3 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.12.1 // indirect
sigs.k8s.io/kustomize/kyaml v0.13.9 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
)

// Until we can update to client-go 0.27 / k8s 1.27 (currently we cannot because
// it causes an error just like
// https://github.com/operator-framework/operator-sdk/issues/6396 as other upstream k8s libs
// are not yet switched, which leads to the cause explained at:
// https://github.com/operator-framework/operator-sdk/issues/6396#issuecomment-1521399563
// Note that this also stops carvel-kapp from v0.56.0 -> v0.57.1
exclude k8s.io/api v0.27.2
Loading