瀏覽代碼

Merge pull request #220 from MohdAhmad/master

Updates docs to include resource limits
Mohammad Ahmad 9 年之前
父節點
當前提交
6a73e3be26
共有 2 個文件被更改,包括 11 次插入7 次删除
  1. 6 2
      README.md
  2. 5 5
      backend/gce/gce.go

+ 6 - 2
README.md

@@ -83,7 +83,9 @@ This is the only mandatory key.
      flannel can automatically detect the id of the route table if the optional `DescribeInstances` is granted to the EC2 instance.
 
   Authentication is handled via either environment variables or the node's IAM role.
-  If the node has insufficient privileges to modify the VPC routing table specified, ensure that appropriate `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and optionally `AWS_SECURITY_TOKEN` environment variables are set when running the flanneld process.
+  If the node has insufficient privileges to modify the VPC routing table specified, ensure that appropriate `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and optionally `AWS_SECURITY_TOKEN` environment variables are set when running the flanneld process. 
+ 
+  Note: Currently, AWS [limits](http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Appendix_Limits.html) the number of entries per route table to 50. 
 
 * gce: create IP routes in a [Google Compute Engine Network](https://cloud.google.com/compute/docs/networking#networks)
   * Requirements:
@@ -92,7 +94,9 @@ This is the only mandatory key.
   * `Type` (string): `gce`  
   
   Command to create a compute instance with the correct permissions and IP forwarding enabled:  
-  `$ gcloud compute instances create INSTANCE --can-ip-forward --scopes compute-rw`
+  `$ gcloud compute instances create INSTANCE --can-ip-forward --scopes compute-rw`  
+  
+  Note: Currently, GCE [limits](https://cloud.google.com/compute/docs/resource-quotas) the number of routes for every *project* to 100.
 
 * alloc: only perform subnet allocation (no forwarding of data packets).
   * `Type` (string): `alloc`

+ 5 - 5
backend/gce/gce.go

@@ -238,19 +238,19 @@ func (g *GCEBackend) handleMatchingRoute(subnet string) (bool, error) {
 }
 
 func (g *GCEBackend) getRoute(subnet string) (*compute.Route, error) {
-	routeName := formatRouteName(g.gceNetwork.Name, subnet)
+	routeName := formatRouteName(subnet)
 	return g.computeService.Routes.Get(g.project, routeName).Do()
 }
 
 func (g *GCEBackend) deleteRoute(subnet string) (*compute.Operation, error) {
-	routeName := formatRouteName(g.gceNetwork.Name, subnet)
+	routeName := formatRouteName(subnet)
 	return g.computeService.Routes.Delete(g.project, routeName).Do()
 }
 
 func (g *GCEBackend) insertRoute(subnet string) (*compute.Operation, error) {
 	log.Infof("Inserting route for subnet: %v", subnet)
 	route := &compute.Route{
-		Name:            formatRouteName(g.gceNetwork.Name, subnet),
+		Name:            formatRouteName(subnet),
 		DestRange:       subnet,
 		Network:         g.gceNetwork.SelfLink,
 		NextHopInstance: g.gceInstance.SelfLink,
@@ -260,6 +260,6 @@ func (g *GCEBackend) insertRoute(subnet string) (*compute.Operation, error) {
 	return g.computeService.Routes.Insert(g.project, route).Do()
 }
 
-func formatRouteName(network, subnet string) string {
-	return fmt.Sprintf("flannel-%s-%s", network, replacer.Replace(subnet))
+func formatRouteName(subnet string) string {
+	return fmt.Sprintf("flannel-%s", replacer.Replace(subnet))
 }