mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-01 10:20:35 +00:00
Introduce gvk package to isolate apimachinery schema.
This commit is contained in:
@@ -17,7 +17,7 @@ limitations under the License.
|
||||
package transformers
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/kustomize/pkg/gvk"
|
||||
)
|
||||
|
||||
// defaultLabelsPathConfigs is the default configuration for mutating labels and
|
||||
@@ -28,149 +28,149 @@ var defaultLabelsPathConfigs = []PathConfig{
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Version: "v1", Kind: "Service"},
|
||||
GroupVersionKind: &gvk.Gvk{Version: "v1", Kind: "Service"},
|
||||
Path: []string{"spec", "selector"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Version: "v1", Kind: "ReplicationController"},
|
||||
GroupVersionKind: &gvk.Gvk{Version: "v1", Kind: "ReplicationController"},
|
||||
Path: []string{"spec", "selector"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Version: "v1", Kind: "ReplicationController"},
|
||||
GroupVersionKind: &gvk.Gvk{Version: "v1", Kind: "ReplicationController"},
|
||||
Path: []string{"spec", "template", "metadata", "labels"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Kind: "Deployment"},
|
||||
GroupVersionKind: &gvk.Gvk{Kind: "Deployment"},
|
||||
Path: []string{"spec", "selector", "matchLabels"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Kind: "Deployment"},
|
||||
GroupVersionKind: &gvk.Gvk{Kind: "Deployment"},
|
||||
Path: []string{"spec", "template", "metadata", "labels"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "apps", Kind: "Deployment"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "apps", Kind: "Deployment"},
|
||||
Path: []string{"spec", "template", "spec", "affinity", "podAffinity",
|
||||
"preferredDuringSchedulingIgnoredDuringExecution",
|
||||
"podAffinityTerm", "labelSelector", "matchLabels"},
|
||||
CreateIfNotPresent: false,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "apps", Kind: "Deployment"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "apps", Kind: "Deployment"},
|
||||
Path: []string{"spec", "template", "spec", "affinity", "podAffinity",
|
||||
"requiredDuringSchedulingIgnoredDuringExecution", "labelSelector", "matchLabels"},
|
||||
CreateIfNotPresent: false,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "apps", Kind: "Deployment"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "apps", Kind: "Deployment"},
|
||||
Path: []string{"spec", "template", "spec", "affinity", "podAntiAffinity",
|
||||
"preferredDuringSchedulingIgnoredDuringExecution",
|
||||
"podAffinityTerm", "labelSelector", "matchLabels"},
|
||||
CreateIfNotPresent: false,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "apps", Kind: "Deployment"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "apps", Kind: "Deployment"},
|
||||
Path: []string{"spec", "template", "spec", "affinity", "podAntiAffinity",
|
||||
"requiredDuringSchedulingIgnoredDuringExecution", "labelSelector", "matchLabels"},
|
||||
CreateIfNotPresent: false,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Kind: "ReplicaSet"},
|
||||
GroupVersionKind: &gvk.Gvk{Kind: "ReplicaSet"},
|
||||
Path: []string{"spec", "selector", "matchLabels"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Kind: "ReplicaSet"},
|
||||
GroupVersionKind: &gvk.Gvk{Kind: "ReplicaSet"},
|
||||
Path: []string{"spec", "template", "metadata", "labels"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Kind: "DaemonSet"},
|
||||
GroupVersionKind: &gvk.Gvk{Kind: "DaemonSet"},
|
||||
Path: []string{"spec", "selector", "matchLabels"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Kind: "DaemonSet"},
|
||||
GroupVersionKind: &gvk.Gvk{Kind: "DaemonSet"},
|
||||
Path: []string{"spec", "template", "metadata", "labels"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "apps", Kind: "StatefulSet"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "apps", Kind: "StatefulSet"},
|
||||
Path: []string{"spec", "selector", "matchLabels"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "apps", Kind: "StatefulSet"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "apps", Kind: "StatefulSet"},
|
||||
Path: []string{"spec", "template", "metadata", "labels"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "apps", Kind: "StatefulSet"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "apps", Kind: "StatefulSet"},
|
||||
Path: []string{"spec", "template", "spec", "affinity", "podAffinity",
|
||||
"preferredDuringSchedulingIgnoredDuringExecution",
|
||||
"podAffinityTerm", "labelSelector", "matchLabels"},
|
||||
CreateIfNotPresent: false,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "apps", Kind: "StatefulSet"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "apps", Kind: "StatefulSet"},
|
||||
Path: []string{"spec", "template", "spec", "affinity", "podAffinity",
|
||||
"requiredDuringSchedulingIgnoredDuringExecution", "labelSelector", "matchLabels"},
|
||||
CreateIfNotPresent: false,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "apps", Kind: "StatefulSet"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "apps", Kind: "StatefulSet"},
|
||||
Path: []string{"spec", "template", "spec", "affinity", "podAntiAffinity",
|
||||
"preferredDuringSchedulingIgnoredDuringExecution",
|
||||
"podAffinityTerm", "labelSelector", "matchLabels"},
|
||||
CreateIfNotPresent: false,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "apps", Kind: "StatefulSet"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "apps", Kind: "StatefulSet"},
|
||||
Path: []string{"spec", "template", "spec", "affinity", "podAntiAffinity",
|
||||
"requiredDuringSchedulingIgnoredDuringExecution", "labelSelector", "matchLabels"},
|
||||
CreateIfNotPresent: false,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "batch", Kind: "Job"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "batch", Kind: "Job"},
|
||||
Path: []string{"spec", "selector", "matchLabels"},
|
||||
CreateIfNotPresent: false,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "batch", Kind: "Job"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "batch", Kind: "Job"},
|
||||
Path: []string{"spec", "template", "metadata", "labels"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "batch", Kind: "CronJob"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "batch", Kind: "CronJob"},
|
||||
Path: []string{"spec", "jobTemplate", "spec", "selector", "matchLabels"},
|
||||
CreateIfNotPresent: false,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "batch", Kind: "CronJob"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "batch", Kind: "CronJob"},
|
||||
Path: []string{"spec", "jobTemplate", "spec", "template", "metadata", "labels"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "policy", Kind: "PodDisruptionBudget"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "policy", Kind: "PodDisruptionBudget"},
|
||||
Path: []string{"spec", "selector", "matchLabels"},
|
||||
CreateIfNotPresent: false,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "networking.k8s.io", Kind: "NetworkPolicy"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "networking.k8s.io", Kind: "NetworkPolicy"},
|
||||
Path: []string{"spec", "podSelector", "matchLabels"},
|
||||
CreateIfNotPresent: false,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "networking.k8s.io", Kind: "NetworkPolicy"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "networking.k8s.io", Kind: "NetworkPolicy"},
|
||||
Path: []string{"spec", "ingress", "from", "podSelector", "matchLabels"},
|
||||
CreateIfNotPresent: false,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "networking.k8s.io", Kind: "NetworkPolicy"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "networking.k8s.io", Kind: "NetworkPolicy"},
|
||||
Path: []string{"spec", "egress", "to", "podSelector", "matchLabels"},
|
||||
CreateIfNotPresent: false,
|
||||
},
|
||||
@@ -184,42 +184,42 @@ var defaultAnnotationsPathConfigs = []PathConfig{
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Version: "v1", Kind: "ReplicationController"},
|
||||
GroupVersionKind: &gvk.Gvk{Version: "v1", Kind: "ReplicationController"},
|
||||
Path: []string{"spec", "template", "metadata", "annotations"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Kind: "Deployment"},
|
||||
GroupVersionKind: &gvk.Gvk{Kind: "Deployment"},
|
||||
Path: []string{"spec", "template", "metadata", "annotations"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Kind: "ReplicaSet"},
|
||||
GroupVersionKind: &gvk.Gvk{Kind: "ReplicaSet"},
|
||||
Path: []string{"spec", "template", "metadata", "annotations"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Kind: "DaemonSet"},
|
||||
GroupVersionKind: &gvk.Gvk{Kind: "DaemonSet"},
|
||||
Path: []string{"spec", "template", "metadata", "annotations"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "apps", Kind: "StatefulSet"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "apps", Kind: "StatefulSet"},
|
||||
Path: []string{"spec", "template", "metadata", "annotations"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "batch", Kind: "Job"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "batch", Kind: "Job"},
|
||||
Path: []string{"spec", "template", "metadata", "annotations"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "batch", Kind: "CronJob"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "batch", Kind: "CronJob"},
|
||||
Path: []string{"spec", "jobTemplate", "metadata", "annotations"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
{
|
||||
GroupVersionKind: &schema.GroupVersionKind{Group: "batch", Kind: "CronJob"},
|
||||
GroupVersionKind: &gvk.Gvk{Group: "batch", Kind: "CronJob"},
|
||||
Path: []string{"spec", "jobTemplate", "spec", "template", "metadata", "annotations"},
|
||||
CreateIfNotPresent: true,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user