Skip to content

Commit

Permalink
Merge pull request #16 from armosec/bump
Browse files Browse the repository at this point in the history
bump docker/docker dependency
  • Loading branch information
matthyx authored Jan 30, 2024
2 parents aabe68e + d7c3245 commit 3997fa5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.18
require (
github.com/armosec/armoapi-go v0.0.234
github.com/armosec/utils-go v0.0.20
github.com/docker/docker v24.0.5+incompatible
github.com/docker/docker v25.0.1+incompatible
github.com/francoispqt/gojay v1.2.13
github.com/olvrng/ujson v1.1.0
github.com/spf13/viper v1.7.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/docker/docker v24.0.5+incompatible h1:WmgcE4fxyI6EEXxBRxsHnZXrO1pQ3smi0k/jho4HLeY=
github.com/docker/docker v24.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v25.0.1+incompatible h1:k5TYd5rIVQRSqcTwCID+cyVA0yRg86+Pcrz1ls0/frA=
github.com/docker/docker v25.0.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
Expand Down
20 changes: 10 additions & 10 deletions secrethandling/inclustersecrethandling.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import (
"fmt"
"strings"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/registry"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
)

// DockerConfigJsonstructure -
type DockerConfigJsonstructure map[string]map[string]types.AuthConfig
type DockerConfigJsonstructure map[string]map[string]registry.AuthConfig

func updateSecret(authConfig *types.AuthConfig, serverAddress string) {
func updateSecret(authConfig *registry.AuthConfig, serverAddress string) {
if authConfig.ServerAddress == "" {
authConfig.ServerAddress = serverAddress
}
Expand Down Expand Up @@ -55,14 +55,14 @@ func parseDecodedSecret(sec map[string]string) (string, string) {
}

// ReadSecret -
func ReadSecret(secret interface{}, secretName string) (types.AuthConfig, error) {
func ReadSecret(secret interface{}, secretName string) (registry.AuthConfig, error) {
// Store secret based on it's structure
var authConfig types.AuthConfig
if sec, ok := secret.(*types.AuthConfig); ok {
var authConfig registry.AuthConfig
if sec, ok := secret.(*registry.AuthConfig); ok {
return *sec, nil
}
if sec, ok := secret.(map[string]string); ok {
return types.AuthConfig{Username: sec["username"]}, nil
return registry.AuthConfig{Username: sec["username"]}, nil
}
if sec, ok := secret.(DockerConfigJsonstructure); ok {
if _, k := sec["auths"]; !k {
Expand All @@ -77,7 +77,7 @@ func ReadSecret(secret interface{}, secretName string) (types.AuthConfig, error)
return authConfig, fmt.Errorf("cant find secret")
}

func GetSecret(clientset *kubernetes.Clientset, namespace, name string) (*types.AuthConfig, error) {
func GetSecret(clientset *kubernetes.Clientset, namespace, name string) (*registry.AuthConfig, error) {
res, err := clientset.CoreV1().Secrets(namespace).Get(context.Background(), name, metav1.GetOptions{})
if err != nil {
return nil, err
Expand Down Expand Up @@ -131,11 +131,11 @@ func GetSecretContent(secret *corev1.Secret) (interface{}, error) {
return nil, fmt.Errorf("username or password not found")
}

return &types.AuthConfig{Username: user, Password: psw}, nil
return &registry.AuthConfig{Username: user, Password: psw}, nil
}
}

func ParseSecret(res *corev1.Secret, name string) (*types.AuthConfig, error) {
func ParseSecret(res *corev1.Secret, name string) (*registry.AuthConfig, error) {

// Read secret
secret, err := GetSecretContent(res)
Expand Down

0 comments on commit 3997fa5

Please sign in to comment.