Skip to content

Commit

Permalink
Fix whitespace violations
Browse files Browse the repository at this point in the history
  • Loading branch information
sagikazarmark authored and bonifaido committed Jan 28, 2020
1 parent 2b03b71 commit d5cb664
Show file tree
Hide file tree
Showing 15 changed files with 0 additions and 27 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ linters:
- goconst
- gocognit
- errcheck
- whitespace
- nakedret
- golint
- scopelint
Expand Down
1 change: 0 additions & 1 deletion cmd/bank-vaults/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ func watchConfigurations(vaultConfigFiles []string, configurations chan *viper.V
}

func parseConfiguration(vaultConfigFile string) *viper.Viper {

config := viper.New()

vaultConfig, err := ioutil.ReadFile(vaultConfigFile)
Expand Down
1 change: 0 additions & 1 deletion cmd/bank-vaults/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ func bToF(b bool) float64 {
}

func (e *prometheusExporter) Collect(ch chan<- prometheus.Metric) {

if e.Mode == "unseal" {
sealed, err := e.Vault.Sealed()
if err != nil {
Expand Down
2 changes: 0 additions & 2 deletions cmd/bank-vaults/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ func vaultConfigForConfig(_ *viper.Viper) (vault.Config, error) {
}

func kvStoreForConfig(cfg *viper.Viper) (kv.Service, error) {

switch mode := cfg.GetString(cfgMode); mode {

case cfgModeValueGoogleCloudKMSGCS:
gcs, err := gcs.New(
cfg.GetString(cfgGoogleCloudStorageBucket),
Expand Down
1 change: 0 additions & 1 deletion cmd/template/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ func (i *arrayFlags) Set(value string) error {

// template is an internal CLI command and not supported for direct consumption.
func main() {

var filename string
var delimiters string
var templates arrayFlags
Expand Down
6 changes: 0 additions & 6 deletions cmd/vault-secrets-webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -877,9 +877,7 @@ func (mw *mutatingWebhook) mutateContainers(containers []corev1.Container, podSp
}

func addSecretsVolToContainers(vaultConfig internal.VaultConfig, containers []corev1.Container, logger *log.Logger) {

for i, container := range containers {

logger.Debugf("Add secrets VolumeMount to container %s", container.Name)

container.VolumeMounts = append(container.VolumeMounts, []corev1.VolumeMount{
Expand All @@ -894,9 +892,7 @@ func addSecretsVolToContainers(vaultConfig internal.VaultConfig, containers []co
}

func addAgentSecretsVolToContainers(vaultConfig internal.VaultConfig, containers []corev1.Container, logger *log.Logger) {

for i, container := range containers {

logger.Debugf("Add secrets VolumeMount to container %s", container.Name)

container.VolumeMounts = append(container.VolumeMounts, []corev1.VolumeMount{
Expand Down Expand Up @@ -940,7 +936,6 @@ func newK8SClient() (kubernetes.Interface, error) {
}

func (mw *mutatingWebhook) mutatePod(pod *corev1.Pod, vaultConfig internal.VaultConfig, ns string, dryRun bool) error {

logger.Debugf("Successfully connected to the API")

initContainersMutated, err := mw.mutateContainers(pod.Spec.InitContainers, &pod.Spec, vaultConfig, ns)
Expand Down Expand Up @@ -982,7 +977,6 @@ func (mw *mutatingWebhook) mutatePod(pod *corev1.Pod, vaultConfig internal.Vault
},
}
if vaultConfig.TLSSecret != "" {

mountPath := "/vault/tls/ca.crt"
volumeName := "vault-tls"
if hasTLSVolume(pod.Spec.Volumes) {
Expand Down
2 changes: 0 additions & 2 deletions cmd/vault-secrets-webhook/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func (r *MockRegistry) GetImageConfig(_ kubernetes.Interface, _ string, _ *corev
}

func Test_mutatingWebhook_mutateContainers(t *testing.T) {

type fields struct {
k8sClient kubernetes.Interface
registry registry.ImageRegistry
Expand Down Expand Up @@ -306,7 +305,6 @@ func Test_mutatingWebhook_mutateContainers(t *testing.T) {
}

func Test_mutatingWebhook_mutatePod(t *testing.T) {

type fields struct {
k8sClient kubernetes.Interface
registry registry.ImageRegistry
Expand Down
2 changes: 0 additions & 2 deletions cmd/vault-secrets-webhook/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ func (r *Registry) GetImageConfig(
namespace string,
container *corev1.Container,
podSpec *corev1.PodSpec) (*imagev1.ImageConfig, error) {

allowToCache := IsAllowedToCache(container)
if allowToCache {
if imageConfig, cacheHit := r.imageCache.Get(container.Image); cacheHit {
Expand Down Expand Up @@ -308,7 +307,6 @@ func (k *ContainerInfo) checkImagePullSecret(namespace string, secret string) (b

// Collect reads information from k8s and load them into the structure
func (k *ContainerInfo) Collect(container *corev1.Container, podSpec *corev1.PodSpec, credentialsCache *cache.Cache) error {

k.Image = k.fixDockerHubImage(container.Image)

var err error
Expand Down
1 change: 0 additions & 1 deletion cmd/vault-secrets-webhook/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ func mutateSecret(secret *corev1.Secret, vaultConfig internal.VaultConfig, _ str
}

func mutateDockerCreds(secret *corev1.Secret, dc *registry.DockerCreds, vaultClient *vault.Client) error {

assembled := registry.DockerCreds{Auths: map[string]dockerTypes.AuthConfig{}}

for key, creds := range dc.Auths {
Expand Down
2 changes: 0 additions & 2 deletions internal/configuration/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ func NewTemplater(leftDelimiter, rightDelimiter string) Templater {

// EnvTemplate interpolates environment variables in a configuration text
func (t Templater) EnvTemplate(templateText string) (*bytes.Buffer, error) {

var env struct {
Env map[string]string
}
Expand All @@ -59,7 +58,6 @@ func (t Templater) EnvTemplate(templateText string) (*bytes.Buffer, error) {

// Template interpolates a data structure in a template
func (t Templater) Template(templateText string, data interface{}) (*bytes.Buffer, error) {

configTemplate, err := template.New(templateName).
Funcs(sprig.TxtFuncMap()).
Delims(t.leftDelimiter, t.rightDelimiter).
Expand Down
2 changes: 0 additions & 2 deletions pkg/kv/awskms/awskms.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func NewWithSession(sess *session.Session, store kv.Service, kmsID string) (kv.S

// New creates a new kv.Service encrypted by AWS KMS
func New(store kv.Service, region string, kmsID string) (kv.Service, error) {

sess := session.Must(session.NewSession(aws.NewConfig().WithRegion(region)))

return NewWithSession(sess, store, kmsID)
Expand All @@ -75,7 +74,6 @@ func (a *awsKMS) Get(key string) ([]byte, error) {
}

func (a *awsKMS) encrypt(plainText []byte) ([]byte, error) {

out, err := a.kmsService.Encrypt(&kms.EncryptInput{
KeyId: aws.String(a.kmsID),
Plaintext: plainText,
Expand Down
2 changes: 0 additions & 2 deletions pkg/kv/azurekv/keyvault.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func New(name string) (kv.Service, error) {
}

func (a *azureKeyVault) Get(key string) ([]byte, error) {

bundle, err := a.client.GetSecret(context.Background(), a.vaultBaseURL, key, "")

if err != nil {
Expand All @@ -65,7 +64,6 @@ func (a *azureKeyVault) Get(key string) ([]byte, error) {
}

func (a *azureKeyVault) Set(key string, val []byte) error {

value := string(val)
parameters := keyvault.SecretSetParameters{
Value: &value,
Expand Down
2 changes: 0 additions & 2 deletions pkg/kv/dev/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ type dev struct {

// New creates a new kv.Service backed by memory, only the root token is stored, should be used with: vault server -dev
func New() (service kv.Service, err error) {

rootToken := []byte(os.Getenv("VAULT_TOKEN"))

if len(rootToken) == 0 {
Expand All @@ -49,7 +48,6 @@ func (d *dev) Set(key string, val []byte) error {
}

func (d *dev) Get(key string) ([]byte, error) {

if key == "vault-root" {
return d.rootToken, nil
}
Expand Down
1 change: 0 additions & 1 deletion pkg/kv/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ type file struct {

// New creates a new kv.Service backed by files, without any encryption
func New(path string) (service kv.Service, err error) {

service = &file{path: path}

return
Expand Down
1 change: 0 additions & 1 deletion pkg/kv/vault/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ type VaultStorage struct {

// New creates a new kv.Service backed by Vault KV Version 2
func New(addr, unsealKeysPath, role, authPath, tokenPath, token string) (kv.Service, error) {

client, err := vault.NewClientWithOptions(
vault.ClientURL(addr),
vault.ClientRole(role),
Expand Down

0 comments on commit d5cb664

Please sign in to comment.