Skip to content

Commit

Permalink
Merge pull request #116 from emosbaugh/informers-and-metrics
Browse files Browse the repository at this point in the history
Add status informers and graphs to kots application spec
  • Loading branch information
emosbaugh committed Oct 31, 2019
2 parents 3d64a31 + fea058d commit 68e7cba
Showing 1 changed file with 44 additions and 20 deletions.
64 changes: 44 additions & 20 deletions kotskinds/apis/kots/v1beta1/application_types.go
Expand Up @@ -20,26 +20,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

type ApplicationPort struct {
ServiceName string `json:"serviceName"`
ServicePort int `json:"servicePort"`
LocalPort int `json:"localPort,omitempty"`
ApplicationURL string `json:"applicationUrl,omitempty"`
}

// ApplicationSpec defines the desired state of ApplicationSpec
type ApplicationSpec struct {
Title string `json:"title"`
Icon string `json:"icon,omitempty"`
ApplicationPorts []ApplicationPort `json:"ports,omitempty"`
ReleaseNotes string `json:"releaseNotes,omitempty"`
AllowRollback bool `json:"allowRollback,omitempty"`
}

// ApplicationStatus defines the observed state of Application
type ApplicationStatus struct {
}

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// Application is the Schema for the application API
Expand All @@ -62,6 +42,50 @@ type ApplicationList struct {
Items []Application `json:"items"`
}

// ApplicationSpec defines the desired state of ApplicationSpec
type ApplicationSpec struct {
Title string `json:"title"`
Icon string `json:"icon,omitempty"`
ApplicationPorts []ApplicationPort `json:"ports,omitempty"`
ReleaseNotes string `json:"releaseNotes,omitempty"`
AllowRollback bool `json:"allowRollback,omitempty"`
StatusInformers []StatusInformer `json:"statusInformers,omitempty"`
Graphs []MetricGraph `json:"graphs,omitempty"`
}

type ApplicationPort struct {
ServiceName string `json:"serviceName"`
ServicePort int `json:"servicePort"`
LocalPort int `json:"localPort,omitempty"`
ApplicationURL string `json:"applicationUrl,omitempty"`
}

type StatusInformer struct {
Kind string `json:"kind"`
Name string `json:"name"`
Namespace string `json:"namespace,omitempty"`
}

type MetricGraph struct {
Title string `json:"title"`
Query string `json:"query,omitempty"`
Legend string `json:"legend,omitempty"`
Queries []MetricQuery `json:"queries,omitempty"`
DurationSeconds uint `json:"durationSeconds,omitempty"`
// https://github.com/grafana/grafana/blob/009d58c4a228b89046fdae02aa82cf5ff05e5e69/packages/grafana-ui/src/utils/valueFormats/categories.ts
YAxisFormat string `json:"yAxisFormat,omitempty"`
YAxisTemplate string `json:"yAxisTemplate,omitempty"`
}

type MetricQuery struct {
Query string `json:"query"`
Legend string `json:"legend,omitempty"`
}

// ApplicationStatus defines the observed state of Application
type ApplicationStatus struct {
}

func init() {
SchemeBuilder.Register(&Application{}, &ApplicationList{})
}

0 comments on commit 68e7cba

Please sign in to comment.