updated namereference config for missing references.

highlights:
RBAC references
ServiceAccountName reference
StatefulSet headless service reference
This commit is contained in:
Sunil Arora
2018-03-22 11:28:29 -07:00
parent 696ec9b171
commit 444c0cd61c

View File

@@ -339,4 +339,134 @@ var defaultNameReferencePathConfigs = []referencePathConfig{
},
},
},
{
// StatefulSet references headless service, so need to update the references.
referencedGVK: schema.GroupVersionKind{
Version: "v1",
Kind: "Service",
},
pathConfigs: []PathConfig{
{
GroupVersionKind: &schema.GroupVersionKind{
Group: "apps",
Kind: "StatefulSet",
},
Path: []string{"spec", "serviceName"},
CreateIfNotPresent: false,
},
},
},
{
referencedGVK: schema.GroupVersionKind{
Group: "rbac.authorization.k8s.io",
Kind: "Role",
},
pathConfigs: []PathConfig{
{
GroupVersionKind: &schema.GroupVersionKind{
Group: "rbac.authorization.k8s.io",
Kind: "RoleBinding",
},
Path: []string{"roleRef", "name"},
CreateIfNotPresent: false,
},
},
},
{
referencedGVK: schema.GroupVersionKind{
Group: "rbac.authorization.k8s.io",
Kind: "ClusterRole",
},
pathConfigs: []PathConfig{
{
GroupVersionKind: &schema.GroupVersionKind{
Group: "rbac.authorization.k8s.io",
Kind: "RoleBinding",
},
Path: []string{"roleRef", "name"},
CreateIfNotPresent: false,
},
{
GroupVersionKind: &schema.GroupVersionKind{
Group: "rbac.authorization.k8s.io",
Kind: "ClusterRoleBinding",
},
Path: []string{"roleRef", "name"},
CreateIfNotPresent: false,
},
},
},
{
referencedGVK: schema.GroupVersionKind{
Version: "v1",
Kind: "ServiceAccount",
},
pathConfigs: []PathConfig{
{
GroupVersionKind: &schema.GroupVersionKind{
Group: "rbac.authorization.k8s.io",
Kind: "RoleBinding",
},
Path: []string{"subjects", "name"},
CreateIfNotPresent: false,
},
{
GroupVersionKind: &schema.GroupVersionKind{
Group: "rbac.authorization.k8s.io",
Kind: "ClusterRoleBinding",
},
Path: []string{"subjects", "name"},
CreateIfNotPresent: false,
},
{
GroupVersionKind: &schema.GroupVersionKind{
Kind: "Pod",
},
Path: []string{"spec", "serviceAccountName"},
CreateIfNotPresent: false,
},
{
GroupVersionKind: &schema.GroupVersionKind{
Kind: "StatefulSet",
},
Path: []string{"spec", "template", "spec", "serviceAccountName"},
CreateIfNotPresent: false,
},
{
GroupVersionKind: &schema.GroupVersionKind{
Kind: "Deployment",
},
Path: []string{"spec", "template", "spec", "serviceAccountName"},
CreateIfNotPresent: false,
},
{
GroupVersionKind: &schema.GroupVersionKind{
Kind: "ReplicationController",
},
Path: []string{"spec", "template", "spec", "serviceAccountName"},
CreateIfNotPresent: false,
},
{
GroupVersionKind: &schema.GroupVersionKind{
Kind: "CronJob",
},
Path: []string{"spec", "jobTemplate", "spec", "template", "spec", "serviceAccountName"},
CreateIfNotPresent: false,
},
{
GroupVersionKind: &schema.GroupVersionKind{
Kind: "Job",
},
Path: []string{"spec", "template", "spec", "serviceAccountName"},
CreateIfNotPresent: false,
},
{
GroupVersionKind: &schema.GroupVersionKind{
Kind: "DaemonSet",
},
Path: []string{"spec", "template", "spec", "serviceAccountName"},
CreateIfNotPresent: false,
},
},
},
}