Skip to content

Commit

Permalink
Merge pull request #518 from cloud-ark/custom-resource-connections
Browse files Browse the repository at this point in the history
README and example update
  • Loading branch information
devdattakulkarni authored Jun 10, 2020
2 parents 907b34f + b928eb9 commit 4a3a794
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 38 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Kubernetes native stacks are built by extending Kubernetes Resource set (APIs) with Operators and their Custom Resources. Application workflows on Kubernetes are realized by establishing connections between Kubernetes Resources (APIs). These connections can be based on various relationships such as labels, annotations, ownership, etc.

<p align="center">
<img src="./docs/application-workflow.png" width="600" height="300">
<img src="./docs/application-workflow.png" width="800" height="300">
</p>

KubePlus tooling simplifies building, visualizing and monitoring these application workflows. KubePlus is being developed as part of our [Platform as Code practice](https://cloudark.io/platform-as-code).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
(venv) Devs-MacBook:kubediscovery devdatta$ kubectl connections cr ClusterIssuer wordpress-stack namespace1
Discovering connections - Level: 0, Kind:ClusterIssuer, instance:wordpress-stack
Discovering connections - Level: 1, Kind:Ingress, instance:wordpress-ingress
Discovering connections - Level: 2, Kind:Service, instance:wordpress
Discovering connections - Level: 3, Kind:Pod, instance:wordpress-pod
Discovering connections - Level: 4, Kind:Service, instance:cluster1-mysql-master
Discovering connections - Level: 5, Kind:Pod, instance:cluster1-mysql-0
Discovering connections - Level: 6, Kind:Service, instance:cluster1-mysql-nodes
Discovering connections - Level: 7, Kind:MysqlCluster, instance:cluster1
Discovering connections - Level: 8, Kind:StatefulSet, instance:cluster1-mysql
Discovering connections - Level: 8, Kind:Service, instance:cluster1-mysql
Discovering connections - Level: 8, Kind:Service, instance:cluster1-mysql-master
Discovering connections - Level: 8, Kind:Service, instance:cluster1-mysql-nodes
Discovering connections - Level: 8, Kind:ConfigMap, instance:cluster1-mysql

::Final connections graph::
------ Branch 1 ------
Level:0 ClusterIssuer/wordpress-stack
Level:1 Ingress/wordpress-ingress [related to ClusterIssuer/wordpress-stack by:annotation]
Level:2 Service/wordpress [related to Ingress/wordpress-ingress by:specproperty]
Level:3 Pod/wordpress-pod [related to Service/wordpress by:label]
Level:4 Service/cluster1-mysql-master [related to Pod/wordpress-pod by:envvariable]
Level:5 Pod/cluster1-mysql-0 [related to Service/cluster1-mysql-master by:label]
Level:6 Service/cluster1-mysql [related to Pod/cluster1-mysql-0 by:label]
Level:6 Service/cluster1-mysql-nodes [related to Pod/cluster1-mysql-0 by:envvariable]
Level:6 Service/cluster1-mysql-nodes [related to Pod/cluster1-mysql-0 by:label]
Level:7 MysqlCluster/cluster1 [related to Service/cluster1-mysql-nodes by:owner reference]
Level:8 Service/cluster1-mysql [related to MysqlCluster/cluster1 by:owner reference]
Level:8 Service/cluster1-mysql-master [related to MysqlCluster/cluster1 by:owner reference]
Level:8 ConfigMap/cluster1-mysql [related to MysqlCluster/cluster1 by:owner reference]
Level:8 StatefulSet/cluster1-mysql [related to MysqlCluster/cluster1 by:owner reference]
Level:9 Pod/cluster1-mysql-0 [related to StatefulSet/cluster1-mysql by:owner reference]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(venv) Devs-MacBook:kubediscovery devdatta$ kubectl connections cr ClusterIssuer wordpress-stack namespace1
Discovering connections - Level: 0, Kind:ClusterIssuer, instance:wordpress-stack
Discovering connections - Level: 1, Kind:Ingress, instance:wordpress-ingress
Discovering connections - Level: 2, Kind:Service, instance:wordpress

::Final connections graph::
------ Branch 1 ------
Level:0 ClusterIssuer/wordpress-stack
Level:1 Ingress/wordpress-ingress [related to ClusterIssuer/wordpress-stack by:annotation]
Level:2 Service/wordpress [related to Ingress/wordpress-ingress by:specproperty]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(venv) Devs-MacBook:kubediscovery devdatta$ kubectl connections cr ClusterIssuer wordpress-stack namespace1
Discovering connections - Level: 0, Kind:ClusterIssuer, instance:wordpress-stack
Discovering connections - Level: 1, Kind:Ingress, instance:wordpress-ingress
Discovering connections - Level: 2, Kind:Service, instance:wordpress
Discovering connections - Level: 3, Kind:Pod, instance:wordpress-pod

::Final connections graph::
------ Branch 1 ------
Level:0 ClusterIssuer/wordpress-stack
Level:1 Ingress/wordpress-ingress [related to ClusterIssuer/wordpress-stack by:annotation]
Level:2 Service/wordpress [related to Ingress/wordpress-ingress by:specproperty]
Level:3 Pod/wordpress-pod [related to Service/wordpress by:label]
14 changes: 14 additions & 0 deletions examples/wordpress-mysqlcluster/kubectl-connections-service1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(venv) Devs-MacBook:kubediscovery devdatta$ kubectl connections Service wordpress namespace1
Discovering connections - Level: 0, Kind:Service, instance:wordpress
Discovering connections - Level: 1, Kind:Pod, instance:wordpress-pod
Discovering connections - Level: 1, Kind:Ingress, instance:wordpress-ingress
Discovering connections - Level: 2, Kind:ClusterIssuer, instance:wordpress-stack

::Final connections graph::
------ Branch 1 ------
Level:0 Service/wordpress
Level:1 Pod/wordpress-pod [related to Service/wordpress by:label]
------ Branch 2 ------
Level:0 Service/wordpress
Level:1 Ingress/wordpress-ingress [related to Service/wordpress by:specproperty]
Level:2 ClusterIssuer/wordpress-stack [related to Ingress/wordpress-ingress by:annotation]
3 changes: 3 additions & 0 deletions examples/wordpress-mysqlcluster/steps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ Steps:
- Base64 decode the value of cluster1-secret and add that value to WORDPRESS_DB_PASSWORD environment variable

- kubectl create -f wordpress-pod.yaml
- kubectl create -f wordpress-service.yaml
- kubectl create -f wordpress-ingress.yaml
- kubectl create -f clusterissuer.yaml

10) Check the connections
- kubectl connections cr MysqlCluster cluster1 namespace1
Expand Down
1 change: 1 addition & 0 deletions examples/wordpress-mysqlcluster/wordpress-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
# add an annotation indicating the issuer to use.
cert-manager.io/cluster-issuer: wordpress-stack
name: wordpress-ingress
namespace: namespace1
spec:
rules:
- host: myingress.com
Expand Down
38 changes: 1 addition & 37 deletions examples/wordpress-mysqlcluster/wordpress-pod.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
apiVersion: v1
kind: Service
metadata:
name: wordpress
namespace: namespace1
labels:
app: wordpress
spec:
ports:
- port: 80
selector:
app: wordpress
tier: frontend
type: ClusterIP
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: wp-pv-claim
Expand Down Expand Up @@ -54,25 +39,4 @@ spec:
- name: wordpress-persistent-storage
persistentVolumeClaim:
claimName: wp-pv-claim
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
# add an annotation indicating the issuer to use.
cert-manager.io/cluster-issuer: wordpress-stack
name: wordpress-ingress
namespace: namespace1
spec:
rules:
- host: myingress.com
http:
paths:
- backend:
serviceName: wordpress
servicePort: 80
path: /
tls: # < placing a host in the TLS config will indicate a certificate should be created
- hosts:
- myingress.com
secretName: myingress-cert # < cert-manager will store the created certificate in this secret.

15 changes: 15 additions & 0 deletions examples/wordpress-mysqlcluster/wordpress-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: wordpress
namespace: namespace1
labels:
app: wordpress
spec:
ports:
- port: 80
selector:
app: wordpress
tier: frontend
type: ClusterIP

0 comments on commit 4a3a794

Please sign in to comment.