Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s/master/primary in agnhost guestbook usage #92404

Merged
merged 2 commits into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions test/cmd/core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -303,15 +303,15 @@ run_pod_tests() {
kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" ''
# Command
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[@]}"
# Post-condition: valid-pod and agnhost-master PODs are created
kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" 'agnhost-master:valid-pod:'
kubectl create -f test/e2e/testing-manifests/kubectl/agnhost-primary-pod.yaml "${kube_flags[@]}"
# Post-condition: valid-pod and agnhost-primary PODs are created
kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" 'agnhost-primary:valid-pod:'

### Delete multiple PODs at once
# Pre-condition: valid-pod and agnhost-master PODs exist
kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" 'agnhost-master:valid-pod:'
# Pre-condition: valid-pod and agnhost-primary PODs exist
kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" 'agnhost-primary:valid-pod:'
# 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
kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" ''

Expand Down
48 changes: 24 additions & 24 deletions test/e2e/kubectl/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ const (
busyboxPodSelector = "app=busybox1"
busyboxPodName = "busybox1"
kubeCtlManifestPath = "test/e2e/testing-manifests/kubectl"
agnhostControllerFilename = "agnhost-master-controller.json.in"
agnhostServiceFilename = "agnhost-master-service.json"
agnhostControllerFilename = "agnhost-primary-controller.json.in"
agnhostServiceFilename = "agnhost-primary-service.json"
httpdDeployment1Filename = "httpd-deployment1.yaml.in"
httpdDeployment2Filename = "httpd-deployment2.yaml.in"
httpdDeployment3Filename = "httpd-deployment3.yaml.in"
Expand Down Expand Up @@ -344,10 +344,10 @@ var _ = SIGDescribe("Kubectl client", func() {
guestbookRoot := "test/e2e/testing-manifests/guestbook"
for _, gbAppFile := range []string{
"agnhost-replica-service.yaml",
"agnhost-master-service.yaml",
"agnhost-primary-service.yaml",
"frontend-service.yaml",
"frontend-deployment.yaml.in",
"agnhost-master-deployment.yaml.in",
"agnhost-primary-deployment.yaml.in",
"agnhost-replica-deployment.yaml.in",
} {
contents := commonutils.SubstituteImageName(string(e2etestfiles.ReadOrDie(filepath.Join(guestbookRoot, gbAppFile))))
Expand Down Expand Up @@ -809,13 +809,13 @@ metadata:
framework.RunKubectlOrDieInput(ns, string(serviceJSON[:]), "create", "-f", "-", nsFlag)

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")
framework.RunKubectlOrDieInput(ns, string(serviceJSON[:]), "apply", "-f", "-", nsFlag)

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")
if originalNodePort != currentNodePort {
Expand Down Expand Up @@ -1099,22 +1099,22 @@ metadata:
framework.RunKubectlOrDieInput(ns, controllerJSON, "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)

// Pod
forEachPod(func(pod v1.Pod) {
output := framework.RunKubectlOrDie(ns, "describe", "pod", pod.Name, nsFlag)
requiredStrings := [][]string{
{"Name:", "agnhost-master-"},
{"Name:", "agnhost-primary-"},
{"Namespace:", ns},
{"Node:"},
{"Labels:", "app=agnhost"},
{"role=master"},
{"role=primary"},
{"Annotations:"},
{"Status:", "Running"},
{"IP:"},
{"Controlled By:", "ReplicationController/agnhost-master"},
{"Controlled By:", "ReplicationController/agnhost-primary"},
{"Image:", agnhostImage},
{"State:", "Running"},
{"QoS Class:", "BestEffort"},
Expand All @@ -1124,28 +1124,28 @@ metadata:

// Rc
requiredStrings := [][]string{
{"Name:", "agnhost-master"},
{"Name:", "agnhost-primary"},
{"Namespace:", ns},
{"Selector:", "app=agnhost,role=master"},
{"Selector:", "app=agnhost,role=primary"},
{"Labels:", "app=agnhost"},
{"role=master"},
{"role=primary"},
{"Annotations:"},
{"Replicas:", "1 current", "1 desired"},
{"Pods Status:", "1 Running", "0 Waiting", "0 Succeeded", "0 Failed"},
{"Pod Template:"},
{"Image:", agnhostImage},
{"Events:"}}
checkKubectlOutputWithRetry(ns, requiredStrings, "describe", "rc", "agnhost-master", nsFlag)
checkKubectlOutputWithRetry(ns, requiredStrings, "describe", "rc", "agnhost-primary", nsFlag)

// Service
output := framework.RunKubectlOrDie(ns, "describe", "service", "agnhost-master", nsFlag)
output := framework.RunKubectlOrDie(ns, "describe", "service", "agnhost-primary", nsFlag)
requiredStrings = [][]string{
{"Name:", "agnhost-master"},
{"Name:", "agnhost-primary"},
{"Namespace:", ns},
{"Labels:", "app=agnhost"},
{"role=master"},
{"role=primary"},
{"Annotations:"},
{"Selector:", "app=agnhost", "role=master"},
{"Selector:", "app=agnhost", "role=primary"},
{"Type:", "ClusterIP"},
{"IP:"},
{"Port:", "<unset>", "6379/TCP"},
Expand Down Expand Up @@ -1244,11 +1244,11 @@ metadata:
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.
ginkgo.By("Waiting for Agnhost master to start.")
ginkgo.By("Waiting for Agnhost primary to start.")
waitForOrFailWithDebug(1)
forEachPod(func(pod v1.Pod) {
framework.Logf("wait on agnhost-master startup in %v ", ns)
framework.LookForStringInLog(ns, pod.Name, "agnhost-master", "Paused", framework.PodStartTimeout)
framework.Logf("wait on agnhost-primary startup in %v ", ns)
framework.LookForStringInLog(ns, pod.Name, "agnhost-primary", "Paused", framework.PodStartTimeout)
})
validateService := func(name string, servicePort int, timeout time.Duration) {
err := wait.Poll(framework.Poll, timeout, func() (bool, error) {
Expand Down Expand Up @@ -1299,7 +1299,7 @@ metadata:
}

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)
validateService("rm2", 1234, framework.ServiceStartTimeout)

Expand Down Expand Up @@ -1481,7 +1481,7 @@ metadata:
nsFlag := fmt.Sprintf("--namespace=%v", ns)
ginkgo.By("creating Agnhost RC")
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)
ginkgo.By("patching all pods")
forEachPod(func(pod v1.Pod) {
Expand Down Expand Up @@ -2062,7 +2062,7 @@ func forEachReplicationController(c clientset.Interface, ns, selectorKey, select
}

func validateReplicationControllerConfiguration(rc v1.ReplicationController) {
if rc.Name == "agnhost-master" {
if rc.Name == "agnhost-primary" {
if _, ok := rc.Annotations[v1.LastAppliedConfigAnnotation]; !ok {
framework.Failf("Annotation not found in modified configuration:\n%v\n", rc)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: agnhost-master
name: agnhost-primary
spec:
replicas: 1
selector:
matchLabels:
app: agnhost
role: master
role: primary
tier: backend
template:
metadata:
labels:
app: agnhost
role: master
role: primary
tier: backend
spec:
containers:
- name: master
- name: primary
image: {{.AgnhostImage}}
args: [ "guestbook", "--http-port", "6379" ]
resources:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: agnhost-master
name: agnhost-primary
labels:
app: agnhost
role: master
role: primary
tier: backend
spec:
ports:
- port: 6379
targetPort: 6379
selector:
app: agnhost
role: master
role: primary
tier: backend
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
containers:
- name: replica
image: {{.AgnhostImage}}
args: [ "guestbook", "--replicaof", "agnhost-master", "--http-port", "6379" ]
args: [ "guestbook", "--replicaof", "agnhost-primary", "--http-port", "6379" ]
resources:
requests:
cpu: 100m
Expand Down
23 changes: 0 additions & 23 deletions test/e2e/testing-manifests/kubectl/agnhost-master-service.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@
"kind":"ReplicationController",
"apiVersion":"v1",
"metadata":{
"name":"agnhost-master",
"name":"agnhost-primary",
"labels":{
"app":"agnhost",
"role":"master"
"role":"primary"
}
},
"spec":{
"replicas":1,
"selector":{
"app":"agnhost",
"role":"master"
"role":"primary"
},
"template":{
"metadata":{
"labels":{
"app":"agnhost",
"role":"master"
"role":"primary"
}
},
"spec":{
"containers":[
{
"name":"agnhost-master",
"name":"agnhost-primary",
"image": "{{.AgnhostImage}}",
"ports":[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ kind: Pod
metadata:
labels:
name: agnhost
role: master
name: agnhost-master
role: primary
name: agnhost-primary
spec:
containers:
- name: master
- name: primary
image: gcr.io/kubernetes-e2e-test-images/agnhost:1.0
env:
- name: MASTER
- name: PRIMARY
value: "true"
ports:
- containerPort: 6379
resources:
limits:
cpu: "0.1"
volumeMounts:
- mountPath: /agnhost-master-data
- mountPath: /agnhost-primary-data
name: data
- name: sentinel
image: gcr.io/kubernetes-e2e-test-images/agnhost:1.0
Expand Down
23 changes: 23 additions & 0 deletions test/e2e/testing-manifests/kubectl/agnhost-primary-service.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
2 changes: 1 addition & 1 deletion test/utils/image/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ const (

func initImageConfigs() map[int]Config {
configs := map[int]Config{}
configs[Agnhost] = Config{promoterE2eRegistry, "agnhost", "2.19"}
configs[Agnhost] = Config{promoterE2eRegistry, "agnhost", "2.20"}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is where we pick up the new image with the service name change

configs[AgnhostPrivate] = Config{PrivateRegistry, "agnhost", "2.6"}
configs[AuthenticatedAlpine] = Config{gcAuthenticatedRegistry, "alpine", "3.7"}
configs[AuthenticatedWindowsNanoServer] = Config{gcAuthenticatedRegistry, "windows-nanoserver", "v1"}
Expand Down