Skip to content

Commit

Permalink
Drop dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
philpep committed Dec 18, 2021
1 parent c7827e7 commit 84b3e0b
Showing 1 changed file with 6 additions and 31 deletions.
37 changes: 6 additions & 31 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"encoding/json"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"os"
Expand All @@ -42,13 +41,6 @@ import (
"github.com/containers/image/v5/manifest"
)

func closeResource(r io.Closer) {
err := r.Close()
if err != nil {
log.Print(err)
}
}

var digestCache = map[string]string{}

// GetDigest return the docker digest of given image name
Expand Down Expand Up @@ -84,13 +76,12 @@ func GetDigest(ctx context.Context, name string) (string, error) {

// Config represent a imago configuration
type Config struct {
cluster *kubernetes.Clientset
secretCache map[string]*v1.Secret
namespace string
policy string
checkpods bool
xnamespace *arrayFlags
context context.Context
cluster *kubernetes.Clientset
namespace string
policy string
checkpods bool
xnamespace *arrayFlags
context context.Context
}

// NewConfig initialize a new imago config
Expand Down Expand Up @@ -191,22 +182,6 @@ func (c *Config) Update(fieldSelector, labelSelector string) error {
return nil
}

func (c *Config) getSecret(namespace string, name string) (*v1.Secret, error) {
ctx := c.context
key := fmt.Sprintf("%s/%s", namespace, name)
if c.secretCache == nil {
c.secretCache = make(map[string]*v1.Secret)
}
if c.secretCache[key] == nil {
secret, err := c.cluster.CoreV1().Secrets(namespace).Get(ctx, name, metav1.GetOptions{})
if err != nil {
return nil, err
}
c.secretCache[key] = secret
}
return c.secretCache[key], nil
}

type configAnnotationImageSpec struct {
Name string `json:"name"`
Image string `json:"image"`
Expand Down

0 comments on commit 84b3e0b

Please sign in to comment.