mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
kyaml: rename annotations and fix linting
This commit is contained in:
@@ -100,13 +100,13 @@ items:
|
||||
metadata:
|
||||
name: deployment-foo
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/index: 0
|
||||
config.kubernetes.io/index: 0
|
||||
- apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: service-foo
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/index: 1
|
||||
config.kubernetes.io/index: 1
|
||||
functionConfig: {apiVersion: apps/v1, kind: Deployment, metadata: {name: foo}}
|
||||
`, s) {
|
||||
t.FailNow()
|
||||
@@ -131,14 +131,14 @@ kind: StatefulSet
|
||||
metadata:
|
||||
name: deployment-foo
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/index: 0
|
||||
config.kubernetes.io/index: 0
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: service-foo
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/index: 1
|
||||
config.kubernetes.io/index: 1
|
||||
`, b.String())
|
||||
}
|
||||
|
||||
@@ -182,13 +182,13 @@ items:
|
||||
metadata:
|
||||
name: deployment-foo
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/index: 0
|
||||
config.kubernetes.io/index: 0
|
||||
- apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: service-foo
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/index: 1
|
||||
config.kubernetes.io/index: 1
|
||||
functionConfig: {apiversion: apps/v1, kind: Deployment, metadata: {name: foo}}
|
||||
`, s) {
|
||||
t.FailNow()
|
||||
@@ -213,14 +213,14 @@ kind: Deployment
|
||||
metadata:
|
||||
name: deployment-foo
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/index: 0
|
||||
config.kubernetes.io/index: 0
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: service-foo
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/index: 1
|
||||
config.kubernetes.io/index: 1
|
||||
`, b.String())
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@ func (t *KFilter) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
if err := unmarshal(meta); err != nil {
|
||||
return err
|
||||
}
|
||||
if filter, found := Filters[meta.Kind]; !found {
|
||||
filter, found := Filters[meta.Kind]
|
||||
if !found {
|
||||
var knownFilters []string
|
||||
for k := range Filters {
|
||||
knownFilters = append(knownFilters, k)
|
||||
@@ -49,9 +50,9 @@ func (t *KFilter) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
sort.Strings(knownFilters)
|
||||
return fmt.Errorf("unsupported filter Kind %v: may be one of: [%s]",
|
||||
meta, strings.Join(knownFilters, ","))
|
||||
} else {
|
||||
t.Filter = filter()
|
||||
}
|
||||
t.Filter = filter()
|
||||
|
||||
return unmarshal(t.Filter)
|
||||
}
|
||||
|
||||
|
||||
@@ -53,21 +53,21 @@ metadata:
|
||||
name: foo1
|
||||
namespace: bar
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/path: foo1_deployment.yaml
|
||||
config.kubernetes.io/path: foo1_deployment.yaml
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: foo1
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/path: foo1_service.yaml
|
||||
config.kubernetes.io/path: foo1_service.yaml
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: foo2
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/path: foo2_deployment.yaml
|
||||
config.kubernetes.io/path: foo2_deployment.yaml
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
@@ -75,7 +75,7 @@ metadata:
|
||||
name: foo2
|
||||
namespace: bar
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/path: foo2_service.yaml
|
||||
config.kubernetes.io/path: foo2_service.yaml
|
||||
`, out.String())
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ kind: Service
|
||||
metadata:
|
||||
name: foo1
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/path: foo1__service.yaml
|
||||
config.kubernetes.io/path: foo1__service.yaml
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
@@ -105,14 +105,14 @@ metadata:
|
||||
name: foo1
|
||||
namespace: bar
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/path: foo1_bar_deployment.yaml
|
||||
config.kubernetes.io/path: foo1_bar_deployment.yaml
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: foo2
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/path: foo2__deployment.yaml
|
||||
config.kubernetes.io/path: foo2__deployment.yaml
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
@@ -120,7 +120,7 @@ metadata:
|
||||
name: foo2
|
||||
namespace: bar
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/path: foo2_bar_service.yaml
|
||||
config.kubernetes.io/path: foo2_bar_service.yaml
|
||||
`, out.String())
|
||||
}
|
||||
|
||||
@@ -143,14 +143,14 @@ metadata:
|
||||
name: foo1
|
||||
namespace: bar
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/path: resource.yaml
|
||||
config.kubernetes.io/path: resource.yaml
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: foo2
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/path: resource.yaml
|
||||
config.kubernetes.io/path: resource.yaml
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
@@ -158,13 +158,13 @@ metadata:
|
||||
name: foo2
|
||||
namespace: bar
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/path: resource.yaml
|
||||
config.kubernetes.io/path: resource.yaml
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: foo1
|
||||
annotations:
|
||||
kyaml.kustomize.dev/kio/path: resource.yaml
|
||||
config.kubernetes.io/path: resource.yaml
|
||||
`, out.String())
|
||||
}
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
// Copyright 2019 Google LLC
|
||||
//
|
||||
// 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.
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package filters
|
||||
|
||||
|
||||
Reference in New Issue
Block a user