s/master/primary in agnhost guestbook usage

This commit is contained in:
Benjamin Elder 2020-06-22 22:55:32 -07:00
parent 981f6751f8
commit f2b2d44614
9 changed files with 71 additions and 71 deletions

View File

@ -303,15 +303,15 @@ run_pod_tests() {
kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" '' kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" ''
# Command # Command
kubectl create -f test/fixtures/doc-yaml/admin/limitrange/valid-pod.yaml "${kube_flags[@]}" kubectl create -f test/fixtures/doc-yaml/admin/limitrange/valid-pod.yaml "${kube_flags[@]}"
kubectl create -f test/e2e/testing-manifests/kubectl/agnhost-master-pod.yaml "${kube_flags[@]}" kubectl create -f test/e2e/testing-manifests/kubectl/agnhost-primary-pod.yaml "${kube_flags[@]}"
# Post-condition: valid-pod and agnhost-master PODs are created # Post-condition: valid-pod and agnhost-primary PODs are created
kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" 'agnhost-master:valid-pod:' kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" 'agnhost-primary:valid-pod:'
### Delete multiple PODs at once ### Delete multiple PODs at once
# Pre-condition: valid-pod and agnhost-master PODs exist # Pre-condition: valid-pod and agnhost-primary PODs exist
kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" 'agnhost-master:valid-pod:' kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" 'agnhost-primary:valid-pod:'
# Command # Command
kubectl delete pods valid-pod agnhost-master "${kube_flags[@]}" --grace-period=0 --force # delete multiple pods at once kubectl delete pods valid-pod agnhost-primary "${kube_flags[@]}" --grace-period=0 --force # delete multiple pods at once
# Post-condition: no POD exists # Post-condition: no POD exists
kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" '' kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" ''

View File

@ -95,8 +95,8 @@ const (
busyboxPodSelector = "app=busybox1" busyboxPodSelector = "app=busybox1"
busyboxPodName = "busybox1" busyboxPodName = "busybox1"
kubeCtlManifestPath = "test/e2e/testing-manifests/kubectl" kubeCtlManifestPath = "test/e2e/testing-manifests/kubectl"
agnhostControllerFilename = "agnhost-master-controller.json.in" agnhostControllerFilename = "agnhost-primary-controller.json.in"
agnhostServiceFilename = "agnhost-master-service.json" agnhostServiceFilename = "agnhost-primary-service.json"
httpdDeployment1Filename = "httpd-deployment1.yaml.in" httpdDeployment1Filename = "httpd-deployment1.yaml.in"
httpdDeployment2Filename = "httpd-deployment2.yaml.in" httpdDeployment2Filename = "httpd-deployment2.yaml.in"
httpdDeployment3Filename = "httpd-deployment3.yaml.in" httpdDeployment3Filename = "httpd-deployment3.yaml.in"
@ -344,10 +344,10 @@ var _ = SIGDescribe("Kubectl client", func() {
guestbookRoot := "test/e2e/testing-manifests/guestbook" guestbookRoot := "test/e2e/testing-manifests/guestbook"
for _, gbAppFile := range []string{ for _, gbAppFile := range []string{
"agnhost-replica-service.yaml", "agnhost-replica-service.yaml",
"agnhost-master-service.yaml", "agnhost-primary-service.yaml",
"frontend-service.yaml", "frontend-service.yaml",
"frontend-deployment.yaml.in", "frontend-deployment.yaml.in",
"agnhost-master-deployment.yaml.in", "agnhost-primary-deployment.yaml.in",
"agnhost-replica-deployment.yaml.in", "agnhost-replica-deployment.yaml.in",
} { } {
contents := commonutils.SubstituteImageName(string(e2etestfiles.ReadOrDie(filepath.Join(guestbookRoot, gbAppFile)))) contents := commonutils.SubstituteImageName(string(e2etestfiles.ReadOrDie(filepath.Join(guestbookRoot, gbAppFile))))
@ -809,13 +809,13 @@ metadata:
framework.RunKubectlOrDieInput(ns, string(serviceJSON[:]), "create", "-f", "-", nsFlag) framework.RunKubectlOrDieInput(ns, string(serviceJSON[:]), "create", "-f", "-", nsFlag)
ginkgo.By("getting the original port") ginkgo.By("getting the original port")
originalNodePort := framework.RunKubectlOrDie(ns, "get", "service", "agnhost-master", nsFlag, "-o", "jsonpath={.spec.ports[0].port}") originalNodePort := framework.RunKubectlOrDie(ns, "get", "service", "agnhost-primary", nsFlag, "-o", "jsonpath={.spec.ports[0].port}")
ginkgo.By("applying the same configuration") ginkgo.By("applying the same configuration")
framework.RunKubectlOrDieInput(ns, string(serviceJSON[:]), "apply", "-f", "-", nsFlag) framework.RunKubectlOrDieInput(ns, string(serviceJSON[:]), "apply", "-f", "-", nsFlag)
ginkgo.By("getting the port after applying configuration") ginkgo.By("getting the port after applying configuration")
currentNodePort := framework.RunKubectlOrDie(ns, "get", "service", "agnhost-master", nsFlag, "-o", "jsonpath={.spec.ports[0].port}") currentNodePort := framework.RunKubectlOrDie(ns, "get", "service", "agnhost-primary", nsFlag, "-o", "jsonpath={.spec.ports[0].port}")
ginkgo.By("checking the result") ginkgo.By("checking the result")
if originalNodePort != currentNodePort { if originalNodePort != currentNodePort {
@ -1099,22 +1099,22 @@ metadata:
framework.RunKubectlOrDieInput(ns, controllerJSON, "create", "-f", "-", nsFlag) framework.RunKubectlOrDieInput(ns, controllerJSON, "create", "-f", "-", nsFlag)
framework.RunKubectlOrDieInput(ns, string(serviceJSON[:]), "create", "-f", "-", nsFlag) framework.RunKubectlOrDieInput(ns, string(serviceJSON[:]), "create", "-f", "-", nsFlag)
ginkgo.By("Waiting for Agnhost master to start.") ginkgo.By("Waiting for Agnhost primary to start.")
waitForOrFailWithDebug(1) waitForOrFailWithDebug(1)
// Pod // Pod
forEachPod(func(pod v1.Pod) { forEachPod(func(pod v1.Pod) {
output := framework.RunKubectlOrDie(ns, "describe", "pod", pod.Name, nsFlag) output := framework.RunKubectlOrDie(ns, "describe", "pod", pod.Name, nsFlag)
requiredStrings := [][]string{ requiredStrings := [][]string{
{"Name:", "agnhost-master-"}, {"Name:", "agnhost-primary-"},
{"Namespace:", ns}, {"Namespace:", ns},
{"Node:"}, {"Node:"},
{"Labels:", "app=agnhost"}, {"Labels:", "app=agnhost"},
{"role=master"}, {"role=primary"},
{"Annotations:"}, {"Annotations:"},
{"Status:", "Running"}, {"Status:", "Running"},
{"IP:"}, {"IP:"},
{"Controlled By:", "ReplicationController/agnhost-master"}, {"Controlled By:", "ReplicationController/agnhost-primary"},
{"Image:", agnhostImage}, {"Image:", agnhostImage},
{"State:", "Running"}, {"State:", "Running"},
{"QoS Class:", "BestEffort"}, {"QoS Class:", "BestEffort"},
@ -1124,28 +1124,28 @@ metadata:
// Rc // Rc
requiredStrings := [][]string{ requiredStrings := [][]string{
{"Name:", "agnhost-master"}, {"Name:", "agnhost-primary"},
{"Namespace:", ns}, {"Namespace:", ns},
{"Selector:", "app=agnhost,role=master"}, {"Selector:", "app=agnhost,role=primary"},
{"Labels:", "app=agnhost"}, {"Labels:", "app=agnhost"},
{"role=master"}, {"role=primary"},
{"Annotations:"}, {"Annotations:"},
{"Replicas:", "1 current", "1 desired"}, {"Replicas:", "1 current", "1 desired"},
{"Pods Status:", "1 Running", "0 Waiting", "0 Succeeded", "0 Failed"}, {"Pods Status:", "1 Running", "0 Waiting", "0 Succeeded", "0 Failed"},
{"Pod Template:"}, {"Pod Template:"},
{"Image:", agnhostImage}, {"Image:", agnhostImage},
{"Events:"}} {"Events:"}}
checkKubectlOutputWithRetry(ns, requiredStrings, "describe", "rc", "agnhost-master", nsFlag) checkKubectlOutputWithRetry(ns, requiredStrings, "describe", "rc", "agnhost-primary", nsFlag)
// Service // Service
output := framework.RunKubectlOrDie(ns, "describe", "service", "agnhost-master", nsFlag) output := framework.RunKubectlOrDie(ns, "describe", "service", "agnhost-primary", nsFlag)
requiredStrings = [][]string{ requiredStrings = [][]string{
{"Name:", "agnhost-master"}, {"Name:", "agnhost-primary"},
{"Namespace:", ns}, {"Namespace:", ns},
{"Labels:", "app=agnhost"}, {"Labels:", "app=agnhost"},
{"role=master"}, {"role=primary"},
{"Annotations:"}, {"Annotations:"},
{"Selector:", "app=agnhost", "role=master"}, {"Selector:", "app=agnhost", "role=primary"},
{"Type:", "ClusterIP"}, {"Type:", "ClusterIP"},
{"IP:"}, {"IP:"},
{"Port:", "<unset>", "6379/TCP"}, {"Port:", "<unset>", "6379/TCP"},
@ -1244,11 +1244,11 @@ metadata:
framework.RunKubectlOrDieInput(ns, controllerJSON, "create", "-f", "-", nsFlag) framework.RunKubectlOrDieInput(ns, controllerJSON, "create", "-f", "-", nsFlag)
// It may take a while for the pods to get registered in some cases, wait to be sure. // It may take a while for the pods to get registered in some cases, wait to be sure.
ginkgo.By("Waiting for Agnhost master to start.") ginkgo.By("Waiting for Agnhost primary to start.")
waitForOrFailWithDebug(1) waitForOrFailWithDebug(1)
forEachPod(func(pod v1.Pod) { forEachPod(func(pod v1.Pod) {
framework.Logf("wait on agnhost-master startup in %v ", ns) framework.Logf("wait on agnhost-primary startup in %v ", ns)
framework.LookForStringInLog(ns, pod.Name, "agnhost-master", "Paused", framework.PodStartTimeout) framework.LookForStringInLog(ns, pod.Name, "agnhost-primary", "Paused", framework.PodStartTimeout)
}) })
validateService := func(name string, servicePort int, timeout time.Duration) { validateService := func(name string, servicePort int, timeout time.Duration) {
err := wait.Poll(framework.Poll, timeout, func() (bool, error) { err := wait.Poll(framework.Poll, timeout, func() (bool, error) {
@ -1299,7 +1299,7 @@ metadata:
} }
ginkgo.By("exposing RC") ginkgo.By("exposing RC")
framework.RunKubectlOrDie(ns, "expose", "rc", "agnhost-master", "--name=rm2", "--port=1234", fmt.Sprintf("--target-port=%d", agnhostPort), nsFlag) framework.RunKubectlOrDie(ns, "expose", "rc", "agnhost-primary", "--name=rm2", "--port=1234", fmt.Sprintf("--target-port=%d", agnhostPort), nsFlag)
e2enetwork.WaitForService(c, ns, "rm2", true, framework.Poll, framework.ServiceStartTimeout) e2enetwork.WaitForService(c, ns, "rm2", true, framework.Poll, framework.ServiceStartTimeout)
validateService("rm2", 1234, framework.ServiceStartTimeout) validateService("rm2", 1234, framework.ServiceStartTimeout)
@ -1481,7 +1481,7 @@ metadata:
nsFlag := fmt.Sprintf("--namespace=%v", ns) nsFlag := fmt.Sprintf("--namespace=%v", ns)
ginkgo.By("creating Agnhost RC") ginkgo.By("creating Agnhost RC")
framework.RunKubectlOrDieInput(ns, controllerJSON, "create", "-f", "-", nsFlag) framework.RunKubectlOrDieInput(ns, controllerJSON, "create", "-f", "-", nsFlag)
ginkgo.By("Waiting for Agnhost master to start.") ginkgo.By("Waiting for Agnhost primary to start.")
waitForOrFailWithDebug(1) waitForOrFailWithDebug(1)
ginkgo.By("patching all pods") ginkgo.By("patching all pods")
forEachPod(func(pod v1.Pod) { forEachPod(func(pod v1.Pod) {
@ -2062,7 +2062,7 @@ func forEachReplicationController(c clientset.Interface, ns, selectorKey, select
} }
func validateReplicationControllerConfiguration(rc v1.ReplicationController) { func validateReplicationControllerConfiguration(rc v1.ReplicationController) {
if rc.Name == "agnhost-master" { if rc.Name == "agnhost-primary" {
if _, ok := rc.Annotations[v1.LastAppliedConfigAnnotation]; !ok { if _, ok := rc.Annotations[v1.LastAppliedConfigAnnotation]; !ok {
framework.Failf("Annotation not found in modified configuration:\n%v\n", rc) framework.Failf("Annotation not found in modified configuration:\n%v\n", rc)
} }

View File

@ -1,23 +1,23 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: agnhost-master name: agnhost-primary
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
app: agnhost app: agnhost
role: master role: primary
tier: backend tier: backend
template: template:
metadata: metadata:
labels: labels:
app: agnhost app: agnhost
role: master role: primary
tier: backend tier: backend
spec: spec:
containers: containers:
- name: master - name: primary
image: {{.AgnhostImage}} image: {{.AgnhostImage}}
args: [ "guestbook", "--http-port", "6379" ] args: [ "guestbook", "--http-port", "6379" ]
resources: resources:

View File

@ -1,10 +1,10 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: agnhost-master name: agnhost-primary
labels: labels:
app: agnhost app: agnhost
role: master role: primary
tier: backend tier: backend
spec: spec:
ports: ports:
@ -12,5 +12,5 @@ spec:
targetPort: 6379 targetPort: 6379
selector: selector:
app: agnhost app: agnhost
role: master role: primary
tier: backend tier: backend

View File

@ -19,7 +19,7 @@ spec:
containers: containers:
- name: replica - name: replica
image: {{.AgnhostImage}} image: {{.AgnhostImage}}
args: [ "guestbook", "--replicaof", "agnhost-master", "--http-port", "6379" ] args: [ "guestbook", "--replicaof", "agnhost-primary", "--http-port", "6379" ]
resources: resources:
requests: requests:
cpu: 100m cpu: 100m

View File

@ -1,23 +0,0 @@
{
"kind":"Service",
"apiVersion":"v1",
"metadata":{
"name":"agnhost-master",
"labels":{
"app":"agnhost",
"role":"master"
}
},
"spec":{
"ports": [
{
"port":6379,
"targetPort":"agnhost-server"
}
],
"selector":{
"app":"agnhost",
"role":"master"
}
}
}

View File

@ -2,29 +2,29 @@
"kind":"ReplicationController", "kind":"ReplicationController",
"apiVersion":"v1", "apiVersion":"v1",
"metadata":{ "metadata":{
"name":"agnhost-master", "name":"agnhost-primary",
"labels":{ "labels":{
"app":"agnhost", "app":"agnhost",
"role":"master" "role":"primary"
} }
}, },
"spec":{ "spec":{
"replicas":1, "replicas":1,
"selector":{ "selector":{
"app":"agnhost", "app":"agnhost",
"role":"master" "role":"primary"
}, },
"template":{ "template":{
"metadata":{ "metadata":{
"labels":{ "labels":{
"app":"agnhost", "app":"agnhost",
"role":"master" "role":"primary"
} }
}, },
"spec":{ "spec":{
"containers":[ "containers":[
{ {
"name":"agnhost-master", "name":"agnhost-primary",
"image": "{{.AgnhostImage}}", "image": "{{.AgnhostImage}}",
"ports":[ "ports":[
{ {

View File

@ -3,14 +3,14 @@ kind: Pod
metadata: metadata:
labels: labels:
name: agnhost name: agnhost
role: master role: primary
name: agnhost-master name: agnhost-primary
spec: spec:
containers: containers:
- name: master - name: primary
image: gcr.io/kubernetes-e2e-test-images/agnhost:1.0 image: gcr.io/kubernetes-e2e-test-images/agnhost:1.0
env: env:
- name: MASTER - name: PRIMARY
value: "true" value: "true"
ports: ports:
- containerPort: 6379 - containerPort: 6379
@ -18,7 +18,7 @@ spec:
limits: limits:
cpu: "0.1" cpu: "0.1"
volumeMounts: volumeMounts:
- mountPath: /agnhost-master-data - mountPath: /agnhost-primary-data
name: data name: data
- name: sentinel - name: sentinel
image: gcr.io/kubernetes-e2e-test-images/agnhost:1.0 image: gcr.io/kubernetes-e2e-test-images/agnhost:1.0

View File

@ -0,0 +1,23 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "agnhost-primary",
"labels": {
"app": "agnhost",
"role": "primary"
}
},
"spec": {
"ports": [
{
"port": 6379,
"targetPort": "agnhost-server"
}
],
"selector": {
"app": "agnhost",
"role": "primary"
}
}
}