github.com/zppinho/prow@v0.0.0-20240510014325-1738badeb017/pkg/spyglass/lenses/podinfo/template.html (about)

     1  {{define "header"}}
     2  <link rel="stylesheet" type="text/css" href="style.css">
     3  <script type="text/javascript" src="script_bundle.min.js"></script>
     4  <script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
     5  {{end}}
     6  
     7  {{define "body"}}
     8  {{$pod:=.PodReport.Pod}}
     9  {{$podLink:=.PodLink}}
    10  <div class="mdl-tabs mdl-js-tabs mdl-js-ripple-effect" id="podinfo">
    11    <div class="mdl-tabs__tab-bar">
    12      <a href="#pod-panel" data-preserve-anchor="true" class="mdl-tabs__tab">Pod</a>
    13      <a href="#volumes-panel" data-preserve-anchor="true" class="mdl-tabs__tab">Volumes</a>
    14      <a href="#events-panel" data-preserve-anchor="true" class="mdl-tabs__tab">Events</a>
    15      {{range .Containers}}
    16      <a href="#{{.Container.Name}}-panel" data-preserve-anchor="true" class="mdl-tabs__tab">{{.Container.Name}}</a>
    17      {{end}}
    18      <a href="#yaml-panel" data-preserve-anchor="true" class="mdl-tabs__tab">YAML</a>
    19    </div>
    20  
    21    <div class="mdl-tabs__panel" id="pod-panel">
    22      <table class="mdl-data-table mdl-js-data-table metadata-table">
    23        <tbody>
    24        <tr>
    25          <td class="mdl-data-table__cell--non-numeric">Pod name</td>
    26          <td class="mdl-data-table__cell--non-numeric literal">{{$pod.Name}}</td>
    27        </tr>
    28        {{if ne $podLink ""}}
    29        <tr>
    30          <td class="mdl-data-table__cell--non-numeric">Pod Link</td>
    31          <td class="mdl-data-table__cell--non-numeric literal"><a href="{{$podLink}}">Click to pod</a></td>
    32        </tr>
    33        {{end}}
    34        <tr>
    35          <td class="mdl-data-table__cell--non-numeric">Start time</td>
    36          <td class="mdl-data-table__cell--non-numeric">{{$pod.Status.StartTime}}</td>
    37        </tr>
    38        <tr>
    39          <td class="mdl-data-table__cell--non-numeric">Pod status</td>
    40          <td class="mdl-data-table__cell--non-numeric literal">{{$pod.Status.Phase}}</td>
    41        </tr>
    42        <tr>
    43          <td class="mdl-data-table__cell--non-numeric">Node</td>
    44          <td class="mdl-data-table__cell--non-numeric"><code>{{$pod.Spec.NodeName}}</code> / <code>{{$pod.Status.HostIP}}</code></td>
    45        </tr>
    46        {{$hasInterestingTolerations := false}}
    47        {{range $pod.Spec.Tolerations}}
    48          {{if not (eq .Key "node.kubernetes.io/not-ready" "node.kubernetes.io/unreachable")}}
    49            {{$hasInterestingTolerations = true}}
    50          {{end}}
    51        {{end}}
    52        {{if $hasInterestingTolerations}}
    53        <tr>
    54          <td class="mdl-data-table__cell--non-numeric">Tolerations</td>
    55          <td class="mdl-data-table__cell--non-numeric">
    56            <ul class="data">
    57            {{range $pod.Spec.Tolerations}}
    58            <li><code>{{.Key}}{{if eq .Operator "Equals"}}={{.Value}}{{end}}{{if .Effect}}:{{.Effect}}{{end}}</code>{{if .TolerationSeconds}} for {{.TolerationSeconds}} seconds{{end}}</li>
    59            {{end}}
    60            </ul>
    61          </td>
    62        </tr>
    63        {{end}}
    64        <tr>
    65          <td class="mdl-data-table__cell--non-numeric">Labels</td>
    66          <td class="mdl-data-table__cell--non-numeric">
    67            <ul class="data">
    68              {{$hasProw := false}}
    69              {{range $k, $v := $pod.Labels}}
    70                {{ if not (isProw $k) }}
    71                  <li class="literal">{{$k}}={{$v}}</li>
    72                {{else}}
    73                  {{$hasProw = true}}
    74                {{end}}
    75              {{end}}
    76              {{if $hasProw}}
    77                <li class="more"><a href="#" class="expand-prow">Show prow labels</a></li>
    78                {{range $k, $v := $pod.Labels}}
    79                  {{ if (isProw $k) }}
    80                    <li class="hidden literal">{{$k}}={{$v}}</li>
    81                  {{end}}
    82                {{end}}
    83              {{end}}
    84            </ul>
    85          </td>
    86        </tr>
    87        <tr>
    88          <td class="mdl-data-table__cell--non-numeric">Annotations</td>
    89          <td class="mdl-data-table__cell--non-numeric">
    90            <ul class="data">
    91              {{$hasProw := false}}
    92              {{range $k, $v := $pod.Annotations}}
    93                {{ if not (isProw $k) }}
    94                  <li class="literal">{{$k}}={{$v}}</li>
    95                {{else}}
    96                  {{$hasProw = true}}
    97                {{end}}
    98              {{end}}
    99              {{if $hasProw}}
   100                <li class="more expand-prow"><a href="#" class="expand-prow">Show prow labels</a></li>
   101                {{range $k, $v := $pod.Annotations}}
   102                  {{ if (isProw $k) }}
   103                    <li class="hidden literal">{{$k}}={{$v}}</li>
   104                  {{end}}
   105                {{end}}
   106              {{end}}
   107            </ul>
   108          </td>
   109        </tr>
   110      </table>
   111    </div>
   112    <div class="mdl-tabs__panel" id="volumes-panel">
   113      <table class="mdl-data-table mdl-js-data-table">
   114        {{range $pod.Spec.Volumes}}
   115        <tr>
   116          <td class="mdl-data-table__cell--non-numeric" style="width: 300px;">{{.Name}}</td>
   117          <td class="mdl-data-table__cell--non-numeric literal pre">{{toYaml .}}</td>
   118        </tr>
   119        {{end}}
   120      </table>
   121    </div>
   122    <div class="mdl-tabs__panel" id="events-panel">
   123      <table class="mdl-data-table mdl-js-data-table">
   124        <thead>
   125        <tr>
   126          <th>Type</th>
   127          <th>Reason</th>
   128          <th>Age</th>
   129          <th>Source</th>
   130          <th>Message</th>
   131        </tr>
   132        </thead>
   133        {{range .PodReport.Events}}
   134          <tr class="event-type-{{.Type}}">
   135            <td class="mdl-data-table__cell--non-numeric">{{.Type}}</td>
   136            <td class="mdl-data-table__cell--non-numeric">{{.Reason}}</td>
   137            <td class="mdl-data-table__cell--non-numeric">{{toAge .LastTimestamp.Time}}{{if lt .Count 1}}({{.Count}} times){{end}}</td>
   138            <td class="mdl-data-table__cell--non-numeric literal">{{.Source.Component}}</td>
   139            <td class="mdl-data-table__cell--non-numeric">{{.Message}}</td>
   140          </tr>
   141        {{end}}
   142      </table>
   143    </div>
   144    {{range .Containers}}
   145    {{$c := .Container}}
   146    {{$status := .Status}}
   147    <div class="mdl-tabs__panel" id="{{$c.Name}}-panel">
   148      <table class="mdl-data-table mdl-js-data-table metadata-table">
   149        <tbody>
   150        <tr>
   151          <td class="mdl-data-table__cell--non-numeric">Image</td>
   152          <td class="mdl-data-table__cell--non-numeric literal">{{$c.Image}}</td>
   153        </tr>
   154        <tr>
   155          <td class="mdl-data-table__cell--non-numeric">Status</td>
   156          <td class="mdl-data-table__cell--non-numeric">
   157            {{if $status.State.Terminated}}
   158              Terminated ({{$status.State.Terminated.Reason}}{{if $status.State.Terminated.Message}} - {{$status.State.Terminated.Message}}{{end}}) at {{$status.State.Terminated.FinishedAt}} with exit code <code>{{$status.State.Terminated.ExitCode}}</code>
   159            {{else if $status.State.Running}}
   160              Running since {{$status.State.Running.StartedAt}}
   161            {{else if $status.State.Waiting}}
   162              Waiting ({{$status.State.Waiting.Reason}}{{if $status.State.Waiting.Message}} - {{$status.State.Waiting.Message}}{{end}})
   163            {{else}}
   164              Unclear.
   165            {{end}}
   166          </td>
   167        </tr>
   168        {{if or $c.Command $c.Args}}
   169        <tr>
   170          <td class="mdl-data-table__cell--non-numeric">Command</td>
   171          <td class="mdl-data-table__cell--non-numeric literal">
   172            {{range $c.Command}}
   173              <code class="item command">{{.}}</code>
   174            {{end}}
   175            {{range $c.Args}}
   176              <code class="item">{{.}}</code>
   177            {{end}}
   178          </td>
   179        </tr>
   180        {{end}}
   181        {{if or .DecoratedArgs}}
   182        <tr>
   183          <td class="mdl-data-table__cell--non-numeric"><abbr title="When a job is decorated, the original entrypoint/command/args are overwritten. This is the command invoked by the new entrypoint.">Decorated Command</abbr></td>
   184          <td class="mdl-data-table__cell--non-numeric literal">
   185            {{range .DecoratedArgs}}
   186            <code class="item">{{.}}</code>
   187            {{end}}
   188          </td>
   189        </tr>
   190        {{end}}
   191        {{if $c.VolumeMounts}}
   192        <tr>
   193          <td class="mdl-data-table__cell--non-numeric">Volume mounts</td>
   194          <td class="mdl-data-table__cell--non-numeric">
   195            <ul class="data">
   196            {{range $c.VolumeMounts}}
   197              <li><code>{{.Name}}{{if or .SubPath .SubPathExpr}}/{{or .SubPath .SubPathExpr}}{{end}}</code> at <code>{{.MountPath}}</code>{{if .ReadOnly}} (read-only){{end}}</li>
   198            {{end}}
   199            </ul>
   200          </td>
   201        </tr>
   202        {{end}}
   203        {{if $c.Env}}
   204        <td class="mdl-data-table__cell--non-numeric">Environment variables</td>
   205        <td class="mdl-data-table__cell--non-numeric">
   206          <ul class="data">
   207            {{range $c.Env}}
   208              <li>
   209                <code>{{.Name}}=</code>
   210                {{- if .Value -}}
   211                  <code>{{- .Value -}}</code>
   212                {{- else if .ValueFrom -}}
   213                  {{- if .ValueFrom.ConfigMapKeyRef -}}
   214                    (value of configmap key <code>{{.ValueFrom.ConfigMapKeyRef.Name}}.{{.ValueFrom.ConfigMapKeyRef.Key}}</code>{{if .ValueFrom.ConfigMapKeyRef.Optional}}, if it exists{{end}})
   215                  {{- else if .ValueFrom.SecretKeyRef -}}
   216                    (value of secret key <code>{{.ValueFrom.SecretKeyRef.Name}}.{{.ValueFrom.SecretKeyRef.Key}}</code>{{if .ValueFrom.SecretKeyRef.Optional}}, if it exists{{end}})
   217                  {{- else if .ValueFrom.FieldRef -}}
   218                    (value of <code>{{.ValueFrom.FieldRef.APIVersion}}</code> field path <code>{{.ValueFrom.FieldRef.FieldPath}}</code>)
   219                  {{- else if .ValueFrom.ResourceRef -}}
   220                    (container <code>{{.ValueFrom.ResourceFieldRef.ContainerName}}</code>'s <code>{{.ValueFrom.ResourceFieldRef.Resource}}</code> in <code>{{.ValueFrom.ResourceFieldRef.Divisor.String}}</code>)
   221                  {{- else -}}
   222                    (something)
   223                  {{end}}
   224                {{end}}
   225              </li>
   226            {{end}}
   227          </ul>
   228        </td>
   229        {{end}}
   230        </tbody>
   231      </table>
   232    </div>
   233    {{end}}
   234    <div class="mdl-tabs__panel" id="yaml-panel">
   235      <div class="pre literal">
   236        {{- toYaml .PodReport.Pod -}}
   237      </div>
   238    </div>
   239  </div>
   240  {{end}}