├── heketi-examples ├── heketi-serviceaccount.yaml ├── topology-sample.json ├── deploy-heketi-deployment.json ├── heketi-deployment.json └── glusterfs-deployment.json ├── pods ├── gluster-1.yaml └── gluster-2.yaml ├── README.md └── LICENSE /heketi-examples/heketi-serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: heketi 5 | -------------------------------------------------------------------------------- /pods/gluster-1.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: gluster-1 5 | labels: 6 | name: gluster-1 7 | spec: 8 | hostNetwork: true 9 | nodeSelector: 10 | name: worker-1 11 | containers: 12 | - name: glusterfs 13 | image: gluster/rhgs-3.1.0 14 | ports: 15 | - name: web 16 | containerPort: 80 17 | volumeMounts: 18 | - name: brickpath 19 | mountPath: "/mnt/brick1" 20 | securityContext: 21 | capabilities: {} 22 | privileged: true 23 | volumes: 24 | - name: brickpath 25 | hostPath: 26 | path: "/mnt/brick1" 27 | -------------------------------------------------------------------------------- /pods/gluster-2.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: gluster-2 5 | labels: 6 | name: gluster-2 7 | spec: 8 | hostNetwork: true 9 | nodeSelector: 10 | name: worker-2 11 | containers: 12 | - name: glusterfs 13 | image: gluster/rhgs-3.1.0 14 | ports: 15 | - name: web 16 | containerPort: 80 17 | volumeMounts: 18 | - name: brickpath 19 | mountPath: "/mnt/brick1" 20 | securityContext: 21 | capabilities: {} 22 | privileged: true 23 | volumes: 24 | - name: brickpath 25 | hostPath: 26 | path: "/mnt/brick1" 27 | -------------------------------------------------------------------------------- /heketi-examples/topology-sample.json: -------------------------------------------------------------------------------- 1 | { 2 | "clusters": [ 3 | { 4 | "nodes": [ 5 | { 6 | "node": { 7 | "hostnames": { 8 | "manage": [ 9 | "ip-172-20-0-217.ec2.internal" 10 | ], 11 | "storage": [ 12 | "ip-172-20-0-217.ec2.internal" 13 | ] 14 | }, 15 | "zone": 1 16 | }, 17 | "devices": [ 18 | "/dev/xvdg" 19 | ] 20 | }, 21 | { 22 | "node": { 23 | "hostnames": { 24 | "manage": [ 25 | "ip-172-20-0-218.ec2.internal" 26 | ], 27 | "storage": [ 28 | "ip-172-20-0-218.ec2.internal" 29 | ] 30 | }, 31 | "zone": 1 32 | }, 33 | "devices": [ 34 | "/dev/xvdg" 35 | ] 36 | }, 37 | { 38 | "node": { 39 | "hostnames": { 40 | "manage": [ 41 | "ip-172-20-0-219.ec2.internal" 42 | ], 43 | "storage": [ 44 | "ip-172-20-0-219.ec2.internal" 45 | ] 46 | }, 47 | "zone": 1 48 | }, 49 | "devices": [ 50 | "/dev/xvdg" 51 | ] 52 | } 53 | ] 54 | } 55 | ] 56 | } 57 | -------------------------------------------------------------------------------- /heketi-examples/deploy-heketi-deployment.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "Service", 3 | "apiVersion": "v1", 4 | "metadata": { 5 | "name": "deploy-heketi", 6 | "labels": { 7 | "glusterfs": "heketi-service", 8 | "deploy-heketi": "support" 9 | }, 10 | "annotations": { 11 | "description": "Exposes Heketi Service" 12 | } 13 | }, 14 | "spec": { 15 | "selector": { 16 | "name": "deploy-heketi" 17 | }, 18 | "ports": [ 19 | { 20 | "name": "deploy-heketi", 21 | "port": 8080, 22 | "targetPort": 8080 23 | } 24 | ] 25 | } 26 | } 27 | { 28 | "kind": "Deployment", 29 | "apiVersion": "extensions/v1beta1", 30 | "metadata": { 31 | "name": "deploy-heketi", 32 | "labels": { 33 | "glusterfs": "heketi-deployment" 34 | }, 35 | "annotations": { 36 | "description": "Defines how to deploy Heketi" 37 | } 38 | }, 39 | "spec": { 40 | "replicas":1, 41 | "template": { 42 | "metadata": { 43 | "name": "deploy-heketi", 44 | "labels": { 45 | "name": "deploy-heketi", 46 | "glusterfs": "heketi-pod" 47 | } 48 | }, 49 | "spec": { 50 | "containers": [ 51 | { 52 | "image": "heketi/heketi:dev", 53 | "imagePullPolicy": "Always", 54 | "name": "deploy-heketi", 55 | "env": [ 56 | { 57 | "name": "HEKETI_EXECUTOR", 58 | "value": "kubernetes" 59 | }, 60 | { 61 | "name": "HEKETI_KUBE_USE_SECRET", 62 | "value": "y" 63 | }, 64 | { 65 | "name": "HEKETI_KUBE_TOKENFILE", 66 | "value": "/var/lib/heketi/secret/token" 67 | }, 68 | { 69 | "name": "HEKETI_FSTAB", 70 | "value": "/var/lib/heketi/fstab" 71 | }, 72 | { 73 | "name": "HEKETI_SNAPSHOT_LIMIT", 74 | "value": "14" 75 | }, 76 | { 77 | "name": "HEKETI_KUBE_INSECURE", 78 | "value": "y" 79 | }, 80 | { 81 | "name": "HEKETI_KUBE_NAMESPACE", 82 | "value": "default" 83 | }, 84 | { 85 | "name": "HEKETI_KUBE_APIHOST", 86 | "value": "https://172.20.0.9" 87 | } 88 | ], 89 | "ports": [ 90 | { 91 | "containerPort": 8080 92 | } 93 | ], 94 | "volumeMounts": [ 95 | { 96 | "name": "db", 97 | "mountPath": "/var/lib/heketi" 98 | }, 99 | { 100 | "name": "secret", 101 | "mountPath": "/var/lib/heketi/secret" 102 | } 103 | ], 104 | "readinessProbe": { 105 | "timeoutSeconds": 3, 106 | "initialDelaySeconds": 3, 107 | "httpGet": { 108 | "path": "/hello", 109 | "port": 8080 110 | } 111 | }, 112 | "livenessProbe": { 113 | "timeoutSeconds": 3, 114 | "initialDelaySeconds": 30, 115 | "httpGet": { 116 | "path": "/hello", 117 | "port": 8080 118 | } 119 | } 120 | } 121 | ], 122 | "volumes": [ 123 | { 124 | "name": "db" 125 | }, 126 | { 127 | "name": "secret", 128 | "secret": { 129 | "secretName": "heketi-token-vyfzs" 130 | } 131 | } 132 | ] 133 | } 134 | } 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /heketi-examples/heketi-deployment.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "Service", 3 | "apiVersion": "v1", 4 | "metadata": { 5 | "name": "heketi", 6 | "labels": { 7 | "glusterfs": "heketi-service", 8 | "deploy-heketi": "support" 9 | }, 10 | "annotations": { 11 | "description": "Exposes Heketi Service" 12 | } 13 | }, 14 | "spec": { 15 | "selector": { 16 | "name": "heketi" 17 | }, 18 | "ports": [ 19 | { 20 | "name": "heketi", 21 | "port": 8080, 22 | "targetPort": 8080 23 | } 24 | ] 25 | } 26 | } 27 | { 28 | "kind": "Deployment", 29 | "apiVersion": "extensions/v1beta1", 30 | "metadata": { 31 | "name": "heketi", 32 | "labels": { 33 | "glusterfs": "heketi-deployment" 34 | }, 35 | "annotations": { 36 | "description": "Defines how to deploy Heketi" 37 | } 38 | }, 39 | "spec": { 40 | "replicas":1, 41 | "template": { 42 | "metadata": { 43 | "name": "heketi", 44 | "labels": { 45 | "name": "heketi", 46 | "glusterfs": "heketi-pod" 47 | } 48 | }, 49 | "spec": { 50 | "containers": [ 51 | { 52 | "image": "heketi/heketi:dev", 53 | "imagePullPolicy": "Always", 54 | "name": "heketi", 55 | "env": [ 56 | { 57 | "name": "HEKETI_USER_KEY", 58 | "value": "" 59 | }, 60 | { 61 | "name": "HEKETI_ADMIN_KEY", 62 | "value": "" 63 | }, 64 | { 65 | "name": "HEKETI_EXECUTOR", 66 | "value": "kubernetes" 67 | }, 68 | { 69 | "name": "HEKETI_KUBE_USE_SECRET", 70 | "value": "" 71 | }, 72 | { 73 | "name": "HEKETI_KUBE_TOKENFILE", 74 | "value": "/var/lib/heketi/secret/token" 75 | }, 76 | { 77 | "name": "HEKETI_FSTAB", 78 | "value": "/var/lib/heketi/fstab" 79 | }, 80 | { 81 | "name": "HEKETI_SNAPSHOT_LIMIT", 82 | "value": "14" 83 | }, 84 | { 85 | "name": "HEKETI_KUBE_CERTFILE", 86 | "value": "" 87 | }, 88 | { 89 | "name": "HEKETI_KUBE_INSECURE", 90 | "value": "" 91 | }, 92 | { 93 | "name": "HEKETI_KUBE_USER", 94 | "value": "" 95 | }, 96 | { 97 | "name": "HEKETI_KUBE_PASSWORD", 98 | "value": "" 99 | }, 100 | { 101 | "name": "HEKETI_KUBE_NAMESPACE", 102 | "value": "" 103 | }, 104 | { 105 | "name": "HEKETI_KUBE_APIHOST", 106 | "value": "" 107 | } 108 | ], 109 | "ports": [ 110 | { 111 | "containerPort": 8080 112 | } 113 | ], 114 | "volumeMounts": [ 115 | { 116 | "name": "db", 117 | "mountPath": "/var/lib/heketi" 118 | }, 119 | { 120 | "name": "secret", 121 | "mountPath": "/var/lib/heketi/secret" 122 | } 123 | ], 124 | "readinessProbe": { 125 | "timeoutSeconds": 3, 126 | "initialDelaySeconds": 3, 127 | "httpGet": { 128 | "path": "/hello", 129 | "port": 8080 130 | } 131 | }, 132 | "livenessProbe": { 133 | "timeoutSeconds": 3, 134 | "initialDelaySeconds": 30, 135 | "httpGet": { 136 | "path": "/hello", 137 | "port": 8080 138 | } 139 | } 140 | } 141 | ], 142 | "volumes": [ 143 | { 144 | "name": "db", 145 | "glusterfs": { 146 | "endpoints": "heketi-storage-endpoints", 147 | "path": "heketidbstorage" 148 | } 149 | }, 150 | { 151 | "name": "secret", 152 | "secret": { 153 | "secretName": "" 154 | } 155 | } 156 | ] 157 | } 158 | } 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /heketi-examples/glusterfs-deployment.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "Deployment", 3 | "apiVersion": "extensions/v1beta1", 4 | "metadata": { 5 | "name": "glusterfs-", 6 | "labels": { 7 | "glusterfs": "deployment", 8 | "glusterfs-node": "" 9 | }, 10 | "annotations": { 11 | "description": "GlusterFS container deployment template", 12 | "tags": "glusterfs" 13 | } 14 | }, 15 | "spec": { 16 | "replicas":1, 17 | "template": { 18 | "metadata": { 19 | "name": "glusterfs", 20 | "labels": { 21 | "name": "glusterfs", 22 | "glusterfs": "pod", 23 | "glusterfs-node": "" 24 | } 25 | }, 26 | "spec": { 27 | "nodeSelector": { 28 | "kubernetes.io/hostname": "" 29 | }, 30 | "hostNetwork": true, 31 | "containers": [ 32 | { 33 | "image": "heketi/gluster:latest", 34 | "imagePullPolicy": "Always", 35 | "name": "glusterfs", 36 | "volumeMounts": [ 37 | { 38 | "name": "glusterfs-heketi", 39 | "mountPath": "/var/lib/heketi" 40 | }, 41 | { 42 | "name": "glusterfs-run", 43 | "mountPath": "/run" 44 | }, 45 | { 46 | "name": "glusterfs-lvm", 47 | "mountPath": "/run/lvm" 48 | }, 49 | { 50 | "name": "glusterfs-etc", 51 | "mountPath": "/etc/glusterfs" 52 | }, 53 | { 54 | "name": "glusterfs-logs", 55 | "mountPath": "/var/log/glusterfs" 56 | }, 57 | { 58 | "name": "glusterfs-config", 59 | "mountPath": "/var/lib/glusterd" 60 | }, 61 | { 62 | "name": "glusterfs-dev", 63 | "mountPath": "/dev" 64 | }, 65 | { 66 | "name": "glusterfs-cgroup", 67 | "mountPath": "/sys/fs/cgroup" 68 | } 69 | ], 70 | "securityContext": { 71 | "capabilities": {}, 72 | "privileged": true 73 | }, 74 | "readinessProbe": { 75 | "timeoutSeconds": 3, 76 | "initialDelaySeconds": 60, 77 | "exec": { 78 | "command": [ 79 | "/bin/bash", 80 | "-c", 81 | "systemctl status glusterd.service" 82 | ] 83 | } 84 | }, 85 | "livenessProbe": { 86 | "timeoutSeconds": 3, 87 | "initialDelaySeconds": 60, 88 | "exec": { 89 | "command": [ 90 | "/bin/bash", 91 | "-c", 92 | "systemctl status glusterd.service" 93 | ] 94 | } 95 | } 96 | } 97 | ], 98 | "volumes": [ 99 | { 100 | "name": "glusterfs-heketi", 101 | "hostPath": { 102 | "path": "/var/lib/heketi" 103 | } 104 | }, 105 | { 106 | "name": "glusterfs-run" 107 | }, 108 | { 109 | "name": "glusterfs-lvm", 110 | "hostPath": { 111 | "path": "/run/lvm" 112 | } 113 | }, 114 | { 115 | "name": "glusterfs-etc", 116 | "hostPath": { 117 | "path": "/etc/glusterfs" 118 | } 119 | }, 120 | { 121 | "name": "glusterfs-logs", 122 | "hostPath": { 123 | "path": "/var/log/glusterfs" 124 | } 125 | }, 126 | { 127 | "name": "glusterfs-config", 128 | "hostPath": { 129 | "path": "/var/lib/glusterd" 130 | } 131 | }, 132 | { 133 | "name": "glusterfs-dev", 134 | "hostPath": { 135 | "path": "/dev" 136 | } 137 | }, 138 | { 139 | "name": "glusterfs-cgroup", 140 | "hostPath": { 141 | "path": "/sys/fs/cgroup" 142 | } 143 | } 144 | ] 145 | } 146 | } 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Note: This repo is an old prototype that I had built and it has subsequently moved to the glusterfs community and is now being maintained there. You can access it at https://github.com/gluster/gluster-kubernetes 2 | 3 | 4 | # Running GlusterFS inside Kubernetes 5 | 6 | I thought it would be interesting to explore a converged scenario where Kubernetes was running the containers for the compute runtimes as well as the containers for the storage runtimes. This is useful in that it allows you to have a single infrastructure for the full stack. I thought I'd write up what I did to get it working given that its a new scenario for Kubernetes and also uses some aspects of Kubernetes that aren't documented in much detail. 7 | 8 | ## Some Background 9 | 10 | For the storage platform example, we'll be using GlusterFS, which is a Clustered Open Source Scale Out Storage platform. Given that it is clustered, GlusterFS is comprised of many nodes/servers which are each attached to local storage. In GlusterFS terms, these servers are called peers. Each peer runs an identical set of processes. The peer processes can be codified within a single Docker image and that image runs on every node that you would like to have as a GlusterFS peer. Each peer requires access to a certain amount of local storage, which in GlusterFS terms is called the "brick". The "cluster" is formed when the GlusterFS peers are able to be made aware of each other via a process called "probing". The GlusterFS term for the cluster is called a Trusted Storage Pool. Once the Trusted Storage Pool is established, GlusterFS Volumes can be created, by aggregating the local storage made available by each peer, and then making those GlusterFS volumes available to the Compute Pods running in Kubernetes using the GlusterFS or NFS Kubernetes volume plugins. 11 | 12 | ## Architectural Considerations 13 | 14 | Given that we have containerized the GlusterFS peer processes into an image, we need to carefully design the Kubernetes Pods to make sure the containers are launched and orchestrated in the correct manner. 15 | 16 | The first factor to consider is that each of the GlusterFS Peers will need access to local storage that can be used as the GlusterFS Peer's Brick. It will likely be the case that only certain nodes in the Kubernetes Cluster will have access to local storage so this requires a way of ensuring that the pods only land on suitable Kubernetes Nodes. We achieve this by having a specific pod for each peer. Each of these pods uses a Kubernetes NodeSelector label to ensure that it is always scheduled on a specific Host. 17 | 18 | The second factor to consider is networking. This solution works with both Flannel and Docker Host Networking. This example uses Docker Host Networking to keep things a little cleaner and also because at Red Hat we are interested in exploring different methods of providing QoS for Storage Traffic and one approach could involve physically separating the network traffic by putting the compute traffic on eth0 and the storage traffic on eth1. We achieve this by using hostNetwork: true in the Pod and setting the following in the /etc/kubernetes/kubelet on all nodes in the cluster: 19 | ``` 20 | KUBELET_ARGS="--host-network-sources=*" 21 | ``` 22 | 23 | The third factor is properly identifying the brick and mounting it into the correct location of the GlusterFS Peer container. We achieve this using the HostPath Kubernetes Volume Plugin which allows us to mount local storage into a container from the Host. We assume that the local direct attached storage has already been prepared and made available at a given path on the Host. For our examples, that path is /mnt/brick1. 24 | 25 | The fourth factor is that the GlusterFS images need to run in privileged mode. We enable this by using privileged: true in the Pod and setting the following in the /etc/kubernetes/config on all nodes in the cluster: 26 | ``` 27 | KUBE_ALLOW_PRIV="--allow-privileged=true" 28 | ``` 29 | 30 | 31 | ## Implementation 32 | 33 | To demonstrate this solution, we're going to create a 2 Node GlusterFS Cluster. This means that there is a single GlusterFS peer running on each node. 34 | 35 | We begin by submitting 2 unique pods (one for each peer), which can be seen here. Due to the NodeSelector Labels in the pods the Gluster-1 Pod will be scheduled on a Kubernetes Node that has the label name=worker-1 and the Gluster=2 Pod will be scheduled on name=worker-2. 36 | 37 | ``` 38 | [root@master ~]# kubectl create -f gluster-1.yaml 39 | [root@master ~]# kubectl create -f gluster-2.yaml 40 | [root@master ~]# kubectl get pods -o wide 41 | NAME READY STATUS RESTARTS AGE NODE 42 | gluster-1 1/1 Running 0 1h worker-1 43 | gluster-2 1/1 Running 0 1h worker-2 44 | ``` 45 | 46 | Now that the peers are running, we can shell into the worker-1 node and run "docker ps" to see the container ID for the peer image that was launched. 47 | 48 | ``` 49 | [root@worker-1 ~]# docker ps 50 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 51 | 56830d96667c gluster/rhgs-3.1.0 "/usr/sbin/init" About an hour ago Up About an hour k8s_glusterfs.f6ef5764_gluster-1_default_5541a4c1-56b0-11e5-97e6-000c294da916_2b367cbe 52 | cabec0a71468 gcr.io/google_containers/pause:0.8.0 "/pause" About an hour ago Up About an hour k8s_POD.7be6d81d_gluster-1_default_5541a4c1-56b0-11e5-97e6-000c294da916_64d330b7 53 | ``` 54 | 55 | We can then Docker Exec into the container so that we can probe the other peer pod's container and form the trusted storage pool. Note that the current image has a bug which requires you to reset the Gluster Peer UUID. 56 | ``` 57 | [root@worker-1 ~]# docker exec -it 56830d96667c bash 58 | [root@worker-1 /]# gluster system uuid reset 59 | [root@worker-1 /]# gluster peer probe 192.168.58.22 60 | [root@worker-1 /]# gluster peer status 61 | Number of Peers: 1 62 | 63 | Hostname: worker-2.fed 64 | Uuid: 1845075d-6ecc-4db6-8aef-7d82e6f3ae7e 65 | State: Peer in Cluster (Connected) 66 | ``` 67 | Now that the Trusted Storage Pool is established between the worker-1 peer and the worker-2 peer, while staying inside the container, we can create a GlusterFS volume 68 | ``` 69 | [root@worker-1 /]# gluster volume create newvol replica 2 192.168.58.21:/mnt/brick1/newvol 192.168.58.22:/mnt/brick1/newvol 70 | [root@worker-1 /]# gluster volume start newvol 71 | [root@worker-1 /]# gluster volume status 72 | Status of volume: newvol 73 | Gluster process TCP Port RDMA Port Online Pid 74 | ------------------------------------------------------------------------------ 75 | Brick 192.168.58.21:/mnt/brick1/newvol 49152 0 Y 322 76 | Brick 192.168.58.22:/mnt/brick1/newvol 49152 0 Y 335 77 | NFS Server on localhost N/A N/A N N/A 78 | Self-heal Daemon on localhost N/A N/A Y 360 79 | NFS Server on worker-2.fed N/A N/A N N/A 80 | Self-heal Daemon on worker-2.fed N/A N/A Y 371 81 | 82 | Task Status of Volume newvol 83 | ------------------------------------------------------------------------------ 84 | There are no active volume tasks 85 | ``` 86 | Now that the Volume is created, we can then make it accessible to any of the compute containers running in Kubernetes as demonstrated by the [GlusterFS Kubernetes Volume Plugin Documentation](https://github.com/kubernetes/kubernetes/tree/master/examples/glusterfs) 87 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | --------------------------------------------------------------------------------