Skip to content

Commit

Permalink
Refactor Doris monitor K8s app resources (#21)
Browse files Browse the repository at this point in the history
* Refactor prometheus deployment to statefulset

* Refactor grafana deployment to statefulset

* Refactor loki deployment to statefulset

* update deploy resources
  • Loading branch information
Al-assad authored Nov 25, 2023
1 parent dc9e00c commit 94139d7
Show file tree
Hide file tree
Showing 14 changed files with 215 additions and 466 deletions.
44 changes: 20 additions & 24 deletions api/v1beta1/dorismonitor_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ type PrometheusSpec struct {
corev1.ResourceRequirements `json:",inline"`

// +optional
StorageClassName string `json:"storageClassName,omitempty"`
StorageClassName *string `json:"storageClassName,omitempty"`

// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
Expand All @@ -128,7 +128,7 @@ type GrafanaSpec struct {
corev1.ResourceRequirements `json:",inline"`

// +optional
StorageClassName string `json:"storageClassName,omitempty"`
StorageClassName *string `json:"storageClassName,omitempty"`

// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
Expand All @@ -148,7 +148,7 @@ type LokiSpec struct {
corev1.ResourceRequirements `json:",inline"`

// +optional
StorageClassName string `json:"storageClassName,omitempty"`
StorageClassName *string `json:"storageClassName,omitempty"`

// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
Expand Down Expand Up @@ -210,28 +210,25 @@ const (
MnrOprStageNamespacedServiceAccount DorisMonitorOprStage = "rbac/ServiceAccount"
MnrOprStageNamespacedRoleBinding DorisMonitorOprStage = "rbac/RoleBinding"

MnrOprStagePrometheus DorisMonitorOprStage = "prometheus"
MnrOprStagePrometheusConfigMap DorisMonitorOprStage = "prometheus/ConfigMap"
MnrOprStagePrometheusService DorisMonitorOprStage = "prometheus/Service"
MnrOprStagePrometheusPVC DorisMonitorOprStage = "prometheus/PersistentVolumeClaim"
MnrOprStagePrometheusDeployment DorisMonitorOprStage = "prometheus/Deployment"
MnrOprStagePrometheus DorisMonitorOprStage = "prometheus"
MnrOprStagePrometheusConfigMap DorisMonitorOprStage = "prometheus/ConfigMap"
MnrOprStagePrometheusService DorisMonitorOprStage = "prometheus/Service"
MnrOprStagePrometheusStatefulset DorisMonitorOprStage = "prometheus/Statefulset"

MnrOprStageGrafana DorisMonitorOprStage = "grafana"
MnrOprStageGrafanaSecret DorisMonitorOprStage = "grafana/Secret"
MnrOprStageGrafanaConfigMap DorisMonitorOprStage = "grafana/ConfigMap"
MnrOprStageGrafanaService DorisMonitorOprStage = "grafana/Service"
MnrOprStageGrafanaPVC DorisMonitorOprStage = "grafana/PersistentVolumeClaim"
MnrOprStageGrafanaDeployment DorisMonitorOprStage = "grafana/Deployment"
MnrOprStageGrafana DorisMonitorOprStage = "grafana"
MnrOprStageGrafanaSecret DorisMonitorOprStage = "grafana/Secret"
MnrOprStageGrafanaConfigMap DorisMonitorOprStage = "grafana/ConfigMap"
MnrOprStageGrafanaService DorisMonitorOprStage = "grafana/Service"
MnrOprStageGrafanaStatefulset DorisMonitorOprStage = "grafana/Statefulset"

MnrOprStagePromtail DorisMonitorOprStage = "promtail"
MnrOprStagePromtailConfigMap DorisMonitorOprStage = "promtail/ConfigMap"
MnrOprStagePromtailDaemonSet DorisMonitorOprStage = "promtail/DemonSet"

MnrOprStageLoki DorisMonitorOprStage = "loki"
MnrOprStageLokiConfigMap DorisMonitorOprStage = "loki/ConfigMap"
MnrOprStageLokiService DorisMonitorOprStage = "loki/Service"
MnrOprStageLokiPVC DorisMonitorOprStage = "loki/PersistentVolumeClaim"
MnrOprStageLokiDeployment DorisMonitorOprStage = "loki/Deployment"
MnrOprStageLoki DorisMonitorOprStage = "loki"
MnrOprStageLokiConfigMap DorisMonitorOprStage = "loki/ConfigMap"
MnrOprStageLokiService DorisMonitorOprStage = "loki/Service"
MnrOprStageLokiStatefulset DorisMonitorOprStage = "loki/Statefulset"

MnrOprStageCompleted DorisMonitorOprStage = "completed"
)
Expand Down Expand Up @@ -260,11 +257,10 @@ type PromtailStatus struct {

// DorisMonitorComponentStatus defines the status of the doris monitor component
type DorisMonitorComponentStatus struct {
ServiceRef NamespacedName `json:"serviceRef,omitempty"`
DeploymentRef NamespacedName `json:"deploymentRef,omitempty"`
PVCRef NamespacedName `json:"pvcRef,omitempty"`
Ready bool `json:"ready,omitempty"`
Conditions []apps.DeploymentCondition `json:"conditions,omitempty"`
ServiceRef NamespacedName `json:"serviceRef,omitempty"`
StatefulsetRef NamespacedName `json:"statefulsetRef,omitempty"`
Ready bool `json:"ready,omitempty"`
Conditions []apps.DeploymentCondition `json:"conditions,omitempty"`
}

func init() {
Expand Down
18 changes: 16 additions & 2 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 12 additions & 33 deletions config/crd/bases/al-assad.github.io_dorismonitors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -265,23 +265,16 @@ spec:
- type
type: object
type: array
deploymentRef:
properties:
name:
type: string
namespace:
type: string
type: object
pvcRef:
ready:
type: boolean
serviceRef:
properties:
name:
type: string
namespace:
type: string
type: object
ready:
type: boolean
serviceRef:
statefulsetRef:
properties:
name:
type: string
Expand Down Expand Up @@ -317,23 +310,16 @@ spec:
- type
type: object
type: array
deploymentRef:
properties:
name:
type: string
namespace:
type: string
type: object
pvcRef:
ready:
type: boolean
serviceRef:
properties:
name:
type: string
namespace:
type: string
type: object
ready:
type: boolean
serviceRef:
statefulsetRef:
properties:
name:
type: string
Expand Down Expand Up @@ -365,23 +351,16 @@ spec:
- type
type: object
type: array
deploymentRef:
properties:
name:
type: string
namespace:
type: string
type: object
pvcRef:
ready:
type: boolean
serviceRef:
properties:
name:
type: string
namespace:
type: string
type: object
ready:
type: boolean
serviceRef:
statefulsetRef:
properties:
name:
type: string
Expand Down
24 changes: 0 additions & 24 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,6 @@ rules:
- patch
- update
- watch
- apiGroups:
- apps
resources:
- deployments
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- apps
resources:
Expand Down Expand Up @@ -180,18 +168,6 @@ rules:
- patch
- update
- watch
- apiGroups:
- ""
resources:
- persistentvolumeclaims
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
Expand Down
45 changes: 12 additions & 33 deletions deploy/helm/doris-operator/crds/dorismonitor-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -264,23 +264,16 @@ spec:
- type
type: object
type: array
deploymentRef:
properties:
name:
type: string
namespace:
type: string
type: object
pvcRef:
ready:
type: boolean
serviceRef:
properties:
name:
type: string
namespace:
type: string
type: object
ready:
type: boolean
serviceRef:
statefulsetRef:
properties:
name:
type: string
Expand Down Expand Up @@ -316,23 +309,16 @@ spec:
- type
type: object
type: array
deploymentRef:
properties:
name:
type: string
namespace:
type: string
type: object
pvcRef:
ready:
type: boolean
serviceRef:
properties:
name:
type: string
namespace:
type: string
type: object
ready:
type: boolean
serviceRef:
statefulsetRef:
properties:
name:
type: string
Expand Down Expand Up @@ -364,23 +350,16 @@ spec:
- type
type: object
type: array
deploymentRef:
properties:
name:
type: string
namespace:
type: string
type: object
pvcRef:
ready:
type: boolean
serviceRef:
properties:
name:
type: string
namespace:
type: string
type: object
ready:
type: boolean
serviceRef:
statefulsetRef:
properties:
name:
type: string
Expand Down
Loading

0 comments on commit 94139d7

Please sign in to comment.