mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
s/master/primary in agnhost guestbook usage
This commit is contained in:
parent
981f6751f8
commit
f2b2d44614
@ -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}}" ''
|
||||
|
||||
|
@ -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"
|
||||
@ -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))))
|
||||
@ -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 {
|
||||
@ -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"},
|
||||
@ -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"},
|
||||
@ -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) {
|
||||
@ -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)
|
||||
|
||||
@ -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) {
|
||||
@ -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)
|
||||
}
|
||||
|
@ -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:
|
@ -1,10 +1,10 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: agnhost-master
|
||||
name: agnhost-primary
|
||||
labels:
|
||||
app: agnhost
|
||||
role: master
|
||||
role: primary
|
||||
tier: backend
|
||||
spec:
|
||||
ports:
|
||||
@ -12,5 +12,5 @@ spec:
|
||||
targetPort: 6379
|
||||
selector:
|
||||
app: agnhost
|
||||
role: master
|
||||
role: primary
|
||||
tier: backend
|
@ -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
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
@ -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":[
|
||||
{
|
@ -3,14 +3,14 @@ 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
|
||||
@ -18,7 +18,7 @@ spec:
|
||||
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
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user