Skip to content

Commit

Permalink
Merge pull request coreos#1395 from hasbro17/haseeb/document-resource…
Browse files Browse the repository at this point in the history
…-labels

*: document resource labels
  • Loading branch information
hasbro17 committed Sep 13, 2017
2 parents 2e2a760 + 7196e17 commit 6f0522a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Read [RBAC docs](./doc/user/rbac.md) for how to setup RBAC rules for etcd operat

Read [Developer Guide](./doc/dev/developer_guide.md) for setting up development environment if you want to contribute.

See the [Resources and Labels](./doc/user/resource_labels.md) doc for an overview of the resources created by the etcd-operator.

## Requirements

- Kubernetes 1.7+
Expand Down
10 changes: 10 additions & 0 deletions doc/user/resource_labels.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Resource Labels
The etcd-operator creates the following Kubernetes resources for each etcd cluster:
- Pods for the etcd nodes
- Deployment for the backup side car
- Services for the etcd client, peer and backup service
- Persistent Volume Claim, if backup is enabled with the storage type as PersistentVolume

where each resource has the following labels:
- `app=etcd`
- `etcd_cluster=<cluster-name>`
7 changes: 2 additions & 5 deletions pkg/util/k8sutil/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,8 @@ func CreateAndWaitPVC(kubecli kubernetes.Interface, clusterName, ns, storageClas
name := makePVCName(clusterName)
claim := &v1.PersistentVolumeClaim{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Labels: map[string]string{
"etcd_cluster": clusterName,
"app": "etcd",
},
Name: name,
Labels: LabelsForCluster(clusterName),
Annotations: map[string]string{
"volume.beta.kubernetes.io/storage-class": storageClass,
},
Expand Down
5 changes: 1 addition & 4 deletions pkg/util/k8sutil/k8sutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,7 @@ func CreateAndWaitPod(kubecli kubernetes.Interface, ns string, pod *v1.Pod, time
}

func newEtcdServiceManifest(svcName, clusterName, clusterIP string, ports []v1.ServicePort) *v1.Service {
labels := map[string]string{
"app": "etcd",
"etcd_cluster": clusterName,
}
labels := LabelsForCluster(clusterName)
svc := &v1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: svcName,
Expand Down

0 comments on commit 6f0522a

Please sign in to comment.