From c83b7019f5627758493ba35c789afb7a24418f95 Mon Sep 17 00:00:00 2001 From: Seth Pollack Date: Wed, 6 Jun 2018 12:04:49 -0400 Subject: [PATCH] add namerefs for initContainers --- pkg/transformers/namereferenceconfig.go | 200 ++++++++++++++++++++++++ 1 file changed, 200 insertions(+) diff --git a/pkg/transformers/namereferenceconfig.go b/pkg/transformers/namereferenceconfig.go index 022b83aa2..d9e8ca17e 100644 --- a/pkg/transformers/namereferenceconfig.go +++ b/pkg/transformers/namereferenceconfig.go @@ -45,6 +45,14 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "containers", "env", "valueFrom", "configMapKeyRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Version: "v1", + Kind: "Pod", + }, + Path: []string{"spec", "initContainers", "env", "valueFrom", "configMapKeyRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Version: "v1", @@ -53,6 +61,14 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "containers", "envFrom", "configMapRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Version: "v1", + Kind: "Pod", + }, + Path: []string{"spec", "initContainers", "envFrom", "configMapRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "Deployment", @@ -67,6 +83,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "env", "valueFrom", "configMapKeyRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "Deployment", + }, + Path: []string{"spec", "template", "spec", "initContainers", "env", "valueFrom", "configMapKeyRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "Deployment", @@ -74,6 +97,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "envFrom", "configMapRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "Deployment", + }, + Path: []string{"spec", "template", "spec", "initContainers", "envFrom", "configMapRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "ReplicaSet", @@ -88,6 +118,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "env", "valueFrom", "configMapKeyRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "ReplicaSet", + }, + Path: []string{"spec", "template", "spec", "initContainers", "env", "valueFrom", "configMapKeyRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "ReplicaSet", @@ -95,6 +132,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "envFrom", "configMapRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "ReplicaSet", + }, + Path: []string{"spec", "template", "spec", "initContainers", "envFrom", "configMapRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "DaemonSet", @@ -109,6 +153,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "env", "valueFrom", "configMapKeyRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "DaemonSet", + }, + Path: []string{"spec", "template", "spec", "initContainers", "env", "valueFrom", "configMapKeyRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "DaemonSet", @@ -116,6 +167,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "envFrom", "configMapRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "DaemonSet", + }, + Path: []string{"spec", "template", "spec", "initContainers", "envFrom", "configMapRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "StatefulSet", @@ -130,6 +188,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "env", "valueFrom", "configMapKeyRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "StatefulSet", + }, + Path: []string{"spec", "template", "spec", "initContainers", "env", "valueFrom", "configMapKeyRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "StatefulSet", @@ -137,6 +202,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "envFrom", "configMapRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "StatefulSet", + }, + Path: []string{"spec", "template", "spec", "initContainers", "envFrom", "configMapRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "Job", @@ -151,6 +223,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "env", "valueFrom", "configMapKeyRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "Job", + }, + Path: []string{"spec", "template", "spec", "initContainers", "env", "valueFrom", "configMapKeyRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "Job", @@ -158,6 +237,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "envFrom", "configMapRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "Job", + }, + Path: []string{"spec", "template", "spec", "initContainers", "envFrom", "configMapRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "CronJob", @@ -172,6 +258,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "jobTemplate", "spec", "template", "spec", "containers", "env", "valueFrom", "configMapKeyRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "CronJob", + }, + Path: []string{"spec", "jobTemplate", "spec", "template", "spec", "initContainers", "env", "valueFrom", "configMapKeyRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "CronJob", @@ -179,6 +272,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "jobTemplate", "spec", "template", "spec", "containers", "envFrom", "configMapRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "CronJob", + }, + Path: []string{"spec", "jobTemplate", "spec", "template", "spec", "initContainers", "envFrom", "configMapRef", "name"}, + CreateIfNotPresent: false, + }, }, }, { @@ -203,6 +303,14 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "containers", "env", "valueFrom", "secretKeyRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Version: "v1", + Kind: "Pod", + }, + Path: []string{"spec", "initContainers", "env", "valueFrom", "secretKeyRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Version: "v1", @@ -211,6 +319,14 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "containers", "envFrom", "secretRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Version: "v1", + Kind: "Pod", + }, + Path: []string{"spec", "initContainers", "envFrom", "secretRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "Deployment", @@ -225,6 +341,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "env", "valueFrom", "secretKeyRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "Deployment", + }, + Path: []string{"spec", "template", "spec", "initContainers", "env", "valueFrom", "secretKeyRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "Deployment", @@ -232,6 +355,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "envFrom", "secretRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "Deployment", + }, + Path: []string{"spec", "template", "spec", "initContainers", "envFrom", "secretRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "ReplicaSet", @@ -246,6 +376,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "env", "valueFrom", "secretKeyRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "ReplicaSet", + }, + Path: []string{"spec", "template", "spec", "initContainers", "env", "valueFrom", "secretKeyRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "ReplicaSet", @@ -253,6 +390,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "envFrom", "secretRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "ReplicaSet", + }, + Path: []string{"spec", "template", "spec", "initContainers", "envFrom", "secretRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "DaemonSet", @@ -267,6 +411,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "env", "valueFrom", "secretKeyRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "DaemonSet", + }, + Path: []string{"spec", "template", "spec", "initContainers", "env", "valueFrom", "secretKeyRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "DaemonSet", @@ -274,6 +425,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "envFrom", "secretRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "DaemonSet", + }, + Path: []string{"spec", "template", "spec", "initContainers", "envFrom", "secretRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "StatefulSet", @@ -288,6 +446,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "env", "valueFrom", "secretKeyRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "StatefulSet", + }, + Path: []string{"spec", "template", "spec", "initContainers", "env", "valueFrom", "secretKeyRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "StatefulSet", @@ -295,6 +460,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "envFrom", "secretRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "StatefulSet", + }, + Path: []string{"spec", "template", "spec", "initContainers", "envFrom", "secretRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "Job", @@ -309,6 +481,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "env", "valueFrom", "secretKeyRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "Job", + }, + Path: []string{"spec", "template", "spec", "initContainers", "env", "valueFrom", "secretKeyRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "Job", @@ -316,6 +495,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "template", "spec", "containers", "envFrom", "secretRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "Job", + }, + Path: []string{"spec", "template", "spec", "initContainers", "envFrom", "secretRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "CronJob", @@ -330,6 +516,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "jobTemplate", "spec", "template", "spec", "containers", "env", "valueFrom", "secretKeyRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "CronJob", + }, + Path: []string{"spec", "jobTemplate", "spec", "template", "spec", "initContainers", "env", "valueFrom", "secretKeyRef", "name"}, + CreateIfNotPresent: false, + }, { GroupVersionKind: &schema.GroupVersionKind{ Kind: "CronJob", @@ -337,6 +530,13 @@ var defaultNameReferencePathConfigs = []referencePathConfig{ Path: []string{"spec", "jobTemplate", "spec", "template", "spec", "containers", "envFrom", "secretRef", "name"}, CreateIfNotPresent: false, }, + { + GroupVersionKind: &schema.GroupVersionKind{ + Kind: "CronJob", + }, + Path: []string{"spec", "jobTemplate", "spec", "template", "spec", "initContainers", "envFrom", "secretRef", "name"}, + CreateIfNotPresent: false, + }, }, }, {