mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
s/master/primary in agnhost guestbook test references & agnhost code
to do in follow-up: update the agnhost deployments and references to those when the new image is pushed
This commit is contained in:
parent
d65a3b15bf
commit
279ce5d89e
12
test/conformance/testdata/conformance.yaml
vendored
12
test/conformance/testdata/conformance.yaml
vendored
@ -1355,8 +1355,8 @@
|
||||
- testname: Kubectl, guestbook application
|
||||
codename: '[sig-cli] Kubectl client Guestbook application should create and stop
|
||||
a working application [Conformance]'
|
||||
description: Create Guestbook application that contains an agnhost master server,
|
||||
2 agnhost replicas, frontend application, frontend service and agnhost master
|
||||
description: Create Guestbook application that contains an agnhost primary server,
|
||||
2 agnhost replicas, frontend application, frontend service and agnhost primary
|
||||
service and agnhost replica service. Using frontend service, the test will write
|
||||
an entry into the guestbook application which will store the entry into the backend
|
||||
agnhost store. Application flow MUST work as expected and the data written MUST
|
||||
@ -1397,11 +1397,11 @@
|
||||
- testname: Kubectl, create service, replication controller
|
||||
codename: '[sig-cli] Kubectl client Kubectl expose should create services for rc [Conformance]'
|
||||
description: Create a Pod running agnhost listening to port 6379. Using kubectl
|
||||
expose the agnhost master replication controllers at port 1234. Validate that
|
||||
expose the agnhost primary replication controllers at port 1234. Validate that
|
||||
the replication controller is listening on port 1234 and the target port is set
|
||||
to 6379, port that agnhost master is listening. Using kubectl expose the agnhost
|
||||
master as a service at port 2345. The service MUST be listening on port 2345 and
|
||||
the target port is set to 6379, port that agnhost master is listening.
|
||||
to 6379, port that agnhost primary is listening. Using kubectl expose the agnhost
|
||||
primary as a service at port 2345. The service MUST be listening on port 2345
|
||||
and the target port is set to 6379, port that agnhost primary is listening.
|
||||
release: v1.9
|
||||
file: test/e2e/kubectl/kubectl.go
|
||||
- testname: Kubectl, label update
|
||||
|
@ -358,7 +358,7 @@ var _ = SIGDescribe("Kubectl client", func() {
|
||||
/*
|
||||
Release : v1.9
|
||||
Testname: Kubectl, guestbook application
|
||||
Description: Create Guestbook application that contains an agnhost master server, 2 agnhost replicas, frontend application, frontend service and agnhost master service and agnhost replica service. Using frontend service, the test will write an entry into the guestbook application which will store the entry into the backend agnhost store. Application flow MUST work as expected and the data written MUST be available to read.
|
||||
Description: Create Guestbook application that contains an agnhost primary server, 2 agnhost replicas, frontend application, frontend service and agnhost primary service and agnhost replica service. Using frontend service, the test will write an entry into the guestbook application which will store the entry into the backend agnhost store. Application flow MUST work as expected and the data written MUST be available to read.
|
||||
*/
|
||||
framework.ConformanceIt("should create and stop a working application ", func() {
|
||||
defer forEachGBFile(func(contents string) {
|
||||
@ -1230,7 +1230,7 @@ metadata:
|
||||
/*
|
||||
Release : v1.9
|
||||
Testname: Kubectl, create service, replication controller
|
||||
Description: Create a Pod running agnhost listening to port 6379. Using kubectl expose the agnhost master replication controllers at port 1234. Validate that the replication controller is listening on port 1234 and the target port is set to 6379, port that agnhost master is listening. Using kubectl expose the agnhost master as a service at port 2345. The service MUST be listening on port 2345 and the target port is set to 6379, port that agnhost master is listening.
|
||||
Description: Create a Pod running agnhost listening to port 6379. Using kubectl expose the agnhost primary replication controllers at port 1234. Validate that the replication controller is listening on port 1234 and the target port is set to 6379, port that agnhost primary is listening. Using kubectl expose the agnhost primary as a service at port 2345. The service MUST be listening on port 2345 and the target port is set to 6379, port that agnhost primary is listening.
|
||||
*/
|
||||
framework.ConformanceIt("should create services for rc ", func() {
|
||||
controllerJSON := commonutils.SubstituteImageName(string(readTestFileOrDie(agnhostControllerFilename)))
|
||||
|
@ -194,13 +194,13 @@ Usage:
|
||||
Starts a HTTP server on the given `--http-port` (default: 80), serving various endpoints representing a
|
||||
guestbook app. The endpoints and their purpose are:
|
||||
|
||||
- `/register`: A guestbook replica will subscribe to a master, to its given `--replicaof` endpoint. The master
|
||||
- `/register`: A guestbook replica will subscribe to a primary, to its given `--replicaof` endpoint. The primary
|
||||
will then push any updates it receives to its registered replicas through the `--backend-port` (default: 6379).
|
||||
- `/get`: Returns `{"data": value}`, where the `value` is the stored value for the given `key` if non-empty,
|
||||
or the entire store.
|
||||
- `/set`: Will set the given key-value pair in its own store and propagate it to its replicas, if any.
|
||||
Will return `{"data": "Updated"}` to the caller on success.
|
||||
- `/guestbook`: Will proxy the request to `agnhost-master` if the given `cmd` is `set`, or `agnhost-replica`
|
||||
- `/guestbook`: Will proxy the request to `agnhost-primary` if the given `cmd` is `set`, or `agnhost-replica`
|
||||
if the given `cmd` is `get`.
|
||||
|
||||
Usage:
|
||||
@ -211,12 +211,12 @@ sed_expr="s|{{.AgnhostImage}}|us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnho
|
||||
|
||||
# create the services.
|
||||
kubectl create -f ${guestbook}/frontend-service.yaml
|
||||
kubectl create -f ${guestbook}/agnhost-master-service.yaml
|
||||
kubectl create -f ${guestbook}/agnhost-primary-service.yaml
|
||||
kubectl create -f ${guestbook}/agnhost-replica-service.yaml
|
||||
|
||||
# create the deployments.
|
||||
cat ${guestbook}/frontend-deployment.yaml.in | sed ${sed_expr} | kubectl create -f -
|
||||
cat ${guestbook}/agnhost-master-deployment.yaml.in | sed ${sed_expr} | kubectl create -f -
|
||||
cat ${guestbook}/agnhost-primary-deployment.yaml.in | sed ${sed_expr} | kubectl create -f -
|
||||
cat ${guestbook}/agnhost-replica-deployment.yaml.in | sed ${sed_expr} | kubectl create -f -
|
||||
```
|
||||
|
||||
|
@ -1 +1 @@
|
||||
2.19
|
||||
2.20
|
||||
|
@ -49,7 +49,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
rootCmd := &cobra.Command{Use: "app", Version: "2.19"}
|
||||
rootCmd := &cobra.Command{Use: "app", Version: "2.20"}
|
||||
|
||||
rootCmd.AddCommand(auditproxy.CmdAuditProxy)
|
||||
rootCmd.AddCommand(connect.CmdConnect)
|
||||
|
@ -38,10 +38,10 @@ var CmdGuestbook = &cobra.Command{
|
||||
Short: "Creates a HTTP server with various endpoints representing a guestbook app",
|
||||
Long: `Starts a HTTP server on the given --http-port (default: 80), serving various endpoints representing a guestbook app. The endpoints and their purpose are:
|
||||
|
||||
- /register: A guestbook replica will subscribe to a master, to its given --replicaof endpoint. The master will then push any updates it receives to its registered replicas through the --backend-port.
|
||||
- /register: A guestbook replica will subscribe to a primary, to its given --replicaof endpoint. The primary will then push any updates it receives to its registered replicas through the --backend-port.
|
||||
- /get: Returns '{"data": value}', where the value is the stored value for the given key if non-empty, or the entire store.
|
||||
- /set: Will set the given key-value pair in its own store and propagate it to its replicas, if any. Will return '{"data": "Updated"}' to the caller on success.
|
||||
- /guestbook: Will proxy the request to agnhost-master if the given cmd is 'set', or agnhost-replica if the given cmd is 'get'.`,
|
||||
- /guestbook: Will proxy the request to agnhost-primary if the given cmd is 'set', or agnhost-replica if the given cmd is 'get'.`,
|
||||
Args: cobra.MaximumNArgs(0),
|
||||
Run: main,
|
||||
}
|
||||
@ -88,7 +88,7 @@ func registerNode(registerTo, port string) {
|
||||
}
|
||||
|
||||
request := fmt.Sprintf("register?host=%s", host.String())
|
||||
log.Printf("Registering to master: %s/%s", hostPort, request)
|
||||
log.Printf("Registering to primary: %s/%s", hostPort, request)
|
||||
_, err = net.ResolveTCPAddr("tcp", hostPort)
|
||||
if err != nil {
|
||||
log.Printf("unable to resolve %s, --replicaof param and/or --backend-port param are invalid: %v. Retrying in %s.", hostPort, err, sleep)
|
||||
@ -98,7 +98,7 @@ func registerNode(registerTo, port string) {
|
||||
|
||||
response, err := dialHTTP(request, hostPort)
|
||||
if err != nil {
|
||||
log.Printf("encountered error while registering to master: %v. Retrying in %s.", err, sleep)
|
||||
log.Printf("encountered error while registering to primary: %v. Retrying in %s.", err, sleep)
|
||||
time.Sleep(sleep)
|
||||
continue
|
||||
}
|
||||
@ -106,7 +106,7 @@ func registerNode(registerTo, port string) {
|
||||
responseJSON := make(map[string]interface{})
|
||||
err = json.Unmarshal([]byte(response), &responseJSON)
|
||||
if err != nil {
|
||||
log.Fatalf("Error while unmarshaling master's response: %v", err)
|
||||
log.Fatalf("Error while unmarshaling primary's response: %v", err)
|
||||
}
|
||||
|
||||
var ok bool
|
||||
@ -118,7 +118,7 @@ func registerNode(registerTo, port string) {
|
||||
return
|
||||
}
|
||||
|
||||
log.Fatal("Timed out while registering to master.")
|
||||
log.Fatal("Timed out while registering to primary.")
|
||||
}
|
||||
|
||||
func startHTTPServer(port string) {
|
||||
@ -226,7 +226,7 @@ func setHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// guestbookHandler will proxy the request to agnhost-master if the given cmd is
|
||||
// guestbookHandler will proxy the request to agnhost-primary if the given cmd is
|
||||
// 'set' or agnhost-replica if the given cmd is 'get'.
|
||||
func guestbookHandler(w http.ResponseWriter, r *http.Request) {
|
||||
values, err := url.Parse(r.URL.RequestURI())
|
||||
@ -250,7 +250,7 @@ func guestbookHandler(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
host := "agnhost-master"
|
||||
host := "agnhost-primary"
|
||||
if cmd == "get" {
|
||||
host = "agnhost-replica"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user