Fix names/doc in transformation config code.

This commit is contained in:
Jeffrey Regan
2018-10-10 17:29:50 -07:00
parent 111f41785f
commit d9f9a51e55
27 changed files with 475 additions and 305 deletions

View File

@@ -16,7 +16,7 @@ limitations under the License.
package defaultconfig
const commonAnnotationPathConfigs = `
const commonAnnotationFieldSpecs = `
commonAnnotations:
- path: metadata/annotations
create: true

View File

@@ -16,7 +16,7 @@ limitations under the License.
package defaultconfig
const commonLabelPathConfigs = `
const commonLabelFieldSpecs = `
commonLabels:
- path: metadata/labels
create: true

View File

@@ -22,27 +22,28 @@ import (
"bytes"
)
// GetDefaultPathConfigs returns the default pathConfigs data
func GetDefaultPathConfigs() []byte {
// GetDefaultFieldSpecs returns default fieldSpecs.
func GetDefaultFieldSpecs() []byte {
configData := [][]byte{
[]byte(namePrefixPathConfigs),
[]byte(commonLabelPathConfigs),
[]byte(commonAnnotationPathConfigs),
[]byte(namespacePathConfigs),
[]byte(varReferencePathConfigs),
[]byte(nameReferencePathConfigs),
[]byte(namePrefixFieldSpecs),
[]byte(commonLabelFieldSpecs),
[]byte(commonAnnotationFieldSpecs),
[]byte(namespaceFieldSpecs),
[]byte(varReferenceFieldSpecs),
[]byte(nameReferenceFieldSpecs),
}
return bytes.Join(configData, []byte("\n"))
}
// GetDefaultPathConfigStrings returns the default pathConfigs in string format
func GetDefaultPathConfigStrings() map[string]string {
// GetDefaultFieldSpecsAsMap returns default fieldSpecs
// as a string->string map.
func GetDefaultFieldSpecsAsMap() map[string]string {
result := make(map[string]string)
result["nameprefix"] = namePrefixPathConfigs
result["commonlabels"] = commonLabelPathConfigs
result["commonannotations"] = commonAnnotationPathConfigs
result["namespace"] = namespacePathConfigs
result["varreference"] = varReferencePathConfigs
result["namereference"] = namespacePathConfigs
result["nameprefix"] = namePrefixFieldSpecs
result["commonlabels"] = commonLabelFieldSpecs
result["commonannotations"] = commonAnnotationFieldSpecs
result["namespace"] = namespaceFieldSpecs
result["varreference"] = varReferenceFieldSpecs
result["namereference"] = nameReferenceFieldSpecs
return result
}

View File

@@ -17,7 +17,7 @@ limitations under the License.
package defaultconfig
const (
namePrefixPathConfigs = `
namePrefixFieldSpecs = `
namePrefix:
- path: metadata/name
`

View File

@@ -17,26 +17,26 @@ limitations under the License.
package defaultconfig
const (
nameReferencePathConfigs = `
nameReferenceFieldSpecs = `
nameReference:
- kind: Deployment
pathConfigs:
fieldSpecs:
- path: spec/scaleTargetRef/name
kind: HorizontalPodAutoscaler
- kind: ReplicationController
pathConfigs:
fieldSpecs:
- path: spec/scaleTargetRef/name
kind: HorizontalPodAutoscaler
- kind: ReplicaSet
pathConfigs:
fieldSpecs:
- path: spec/scaleTargetRef/name
kind: HorizontalPodAutoscaler
- kind: ConfigMap
version: v1
pathConfigs:
fieldSpecs:
- path: spec/volumes/configMap/name
version: v1
kind: Pod
@@ -119,7 +119,7 @@ nameReference:
- kind: Secret
version: v1
pathConfigs:
fieldSpecs:
- path: spec/volumes/secret/secretName
version: v1
kind: Pod
@@ -229,7 +229,7 @@ nameReference:
- kind: Service
version: v1
pathConfigs:
fieldSpecs:
- path: spec/serviceName
kind: StatefulSet
group: apps
@@ -240,14 +240,14 @@ nameReference:
- kind: Role
group: rbac.authorization.k8s.io
pathConfigs:
fieldSpecs:
- path: roleRef/name
kind: RoleBinding
group: rbac.authorization.k8s.io
- kind: ClusterRole
group: rbac.authorization.k8s.io
pathConfigs:
fieldSpecs:
- path: roleRef/name
kind: RoleBinding
group: rbac.authorization.k8s.io
@@ -257,7 +257,7 @@ nameReference:
- kind: ServiceAccount
version: v1
pathConfigs:
fieldSpecs:
- path: subjects/name
kind: RoleBinding
group: rbac.authorization.k8s.io
@@ -281,7 +281,7 @@ nameReference:
- kind: PersistentVolumeClaim
version: v1
pathConfigs:
fieldSpecs:
- path: spec/volumes/persistentVolumeClaim/claimName
kind: Pod
- path: spec/template/spec/volumes/persistentVolumeClaim/claimName
@@ -299,7 +299,7 @@ nameReference:
- kind: PersistentVolume
version: v1
pathConfigs:
fieldSpecs:
- path: spec/volumeName
kind: PersistentVolumeClaim
`

View File

@@ -17,7 +17,7 @@ limitations under the License.
package defaultconfig
const (
namespacePathConfigs = `
namespaceFieldSpecs = `
namespace:
- path: metadata/namespace
create: true

View File

@@ -17,7 +17,7 @@ limitations under the License.
package defaultconfig
const (
varReferencePathConfigs = `
varReferenceFieldSpecs = `
varReference:
- path: spec/template/spec/initContainers/command
kind: StatefulSet