mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-14 02:20:53 +00:00
Add ObjectMeta type.
This commit is contained in:
@@ -1,18 +1,5 @@
|
|||||||
/*
|
// Copyright 2019 The Kubernetes Authors.
|
||||||
Copyright 2017 The Kubernetes Authors.
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Package types holds struct definitions that should find a better home.
|
// Package types holds struct definitions that should find a better home.
|
||||||
package types
|
package types
|
||||||
@@ -29,13 +16,18 @@ const (
|
|||||||
KustomizationKind = "Kustomization"
|
KustomizationKind = "Kustomization"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TypeMeta copies apimachinery/pkg/apis/meta/v1.TypeMeta
|
// TypeMeta partially copies apimachinery/pkg/apis/meta/v1.TypeMeta
|
||||||
|
// No need for a direct dependence; the fields are stable.
|
||||||
type TypeMeta struct {
|
type TypeMeta struct {
|
||||||
// Kind copies apimachinery/pkg/apis/meta/v1.Typemeta.Kind
|
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
|
||||||
Kind string `json:"kind,omitempty" protobuf:"bytes,1,opt,name=kind"`
|
APIVersion string `json:"apiVersion,omitempty" yaml:"apiversion,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// APIVersion copies apimachinery/pkg/apis/meta/v1.Typemeta.APIVersion
|
// ObjectMeta partially copies apimachinery/pkg/apis/meta/v1.ObjectMeta
|
||||||
APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,2,opt,name=apiVersion"`
|
// No need for a direct dependence; the fields are stable.
|
||||||
|
type ObjectMeta struct {
|
||||||
|
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||||
|
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kustomization holds the information needed to generate customized k8s api resources.
|
// Kustomization holds the information needed to generate customized k8s api resources.
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
"sigs.k8s.io/kustomize/v3/pkg/resmap"
|
"sigs.k8s.io/kustomize/v3/pkg/resmap"
|
||||||
"sigs.k8s.io/kustomize/v3/pkg/transformers"
|
"sigs.k8s.io/kustomize/v3/pkg/transformers"
|
||||||
"sigs.k8s.io/kustomize/v3/pkg/transformers/config"
|
"sigs.k8s.io/kustomize/v3/pkg/transformers/config"
|
||||||
|
"sigs.k8s.io/kustomize/v3/pkg/types"
|
||||||
"sigs.k8s.io/kustomize/v3/plugin/builtin"
|
"sigs.k8s.io/kustomize/v3/plugin/builtin"
|
||||||
"sigs.k8s.io/yaml"
|
"sigs.k8s.io/yaml"
|
||||||
)
|
)
|
||||||
@@ -16,12 +17,8 @@ import (
|
|||||||
// Add a string prefix to the name.
|
// Add a string prefix to the name.
|
||||||
// A plugin that adapts another plugin.
|
// A plugin that adapts another plugin.
|
||||||
type plugin struct {
|
type plugin struct {
|
||||||
Metadata metaData `json:"metadata,omitempty" yaml:"metadata,omitempty"`
|
types.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||||
t transformers.Transformer
|
t transformers.Transformer
|
||||||
}
|
|
||||||
|
|
||||||
type metaData struct {
|
|
||||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint: golint
|
//nolint: golint
|
||||||
@@ -47,7 +44,7 @@ func (p *plugin) Config(
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
c, err = p.makePrefixSuffixPluginConfig(p.Metadata.Name)
|
c, err = p.makePrefixSuffixPluginConfig(p.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user