Update test data to reflect code move to staging

Kubernetes-commit: 58b59ae4e07f9d3718271a43740a4de9508d8688
This commit is contained in:
Sean Sullivan 2019-08-01 15:17:53 -07:00 committed by Kubernetes Publisher
parent 1483769081
commit 1cba7858ad
44 changed files with 767 additions and 56 deletions

View File

@ -543,7 +543,7 @@ func TestAnnotateObjectFromFile(t *testing.T) {
cmd := NewCmdAnnotate("kubectl", tf, iostreams)
cmd.SetOutput(bufOut)
options := NewAnnotateOptions(iostreams)
options.Filenames = []string{"../../../../test/e2e/testing-manifests/statefulset/cassandra/controller.yaml"}
options.Filenames = []string{"../../../test/data/controller.yaml"}
args := []string{"a=b", "c-"}
if err := options.Complete(tf, cmd, args); err != nil {
t.Fatalf("unexpected error: %v", err)
@ -574,7 +574,7 @@ func TestAnnotateLocal(t *testing.T) {
cmd := NewCmdAnnotate("kubectl", tf, iostreams)
options := NewAnnotateOptions(iostreams)
options.local = true
options.Filenames = []string{"../../../../test/e2e/testing-manifests/statefulset/cassandra/controller.yaml"}
options.Filenames = []string{"../../../test/data/controller.yaml"}
args := []string{"a=b"}
if err := options.Complete(tf, cmd, args); err != nil {
t.Fatalf("unexpected error: %v", err)

View File

@ -54,7 +54,7 @@ import (
)
var (
fakeSchema = sptest.Fake{Path: filepath.Join("..", "..", "..", "..", "api", "openapi-spec", "swagger.json")}
fakeSchema = sptest.Fake{Path: filepath.Join("..", "..", "..", "test", "data", "openapi", "swagger.json")}
testingOpenAPISchemaFns = []func() (openapi.Resources, error){nil, AlwaysErrorOpenAPISchemaFn, openAPISchemaFn}
AlwaysErrorOpenAPISchemaFn = func() (openapi.Resources, error) {
return nil, errors.New("cannot get openapi spec")
@ -87,23 +87,23 @@ func validateApplyArgs(cmd *cobra.Command, args []string) error {
}
const (
filenameCM = "../../../../test/fixtures/pkg/kubectl/cmd/apply/cm.yaml"
filenameRC = "../../../../test/fixtures/pkg/kubectl/cmd/apply/rc.yaml"
filenameRCArgs = "../../../../test/fixtures/pkg/kubectl/cmd/apply/rc-args.yaml"
filenameRCLastAppliedArgs = "../../../../test/fixtures/pkg/kubectl/cmd/apply/rc-lastapplied-args.yaml"
filenameRCNoAnnotation = "../../../../test/fixtures/pkg/kubectl/cmd/apply/rc-no-annotation.yaml"
filenameRCLASTAPPLIED = "../../../../test/fixtures/pkg/kubectl/cmd/apply/rc-lastapplied.yaml"
filenameSVC = "../../../../test/fixtures/pkg/kubectl/cmd/apply/service.yaml"
filenameRCSVC = "../../../../test/fixtures/pkg/kubectl/cmd/apply/rc-service.yaml"
filenameNoExistRC = "../../../../test/fixtures/pkg/kubectl/cmd/apply/rc-noexist.yaml"
filenameRCPatchTest = "../../../../test/fixtures/pkg/kubectl/cmd/apply/patch.json"
dirName = "../../../../test/fixtures/pkg/kubectl/cmd/apply/testdir"
filenameRCJSON = "../../../../test/fixtures/pkg/kubectl/cmd/apply/rc.json"
filenameCM = "../../../test/data/apply/cm.yaml"
filenameRC = "../../../test/data/apply/rc.yaml"
filenameRCArgs = "../../../test/data/apply/rc-args.yaml"
filenameRCLastAppliedArgs = "../../../test/data/apply/rc-lastapplied-args.yaml"
filenameRCNoAnnotation = "../../../test/data/apply/rc-no-annotation.yaml"
filenameRCLASTAPPLIED = "../../../test/data/apply/rc-lastapplied.yaml"
filenameSVC = "../../../test/data/apply/service.yaml"
filenameRCSVC = "../../../test/data/apply/rc-service.yaml"
filenameNoExistRC = "../../../test/data/apply/rc-noexist.yaml"
filenameRCPatchTest = "../../../test/data/apply/patch.json"
dirName = "../../../test/data/apply/testdir"
filenameRCJSON = "../../../test/data/apply/rc.json"
filenameWidgetClientside = "../../../../test/fixtures/pkg/kubectl/cmd/apply/widget-clientside.yaml"
filenameWidgetServerside = "../../../../test/fixtures/pkg/kubectl/cmd/apply/widget-serverside.yaml"
filenameDeployObjServerside = "../../../../test/fixtures/pkg/kubectl/cmd/apply/deploy-serverside.yaml"
filenameDeployObjClientside = "../../../../test/fixtures/pkg/kubectl/cmd/apply/deploy-clientside.yaml"
filenameWidgetClientside = "../../../test/data/apply/widget-clientside.yaml"
filenameWidgetServerside = "../../../test/data/apply/widget-serverside.yaml"
filenameDeployObjServerside = "../../../test/data/apply/deploy-serverside.yaml"
filenameDeployObjClientside = "../../../test/data/apply/deploy-clientside.yaml"
)
func readConfigMapList(t *testing.T, filename string) [][]byte {

View File

@ -67,7 +67,7 @@ func TestCreateObject(t *testing.T) {
ioStreams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdCreate(tf, ioStreams)
cmd.Flags().Set("filename", "../../../../test/e2e/testing-manifests/guestbook/legacy/redis-master-controller.yaml")
cmd.Flags().Set("filename", "../../../test/data/redis-master-controller.yaml")
cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{})
@ -104,8 +104,8 @@ func TestCreateMultipleObject(t *testing.T) {
ioStreams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdCreate(tf, ioStreams)
cmd.Flags().Set("filename", "../../../../test/e2e/testing-manifests/guestbook/legacy/redis-master-controller.yaml")
cmd.Flags().Set("filename", "../../../../test/e2e/testing-manifests/guestbook/frontend-service.yaml")
cmd.Flags().Set("filename", "../../../test/data/redis-master-controller.yaml")
cmd.Flags().Set("filename", "../../../test/data/frontend-service.yaml")
cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{})
@ -141,7 +141,7 @@ func TestCreateDirectory(t *testing.T) {
ioStreams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdCreate(tf, ioStreams)
cmd.Flags().Set("filename", "../../../../test/e2e/testing-manifests/guestbook/legacy")
cmd.Flags().Set("filename", "../../../test/data/replace/legacy")
cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{})

View File

@ -38,9 +38,9 @@ import (
func fakecmd() *cobra.Command {
cmd := &cobra.Command{
Use: "delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])",
Use: "delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])",
DisableFlagsInUseLine: true,
Run: func(cmd *cobra.Command, args []string) {},
Run: func(cmd *cobra.Command, args []string) {},
}
return cmd
}
@ -237,7 +237,7 @@ func TestDeleteObject(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdDelete(tf, streams)
cmd.Flags().Set("filename", "../../../../test/e2e/testing-manifests/guestbook/legacy/redis-master-controller.yaml")
cmd.Flags().Set("filename", "../../../test/data/redis-master-controller.yaml")
cmd.Flags().Set("cascade", "false")
cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{})
@ -317,7 +317,7 @@ func TestDeleteObjectNotFound(t *testing.T) {
options := &DeleteOptions{
FilenameOptions: resource.FilenameOptions{
Filenames: []string{"../../../../test/e2e/testing-manifests/guestbook/legacy/redis-master-controller.yaml"},
Filenames: []string{"../../../test/data/redis-master-controller.yaml"},
},
GracePeriod: -1,
Cascade: false,
@ -354,7 +354,7 @@ func TestDeleteObjectIgnoreNotFound(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdDelete(tf, streams)
cmd.Flags().Set("filename", "../../../../test/e2e/testing-manifests/guestbook/legacy/redis-master-controller.yaml")
cmd.Flags().Set("filename", "../../../test/data/redis-master-controller.yaml")
cmd.Flags().Set("cascade", "false")
cmd.Flags().Set("ignore-not-found", "true")
cmd.Flags().Set("output", "name")
@ -482,8 +482,8 @@ func TestDeleteMultipleObject(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdDelete(tf, streams)
cmd.Flags().Set("filename", "../../../../test/e2e/testing-manifests/guestbook/legacy/redis-master-controller.yaml")
cmd.Flags().Set("filename", "../../../../test/e2e/testing-manifests/guestbook/frontend-service.yaml")
cmd.Flags().Set("filename", "../../../test/data/redis-master-controller.yaml")
cmd.Flags().Set("filename", "../../../test/data/frontend-service.yaml")
cmd.Flags().Set("cascade", "false")
cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{})
@ -520,7 +520,7 @@ func TestDeleteMultipleObjectContinueOnMissing(t *testing.T) {
options := &DeleteOptions{
FilenameOptions: resource.FilenameOptions{
Filenames: []string{"../../../../test/e2e/testing-manifests/guestbook/legacy/redis-master-controller.yaml", "../../../../test/e2e/testing-manifests/guestbook/frontend-service.yaml"},
Filenames: []string{"../../../test/data/redis-master-controller.yaml", "../../../test/data/frontend-service.yaml"},
},
GracePeriod: -1,
Cascade: false,
@ -604,7 +604,7 @@ func TestDeleteDirectory(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdDelete(tf, streams)
cmd.Flags().Set("filename", "../../../../test/e2e/testing-manifests/guestbook/legacy")
cmd.Flags().Set("filename", "../../../test/data/replace/legacy")
cmd.Flags().Set("cascade", "false")
cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{})

View File

@ -126,7 +126,7 @@ func TestDescribeObject(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdDescribe("kubectl", tf, streams)
cmd.Flags().Set("filename", "../../../../test/e2e/testing-manifests/guestbook/legacy/redis-master-controller.yaml")
cmd.Flags().Set("filename", "../../../test/data/redis-master-controller.yaml")
cmd.Run(cmd, []string{})
if d.Name != "redis-master" || d.Namespace != "test" {

View File

@ -306,7 +306,7 @@ func TestRunExposeService(t *testing.T) {
Selector: map[string]string{"app": "go"},
},
},
flags: map[string]string{"filename": "../../../../test/e2e/testing-manifests/guestbook/redis-master-service.yaml", "selector": "func=stream", "protocol": "UDP", "port": "14", "name": "foo", "labels": "svc=test", "dry-run": "true"},
flags: map[string]string{"filename": "../../../test/data/redis-master-service.yaml", "selector": "func=stream", "protocol": "UDP", "port": "14", "name": "foo", "labels": "svc=test", "dry-run": "true"},
output: &corev1.Service{
ObjectMeta: metav1.ObjectMeta{Name: "foo", Labels: map[string]string{"svc": "test"}},
Spec: corev1.ServiceSpec{

View File

@ -392,7 +392,7 @@ func TestLabelForResourceFromFile(t *testing.T) {
ioStreams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdLabel(tf, ioStreams)
opts := NewLabelOptions(ioStreams)
opts.Filenames = []string{"../../../../test/e2e/testing-manifests/statefulset/cassandra/controller.yaml"}
opts.Filenames = []string{"../../../test/data/controller.yaml"}
err := opts.Complete(tf, cmd, []string{"a=b"})
if err == nil {
err = opts.Validate()
@ -424,7 +424,7 @@ func TestLabelLocal(t *testing.T) {
ioStreams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdLabel(tf, ioStreams)
opts := NewLabelOptions(ioStreams)
opts.Filenames = []string{"../../../../test/e2e/testing-manifests/statefulset/cassandra/controller.yaml"}
opts.Filenames = []string{"../../../test/data/controller.yaml"}
opts.local = true
err := opts.Complete(tf, cmd, []string{"a=b"})
if err == nil {

View File

@ -95,7 +95,7 @@ func TestPatchObjectFromFile(t *testing.T) {
cmd.Flags().Set("namespace", "test")
cmd.Flags().Set("patch", `{"spec":{"type":"NodePort"}}`)
cmd.Flags().Set("output", "name")
cmd.Flags().Set("filename", "../../../../test/e2e/testing-manifests/guestbook/frontend-service.yaml")
cmd.Flags().Set("filename", "../../../test/data/frontend-service.yaml")
cmd.Run(cmd, []string{})
// uses the name from the response
@ -181,7 +181,7 @@ func TestPatchObjectFromFileOutput(t *testing.T) {
cmd.Flags().Set("namespace", "test")
cmd.Flags().Set("patch", `{"spec":{"type":"NodePort"}}`)
cmd.Flags().Set("output", "yaml")
cmd.Flags().Set("filename", "../../../../test/e2e/testing-manifests/guestbook/frontend-service.yaml")
cmd.Flags().Set("filename", "../../../test/data/frontend-service.yaml")
cmd.Run(cmd, []string{})
t.Log(buf.String())

View File

@ -65,7 +65,7 @@ func TestReplaceObject(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdReplace(tf, streams)
cmd.Flags().Set("filename", "../../../../test/e2e/testing-manifests/guestbook/legacy/redis-master-controller.yaml")
cmd.Flags().Set("filename", "../../../test/data/redis-master-controller.yaml")
cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{})
@ -135,8 +135,8 @@ func TestReplaceMultipleObject(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdReplace(tf, streams)
cmd.Flags().Set("filename", "../../../../test/e2e/testing-manifests/guestbook/legacy/redis-master-controller.yaml")
cmd.Flags().Set("filename", "../../../../test/e2e/testing-manifests/guestbook/frontend-service.yaml")
cmd.Flags().Set("filename", "../../../test/data/redis-master-controller.yaml")
cmd.Flags().Set("filename", "../../../test/data/frontend-service.yaml")
cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{})
@ -192,7 +192,7 @@ func TestReplaceDirectory(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdReplace(tf, streams)
cmd.Flags().Set("filename", "../../../../test/e2e/testing-manifests/guestbook/legacy")
cmd.Flags().Set("filename", "../../../test/data/replace/legacy")
cmd.Flags().Set("namespace", "test")
cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{})
@ -238,7 +238,7 @@ func TestForceReplaceObjectNotFound(t *testing.T) {
streams, _, buf, _ := genericclioptions.NewTestIOStreams()
cmd := NewCmdReplace(tf, streams)
cmd.Flags().Set("filename", "../../../../test/e2e/testing-manifests/guestbook/legacy/redis-master-controller.yaml")
cmd.Flags().Set("filename", "../../../test/data/redis-master-controller.yaml")
cmd.Flags().Set("force", "true")
cmd.Flags().Set("cascade", "false")
cmd.Flags().Set("output", "name")

View File

@ -60,7 +60,7 @@ func TestSetEnvLocal(t *testing.T) {
opts := NewEnvOptions(streams)
opts.PrintFlags = genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme)
opts.FilenameOptions = resource.FilenameOptions{
Filenames: []string{"../../../../test/e2e/testing-manifests/statefulset/cassandra/controller.yaml"},
Filenames: []string{"../../../test/data/controller.yaml"},
}
opts.Local = true
@ -97,7 +97,7 @@ func TestSetEnvLocalNamespace(t *testing.T) {
opts := NewEnvOptions(streams)
opts.PrintFlags = genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme)
opts.FilenameOptions = resource.FilenameOptions{
Filenames: []string{"../../../../test/fixtures/pkg/kubectl/cmd/set/namespaced-resource.yaml"},
Filenames: []string{"../../../test/data/set/namespaced-resource.yaml"},
}
opts.Local = true
@ -134,7 +134,7 @@ func TestSetMultiResourcesEnvLocal(t *testing.T) {
opts := NewEnvOptions(streams)
opts.PrintFlags = genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme)
opts.FilenameOptions = resource.FilenameOptions{
Filenames: []string{"../../../../test/fixtures/pkg/kubectl/cmd/set/multi-resource-yaml.yaml"},
Filenames: []string{"../../../test/data/set/multi-resource-yaml.yaml"},
}
opts.Local = true

View File

@ -67,7 +67,7 @@ func TestImageLocal(t *testing.T) {
opts := SetImageOptions{
PrintFlags: genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme),
FilenameOptions: resource.FilenameOptions{
Filenames: []string{"../../../../test/e2e/testing-manifests/statefulset/cassandra/controller.yaml"}},
Filenames: []string{"../../../test/data/controller.yaml"}},
Local: true,
IOStreams: streams,
}
@ -179,7 +179,7 @@ func TestSetMultiResourcesImageLocal(t *testing.T) {
opts := SetImageOptions{
PrintFlags: genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme),
FilenameOptions: resource.FilenameOptions{
Filenames: []string{"../../../../test/fixtures/pkg/kubectl/cmd/set/multi-resource-yaml.yaml"}},
Filenames: []string{"../../../test/data/set/multi-resource-yaml.yaml"}},
Local: true,
IOStreams: streams,
}

View File

@ -66,7 +66,7 @@ func TestResourcesLocal(t *testing.T) {
opts := SetResourcesOptions{
PrintFlags: genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme),
FilenameOptions: resource.FilenameOptions{
Filenames: []string{"../../../../test/e2e/testing-manifests/statefulset/cassandra/controller.yaml"}},
Filenames: []string{"../../../test/data/controller.yaml"}},
Local: true,
Limits: "cpu=200m,memory=512Mi",
Requests: "cpu=200m,memory=512Mi",
@ -114,7 +114,7 @@ func TestSetMultiResourcesLimitsLocal(t *testing.T) {
opts := SetResourcesOptions{
PrintFlags: genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme),
FilenameOptions: resource.FilenameOptions{
Filenames: []string{"../../../../test/fixtures/pkg/kubectl/cmd/set/multi-resource-yaml.yaml"}},
Filenames: []string{"../../../test/data/set/multi-resource-yaml.yaml"}},
Local: true,
Limits: "cpu=200m,memory=512Mi",
Requests: "cpu=200m,memory=512Mi",

View File

@ -57,11 +57,11 @@ func TestSetServiceAccountLocal(t *testing.T) {
yaml string
apiGroup string
}{
{yaml: "../../../../test/fixtures/doc-yaml/user-guide/replication.yaml", apiGroup: ""},
{yaml: "../../../../test/fixtures/doc-yaml/admin/daemon.yaml", apiGroup: "extensions"},
{yaml: "../../../../test/fixtures/doc-yaml/user-guide/replicaset/redis-slave.yaml", apiGroup: "extensions"},
{yaml: "../../../../test/fixtures/doc-yaml/user-guide/job.yaml", apiGroup: "batch"},
{yaml: "../../../../test/fixtures/doc-yaml/user-guide/deployment.yaml", apiGroup: "extensions"},
{yaml: "../../../test/data/set/replication.yaml", apiGroup: ""},
{yaml: "../../../test/data/set/daemon.yaml", apiGroup: "extensions"},
{yaml: "../../../test/data/set/redis-slave.yaml", apiGroup: "extensions"},
{yaml: "../../../test/data/set/job.yaml", apiGroup: "batch"},
{yaml: "../../../test/data/set/deployment.yaml", apiGroup: "extensions"},
}
for i, input := range inputs {
@ -122,7 +122,7 @@ func TestSetServiceAccountMultiLocal(t *testing.T) {
opts := SetServiceAccountOptions{
PrintFlags: genericclioptions.NewPrintFlags("").WithDefaultOutput(outputFormat).WithTypeSetter(scheme.Scheme),
fileNameOptions: resource.FilenameOptions{
Filenames: []string{"../../../../test/fixtures/pkg/kubectl/cmd/set/multi-resource-yaml.yaml"}},
Filenames: []string{"../../../test/data/set/multi-resource-yaml.yaml"}},
local: true,
IOStreams: streams,
}

16
test/data/apply/cm.yaml Normal file
View File

@ -0,0 +1,16 @@
apiVersion: v1
items:
- kind: ConfigMap
apiVersion: v1
metadata:
name: test0
data:
key1: apple
- kind: ConfigMap
apiVersion: v1
metadata:
name: test1
data:
key2: apple
kind: ConfigMapList
metadata: {}

View File

@ -0,0 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
name: nginx
spec:
selector:
matchLabels:
name: nginx
strategy:
type: Recreate
rollingUpdate: null
template:
metadata:
labels:
name: nginx
spec:
containers:
- name: nginx
image: nginx

View File

@ -0,0 +1,46 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
kubectl.kubernetes.io/last-applied-configuration: '{"kind":"Deployment","apiVersion":"apps/v1","metadata":{"name":"nginx-deployment","creationTimestamp":null,"labels":{"name":"nginx"}},"spec":{"selector":{"matchLabels":{"name":"nginx"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"name":"nginx"}},"spec":{"containers":[{"name":"nginx","image":"nginx","resources":{}}]}},"strategy":{}},"status":{}}'
creationTimestamp: "2016-10-24T22:15:06Z"
generation: 6
labels:
name: nginx
name: nginx-deployment
namespace: test
resourceVersion: "355959"
selfLink: /apis/extensions/v1beta1/namespaces/test/deployments/nginx-deployment
uid: 51ac266e-9a37-11e6-8738-0800270c4edc
spec:
replicas: 1
selector:
matchLabels:
name: nginx
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
name: nginx
spec:
containers:
- image: nginx
imagePullPolicy: Always
name: nginx
resources: {}
terminationMessagePath: /dev/termination-log
dnsPolicy: ClusterFirst
restartPolicy: Always
securityContext: {}
terminationGracePeriodSeconds: 30
status:
availableReplicas: 1
observedGeneration: 6
replicas: 1
updatedReplicas: 1

View File

@ -0,0 +1 @@
{"apiVersion":"v1","kind":"ReplicationController","metadata":{"labels":{"name":"test-rc"},"name":"test-rc","namespace":"test"},"spec":{"replicas":1,"template":{"metadata":{"labels":{"name":"test-rc"}},"spec":{"containers":[{"image":"nginx","name":"test-rc","ports":[{"containerPort":80}]}]}}}}

View File

@ -0,0 +1,20 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: test-rc
labels:
name: test-rc
spec:
replicas: 1
template:
metadata:
labels:
name: test-rc
spec:
containers:
- name: test-rc
image: nginx
args:
- -random_flag=%s@domain.com
ports:
- containerPort: 80

View File

@ -0,0 +1,23 @@
apiVersion: v1
kind: ReplicationController
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"args":"-random_flag=%s@domain.com"}
name: test-rc
labels:
name: test-rc
spec:
replicas: 1
template:
metadata:
labels:
name: test-rc
spec:
containers:
- name: test-rc
image: nginx
args:
- -random_flag=%s@domain.com
ports:
- containerPort: 80

View File

@ -0,0 +1,21 @@
apiVersion: v1
kind: ReplicationController
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"test":1234}
name: test-rc
labels:
name: test-rc
spec:
replicas: 1
template:
metadata:
labels:
name: test-rc
spec:
containers:
- name: test-rc
image: nginx
ports:
- containerPort: 80

View File

@ -0,0 +1,18 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: no-annotation
labels:
name: no-annotation
spec:
replicas: 1
template:
metadata:
labels:
name: no-annotation
spec:
containers:
- name: no-annotation
image: nginx
ports:
- containerPort: 80

View File

@ -0,0 +1,18 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: no-exist
labels:
name: no-exist
spec:
replicas: 1
template:
metadata:
labels:
name: no-exist
spec:
containers:
- name: no-exist
image: nginx
ports:
- containerPort: 80

View File

@ -0,0 +1,32 @@
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: Service
metadata:
name: test-service
labels:
name: test-service
spec:
ports:
- port: 80
selector:
name: test-rc
- apiVersion: v1
kind: ReplicationController
metadata:
name: test-rc
labels:
name: test-rc
spec:
replicas: 1
template:
metadata:
labels:
name: test-rc
spec:
containers:
- name: test-rc
image: nginx
ports:
- containerPort: 80

33
test/data/apply/rc.json Normal file
View File

@ -0,0 +1,33 @@
{
"apiVersion": "v1",
"kind": "ReplicationController",
"metadata": {
"name": "test-rc",
"labels": {
"name": "test-rc"
}
},
"spec": {
"replicas": 1,
"template": {
"metadata": {
"labels": {
"name": "test-rc"
}
},
"spec": {
"containers": [
{
"name": "test-rc",
"image": "nginx",
"ports": [
{
"containerPort": 80
}
]
}
]
}
}
}
}

19
test/data/apply/rc.yaml Normal file
View File

@ -0,0 +1,19 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: test-rc
namespace: test
labels:
name: test-rc
spec:
replicas: 1
template:
metadata:
labels:
name: test-rc
spec:
containers:
- name: test-rc
image: nginx
ports:
- containerPort: 80

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: test-service
labels:
name: test-service
spec:
ports:
- port: 80
selector:
name: test-rc

View File

@ -0,0 +1,18 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: test-rc
labels:
name: test-rc
spec:
replicas: 1
template:
metadata:
labels:
name: test-rc
spec:
containers:
- name: test-rc
image: nginx
ports:
- containerPort: 80

View File

@ -0,0 +1,18 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: test-rc
labels:
name: test-rc
spec:
replicas: 1
template:
metadata:
labels:
name: test-rc
spec:
containers:
- name: test-rc
image: nginx
ports:
- containerPort: 80

View File

@ -0,0 +1,8 @@
apiVersion: "unit-test.test.com/v1"
kind: Widget
metadata:
name: "widget"
namespace: "test"
labels:
foo: bar
key: "value"

View File

@ -0,0 +1,10 @@
apiVersion: "unit-test.test.com/v1"
kind: Widget
metadata:
name: "widget"
namespace: "test"
annotations:
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"unit-test.test.com/v1\",\"key\":\"value\",\"kind\":\"Widget\",\"metadata\":{\"annotations\":{},\"labels\":{\"foo\":\"bar\"},\"name\":\"widget\",\"namespace\":\"test\"}}\n"
labels:
foo: bar
key: "value"

58
test/data/controller.yaml Normal file
View File

@ -0,0 +1,58 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: cassandra
# The labels will be applied automatically
# from the labels in the pod template, if not set
# labels:
# app: cassandra
spec:
replicas: 2
# The selector will be applied automatically
# from the labels in the pod template, if not set.
# selector:
# app: cassandra
template:
metadata:
labels:
app: cassandra
spec:
containers:
- command:
- /run.sh
resources:
limits:
cpu: 0.5
env:
- name: MAX_HEAP_SIZE
value: 512M
- name: HEAP_NEWSIZE
value: 100M
- name: CASSANDRA_SEED_PROVIDER
value: "io.k8s.cassandra.KubernetesSeedProvider"
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
image: gcr.io/google-samples/cassandra:v13
name: cassandra
ports:
- containerPort: 7000
name: intra-node
- containerPort: 7001
name: tls-intra-node
- containerPort: 7199
name: jmx
- containerPort: 9042
name: cql
volumeMounts:
- mountPath: /cassandra_data
name: data
volumes:
- name: data
emptyDir: {}

View File

@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: frontend
labels:
app: guestbook
tier: frontend
spec:
# if your cluster supports it, uncomment the following to automatically create
# an external load-balanced IP for the frontend service.
# type: LoadBalancer
ports:
- port: 80
selector:
app: guestbook
tier: frontend

View File

@ -0,0 +1,26 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: redis-master
labels:
app: redis
role: master
tier: backend
spec:
replicas: 1
template:
metadata:
labels:
app: redis
role: master
tier: backend
spec:
containers:
- name: master
image: docker.io/library/redis:5.0.5-alpine
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379

View File

@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: redis-master
labels:
app: redis
role: master
tier: backend
spec:
ports:
- port: 6379
targetPort: 6379
selector:
app: redis
role: master
tier: backend

View File

@ -0,0 +1,29 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: frontend
spec:
replicas: 3
template:
metadata:
labels:
app: guestbook
tier: frontend
spec:
containers:
- name: php-redis
image: gcr.io/google_samples/gb-frontend:v4
resources:
requests:
cpu: 100m
memory: 100Mi
env:
- name: GET_HOSTS_FROM
value: dns
# If your cluster config does not include a dns service, then to
# instead access environment variables to find service host
# info, comment out the 'value: dns' line above, and uncomment the
# line below:
# value: env
ports:
- containerPort: 80

View File

@ -0,0 +1,26 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: redis-master
labels:
app: redis
role: master
tier: backend
spec:
replicas: 1
template:
metadata:
labels:
app: redis
role: master
tier: backend
spec:
containers:
- name: master
image: docker.io/library/redis:5.0.5-alpine
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379

View File

@ -0,0 +1,37 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: redis-slave
labels:
app: redis
role: slave
tier: backend
spec:
replicas: 2
template:
metadata:
labels:
app: redis
role: slave
tier: backend
spec:
containers:
- name: slave
image: docker.io/library/redis:5.0.5-alpine
# We are only implementing the dns option of:
# https://github.com/kubernetes/examples/blob/97c7ed0eb6555a4b667d2877f965d392e00abc45/guestbook/redis-slave/run.sh
command: [ "redis-server", "--slaveof", "redis-master", "6379" ]
resources:
requests:
cpu: 100m
memory: 100Mi
env:
- name: GET_HOSTS_FROM
value: dns
# If your cluster config does not include a dns service, then to
# instead access an environment variable to find the master
# service's host, comment out the 'value: dns' line above, and
# uncomment the line below:
# value: env
ports:
- containerPort: 6379

21
test/data/set/daemon.yaml Normal file
View File

@ -0,0 +1,21 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: prometheus-node-exporter
spec:
selector:
matchLabels:
daemon: prom-node-exp
template:
metadata:
name: prometheus-node-exporter
labels:
daemon: prom-node-exp
spec:
containers:
- name: c
image: prom/prometheus
ports:
- containerPort: 9090
hostPort: 9090
name: serverport

View File

@ -0,0 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
name: nginx-deployment
spec:
replicas: 3
selector:
matchLabels:
name: nginx
template:
metadata:
labels:
name: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80

15
test/data/set/job.yaml Normal file
View File

@ -0,0 +1,15 @@
apiVersion: batch/v1
kind: Job
metadata:
name: pi
spec:
template:
metadata:
name: pi
spec:
containers:
- name: pi
image: perl
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
restartPolicy: Never

View File

@ -0,0 +1,33 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: first-rc
spec:
replicas: 1
selector:
app: mock
template:
metadata:
labels:
app: mock
spec:
containers:
- name: mock-container
image: k8s.gcr.io/pause:3.1
---
apiVersion: v1
kind: ReplicationController
metadata:
name: second-rc
spec:
replicas: 1
selector:
app: mock
template:
metadata:
labels:
app: mock
spec:
containers:
- name: mock-container
image: k8s.gcr.io/pause:3.1

View File

@ -0,0 +1,17 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: namespaced-rc
namespace: existing-ns
spec:
replicas: 1
selector:
app: mock
template:
metadata:
labels:
app: mock
spec:
containers:
- name: mock-container
image: k8s.gcr.io/pause:3.1

View File

@ -0,0 +1,44 @@
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: redis-slave
labels:
app: redis
role: slave
tier: backend
spec:
# this replicas value is default
# modify it according to your case
replicas: 2
selector:
matchLabels:
app: redis
role: slave
tier: backend
template:
metadata:
labels:
app: redis
role: slave
tier: backend
spec:
containers:
- name: slave
image: docker.io/library/redis:5.0.5-alpine
# We are only implementing the dns option of:
# https://github.com/kubernetes/examples/blob/97c7ed0eb6555a4b667d2877f965d392e00abc45/guestbook/redis-slave/run.sh
command: [ "redis-server", "--slaveof", "redis-master", "6379" ]
resources:
requests:
cpu: 100m
memory: 100Mi
env:
- name: GET_HOSTS_FROM
value: dns
# If your cluster config does not include a dns service, then to
# instead access an environment variable to find the master
# service's host, comment out the 'value: dns' line above, and
# uncomment the line below.
# value: env
ports:
- containerPort: 6379

View File

@ -0,0 +1,19 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: nginx
spec:
replicas: 3
selector:
app: nginx
template:
metadata:
name: nginx
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80