Skip to content

Commit

Permalink
refine prometheus inspect
Browse files Browse the repository at this point in the history
Signed-off-by: pixiake <[email protected]>
  • Loading branch information
pixiake committed Jan 6, 2025
1 parent 2c5aa31 commit 6a592e8
Show file tree
Hide file tree
Showing 59 changed files with 636 additions and 3,146 deletions.
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,7 @@ runke:

.PHONY: generate-client
generate-client:
./hack/generate_group.sh client,lister,informer github.com/kubesphere/kubeeye/clients github.com/kubesphere/kubeeye/apis "kubeeye:v1alpha2" --output-base=./ -h ./hack/boilerplate.go.txt -v 10
rm -rf ./clients
mv github.com/kubesphere/kubeeye/clients ./
rm -rf ./github.com

./hack/update-codegen.sh

LOCALBIN = $(shell pwd)/bin
HELMIFY ?= $(LOCALBIN)/helmify
Expand Down
50 changes: 37 additions & 13 deletions apis/kubeeye/v1alpha2/inspectrule_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,19 @@ type InspectRuleSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

ComponentExclude []string `json:"componentExclude,omitempty"`
PrometheusEndpoint string `json:"prometheusEndpoint,omitempty"`
Opas []OpaRule `json:"opas,omitempty"`
Prometheus []PrometheusRule `json:"prometheus,omitempty"`
FileChange []FileChangeRule `json:"fileChange,omitempty" `
Sysctl []SysRule `json:"sysctl,omitempty"`
Systemd []SysRule `json:"systemd,omitempty"`
FileFilter []FileFilterRule `json:"fileFilter,omitempty"`
CustomCommand []CustomCommandRule `json:"customCommand,omitempty"`
NodeInfo []NodeInfoRule `json:"nodeInfo,omitempty"`
ServiceConnect []ServiceConnectRule `json:"serviceConnect,omitempty"`
ComponentExclude []string `json:"componentExclude,omitempty"`
Opas []OpaRule `json:"opas,omitempty"`
Prometheus *PrometheusConfig `json:"prometheus,omitempty"`
PromQL []PrometheusRule `json:"promQL,omitempty"`
FileChange []FileChangeRule `json:"fileChange,omitempty" `
Sysctl []SysRule `json:"sysctl,omitempty"`
Systemd []SysRule `json:"systemd,omitempty"`
FileFilter []FileFilterRule `json:"fileFilter,omitempty"`
CustomCommand []CustomCommandRule `json:"customCommand,omitempty"`
NodeInfo []NodeInfoRule `json:"nodeInfo,omitempty"`
ServiceConnect []ServiceConnectRule `json:"serviceConnect,omitempty"`
}

type RuleItemBases struct {
Name string `json:"name,omitempty"`
Rule string `json:"rule,omitempty"`
Expand Down Expand Up @@ -82,8 +83,15 @@ type OpaRule struct {
}
type PrometheusRule struct {
RuleItemBases `json:",inline"`
Endpoint string `json:"endpoint,omitempty"`
RawDataEnabled bool `json:"rawDataEnabled,omitempty"`
Prometheus *PrometheusConfig `json:"prometheus,omitempty"`
RawDataEnabled bool `json:"rawDataEnabled,omitempty"`
}

type PrometheusConfig struct {
Endpoint string `json:"endpoint,omitempty"`
BasicToken *string `json:"basicToken,omitempty"`
BearerToken *string `json:"bearerToken,omitempty"`
InsecureSkipVerify *bool `json:"insecureSkipVerify,omitempty"`
}

type FileChangeRule struct {
Expand Down Expand Up @@ -143,3 +151,19 @@ type InspectRuleList struct {
func init() {
SchemeBuilder.Register(&InspectRule{}, &InspectRuleList{})
}

func (p *PrometheusConfig) GetBasicToken() string {
if p.BasicToken == nil {
return ""
} else {
return *p.BasicToken
}
}

func (p *PrometheusConfig) GetBearerToken() string {
if p.BearerToken == nil {
return ""
} else {
return *p.BearerToken
}
}
44 changes: 43 additions & 1 deletion apis/kubeeye/v1alpha2/zz_generated.deepcopy.go

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

4 changes: 2 additions & 2 deletions build/apiserver/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# Build the manager binary
FROM golang:1.22 AS builder
FROM golang:1.23 AS builder

#RUN #go env -w GOPROXY=https://goproxy.cn,direct
# Run this with docker build --build_arg $(go env GOPROXY) to override the goproxy
Expand Down Expand Up @@ -30,7 +30,7 @@ RUN go mod tidy && go mod vendor
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETPLATFORM} go build -o /workspace/apiserver ./cmd/apiserver


FROM alpine:3.19
FROM alpine:3.21

WORKDIR /

Expand Down
4 changes: 2 additions & 2 deletions build/controller/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.22 AS builder
FROM golang:1.23 AS builder

#ARG goproxy=https://goproxy.cn,direct
#ENV GOPROXY=$goproxy
Expand All @@ -26,7 +26,7 @@ ENV CGO_ENABLED=0
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETPLATFORM} go build -o /workspace/controller ./cmd/ke-manager/main.go

FROM alpine:3.19 AS ke-manager
FROM alpine:3.21 AS ke-manager

WORKDIR /kubeeye

Expand Down
4 changes: 2 additions & 2 deletions build/job/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# Build the manager binary
FROM golang:1.22 AS builder
FROM golang:1.23 AS builder

#RUN #go env -w GOPROXY=https://goproxy.cn,direct
# Run this with docker build --build_arg $(go env GOPROXY) to override the goproxy
Expand Down Expand Up @@ -30,7 +30,7 @@ RUN go mod tidy && go mod vendor
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETPLATFORM} go build -o /workspace/ke ./cmd/ke


FROM alpine:3.19
FROM alpine:3.21

WORKDIR /

Expand Down
26 changes: 23 additions & 3 deletions chart/kubeeye/crds/kubeeye.kubesphere.io_inspectrules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,23 +144,43 @@ spec:
type: string
type: object
type: array
prometheus:
promQL:
items:
properties:
desc:
type: string
endpoint:
type: string
level:
type: string
name:
type: string
prometheus:
properties:
basicToken:
type: string
bearerToken:
type: string
endpoint:
type: string
insecureSkipVerify:
type: boolean
type: object
rawDataEnabled:
type: boolean
rule:
type: string
type: object
type: array
prometheus:
properties:
basicToken:
type: string
bearerToken:
type: string
endpoint:
type: string
insecureSkipVerify:
type: boolean
type: object
prometheusEndpoint:
type: string
serviceConnect:
Expand Down
120 changes: 0 additions & 120 deletions clients/clientset/versioned/clientset.go

This file was deleted.

19 changes: 0 additions & 19 deletions clients/clientset/versioned/doc.go

This file was deleted.

Loading

0 comments on commit 6a592e8

Please sign in to comment.