Skip to content

Commit

Permalink
doc: adding additional docs
Browse files Browse the repository at this point in the history
Signed-off-by: gkarthiks <[email protected]>
  • Loading branch information
gkarthiks committed Aug 24, 2019
1 parent 00f6d63 commit ca3d420
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ A simple page that lists all the CronJobs that are available in K8s Cluster

![](k8s-cron-schedule.png)

Often in Kubernetes cluster developers deploy CronJobs and forgets that. To kepp a track of the deployed CronJobs and its corresponding schedules, they need to run the `kubectl get cronjobs -o custom-columns=JOB:metadata.name,SCHEDULE:spec.schedule` command. This is ok most of the times, but to keep a track of the timetables, it would be great to see these information in the table format.
Often in Kubernetes cluster developers deploy CronJobs and forgets that. To kepp a track of the deployed CronJobs and its corresponding schedules, they need to run the `kubectl get cronjobs -o custom-columns=JOB:metadata.name,SCHEDULE:spec.schedule` command. This is ok most of the times, but to keep a track of the timetables, it would be great to see these information in the table format on demand.

This small utility program provides the CronJob listing along with the schedules in a HTML page.

By default, the cronjobs are listed within the current namespace. To get the cluster wide list, pass `POD_NAMESPACE` empty string in env variable. Also pass the go-html-template path in `TMPL_FILE_PATH` variable.
By default, the cronjobs are listed within the current namespace. To get the cluster wide list, pass `cluster` string in env variable `SCOPE`. Also pass the go-html-template path in `TMPL_FILE_PATH` variable. A sample html template can be found [here](schedule.html).


Values passed to the html template will construct a page as shown below.
![](page.png)
Expand Down
118 changes: 118 additions & 0 deletions schedule.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta name="viewport" content="width=device-width"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Cron Schedules</title>
<style type="text/css">
body{
margin: 0 auto;
padding: 0;
min-width: 100%;
font-family: sans-serif;
}
table{
margin: 50px 0 50px 0;
}
.header{
height: 40px;
text-align: center;
font-size: 24px;
font-weight: bold;
font-style: italic;
}
.content{
height: 100px;
font-size: 18px;
line-height: 30px;
}
.button{
text-align: center;
font-size: 18px;
font-family: sans-serif;
font-weight: bold;
padding: 0 30px 0 30px;
}
.button a{
color: #FFFFFF;
text-decoration: none;
}
.buttonwrapper{
margin: 0 auto;
}
.footer{
text-transform: uppercase;
text-align: center;
height: 40px;
font-size: 14px;
}
</style>
</head>

<body bgcolor="#3662d1">

<table bgcolor="#FFFFFF" width="100%" border="0" cellspacing="0"
cellpadding="0">

<tr class="header">
<td style="padding: 40px;">
CronJob Schedule in {{ .Namespace }} namespace
</td>
</tr>
<tr class="content">
<td style="padding:10px;">
<p>
Please find the below list <b><i>CronJobs</i></b> and its <b><i>Schedules</i></b> that are available.
</p>
</td>
</tr>
<tr>
<td style="padding: 30px 0 20px 0;" bgcolor="#dad8e6">
<table bgcolor="#e1effc" cellspacing="0" class="buttonwrapper" cellspacing="0" celpadding="0" border=".5">
<tr bgcolor="#3662d1" style="color: white">
<th>S No</th>
<th>Name</th>
<th>Schedules</th>
{{ if eq .Namespace "all" }}
<th>Namespace</th>
{{ end }}
</tr>
{{ $root := . }}
{{range $idx, $ele := .CronJobLists}}
<tr>
<td>
{{ $ele.SNo }}
</td>
<td>
{{ $ele.Name }}
</td>
<td>
<a href="{{ $ele.LinkFormat }}" target="_blank">{{ $ele.Schedule }}</a>
</td>
{{ if eq $root.Namespace "all" }}
<td>
{{ $ele.Namespace }}
</td>
{{ end }}
</tr>
{{ end }}
</table>
</td>
</tr>
<tr>
<td style="padding: 20px 0 0 0;">
<table bgcolor="#009587" border="2" cellspacing="0" cellpadding="0" class="buttonwrapper">
<tr>
<td class="button" height="25" >
<a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/" target="_blank">Go to K8s CronJob Documentation</a>
</td>
<td class="button" height="25">
<a href="https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/" target="_blank">Kubernetes Documentation</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

0 comments on commit ca3d420

Please sign in to comment.