Skip to content

Commit

Permalink
Merge pull request #22 from dmartinol/21-cleanup-code
Browse files Browse the repository at this point in the history
Removed Icon() and StatusColor() functions
  • Loading branch information
dmartinol authored Sep 27, 2022
2 parents 2bc582f + 973d41b commit 2b9e62e
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 56 deletions.
6 changes: 0 additions & 6 deletions pkg/model/cronjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ func (c CronJob) Label() string {
return c.Delegate.Name
}

func (c CronJob) Icon() string {
return "images/deployment.png"
}
func (c CronJob) StatusColor() (string, bool) {
return "", false
}
func (c CronJob) OwnerReferences() []k8sMetaV1.OwnerReference {
return c.Delegate.OwnerReferences
}
Expand Down
6 changes: 0 additions & 6 deletions pkg/model/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ func (d DaemonSet) Label() string {
return d.Delegate.Name
}

func (d DaemonSet) Icon() string {
return "images/deployment.png"
}
func (d DaemonSet) StatusColor() (string, bool) {
return "", false
}
func (d DaemonSet) OwnerReferences() []k8sMetaV1.OwnerReference {
return d.Delegate.OwnerReferences
}
Expand Down
6 changes: 0 additions & 6 deletions pkg/model/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ func (d Deployment) Label() string {
return d.Delegate.Name
}

func (d Deployment) Icon() string {
return "images/deployment.png"
}
func (d Deployment) StatusColor() (string, bool) {
return "", false
}
func (d Deployment) OwnerReferences() []k8sMetaV1.OwnerReference {
return d.Delegate.OwnerReferences
}
Expand Down
7 changes: 1 addition & 6 deletions pkg/model/deploymentConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ func (d DeploymentConfig) Name() string {
func (d DeploymentConfig) Label() string {
return d.Delegate.Name
}
func (d DeploymentConfig) Icon() string {
return "images/deployment.png"
}
func (d DeploymentConfig) StatusColor() (string, bool) {
return "", false
}

func (d DeploymentConfig) OwnerReferences() []k8sMetaV1.OwnerReference {
return d.Delegate.OwnerReferences
}
Expand Down
25 changes: 1 addition & 24 deletions pkg/model/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package model

import (
"fmt"
"strings"

logger "github.com/dmartinol/application-exporter/pkg/log"
k8sCoreV1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -33,36 +32,14 @@ func (p Pod) Name() string {
func (p Pod) Label() string {
return p.Delegate.Name
}
func (p Pod) Icon() string {
return "images/pod.png"
}

func (p Pod) OwnerReferences() []k8sMetaV1.OwnerReference {
return p.Delegate.OwnerReferences
}
func (p Pod) IsOwnerOf(owner k8sMetaV1.OwnerReference) bool {
return false
}

func (p Pod) StatusColor() (string, bool) {
switch p.Delegate.Status.Phase {
case k8sCoreV1.PodSucceeded:
return CompletedColor, true
case k8sCoreV1.PodRunning:
if p.isReady() {
return RunningColor, true
}
}
return FailedColor, true
}

func (p Pod) isReady() bool {
for _, c := range p.Delegate.Status.Conditions {
if strings.Compare(string(c.Type), "Ready") == 0 {
return strings.Compare(string(c.Status), "True") == 0
}
}
return false
}
func (p Pod) IsRunning() bool {
return p.Delegate.Status.Phase == k8sCoreV1.PodRunning
}
Expand Down
2 changes: 0 additions & 2 deletions pkg/model/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ type Resource interface {
Id() string
Name() string
Label() string
Icon() string
StatusColor() (string, bool)

OwnerReferences() []k8sMetaV1.OwnerReference
IsOwnerOf(owner k8sMetaV1.OwnerReference) bool
Expand Down
6 changes: 0 additions & 6 deletions pkg/model/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ func (s StatefulSet) Name() string {
func (s StatefulSet) Label() string {
return s.Delegate.Name
}
func (s StatefulSet) Icon() string {
return "images/sts.png"
}
func (s StatefulSet) StatusColor() (string, bool) {
return "", false
}
func (s StatefulSet) OwnerReferences() []k8sMetaV1.OwnerReference {
return s.Delegate.OwnerReferences
}
Expand Down

0 comments on commit 2b9e62e

Please sign in to comment.