Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update recent bugs, fix kubernetes crd #39

Merged
merged 4 commits into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,3 @@ jobs:
tag_with_ref: true
dockerfile: cmd/manager/Dockerfile

# TODO fix it, for some reason it fails with timeout
# - name: Setup Minikube for e2e
# uses: manusa/actions-setup-minikube@v1.0.2
# with:
# minikube version: 'v1.5.2'
# kubernetes version: 'v1.16.0'
# github token: ${{ secrets.GITHUB_TOKEN }}
# - name: exec e2e tests
# env:
# GO111MODULE: on
# E2E_IMAGE: ${{ env.GITHUB_REF_SLUG }}
# SDK_VERSION: "0.17.0"
# run: |
# export PATH=$PATH:$(go env GOPATH)/bin
# export PATH=$PATH:`pwd`
# kubectl get nodes
# curl -L -o operator-sdk "https://github.com/operator-framework/operator-sdk/releases/download/v0.17.0/operator-sdk-v0.17.0-x86_64-linux-gnu"
# chmod +x operator-sdk
# make e2e
8 changes: 7 additions & 1 deletion cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,17 @@ func main() {
if err != nil {
log.Info("Could not create metrics Service", "error", err.Error())
}
//retrieve operator namespace
f41gh7 marked this conversation as resolved.
Show resolved Hide resolved
//only works at kubernetes cluster
operatorNamespace, err := k8sutil.GetOperatorNamespace()
if err != nil {
log.Info("Could not detect operator namespace, not in cluster?", "err", err.Error())
}

// CreateServiceMonitors will automatically create the prometheus-operator ServiceMonitor resources
// necessary to configure Prometheus to scrape metrics from this operator.
services := []*v1.Service{service}
_, err = metrics.CreateServiceMonitors(cfg, namespace, services)
_, err = metrics.CreateServiceMonitors(cfg, operatorNamespace, services)
if err != nil {
log.Info("Could not create ServiceMonitor object", "error", err.Error())
// If this operator is deployed to a cluster without the prometheus-operator running, it will return
Expand Down
32 changes: 16 additions & 16 deletions conf/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ const prefixVar = "VM"

//genvars:true
type BaseOperatorConf struct {
VmAlertDefault struct {
VMAlertDefault struct {
Image string `default:"victoriametrics/vmalert"`
Version string `default:"v1.37.0"`
Port string `default:"8429"`
Port string `default:"8080"`
Resource struct {
Limit struct {
Mem string `default:"500Mi"`
Expand All @@ -34,7 +34,7 @@ type BaseOperatorConf struct {
ConfigReloaderMemory string `default:"25Mi"`
ConfigReloadImage string `default:"jimmidyson/configmap-reload:v0.3.0"`
}
VmAgentDefault struct {
VMAgentDefault struct {
Image string `default:"victoriametrics/vmagent"`
Version string `default:"v1.37.0"`
ConfigReloadImage string `default:"quay.io/coreos/prometheus-config-reloader:v0.30.1"`
Expand All @@ -53,24 +53,24 @@ type BaseOperatorConf struct {
ConfigReloaderMemory string `default:"25Mi"`
}

VmSingleDefault struct {
VMSingleDefault struct {
Image string `default:"victoriametrics/victoria-metrics"`
Version string `default:"v1.37.0"`
Port string `default:"8429"`
Resource struct {
Limit struct {
Mem string `default:"500Mi"`
Cpu string `default:"200m"`
Mem string `default:"1500Mi"`
Cpu string `default:"1200m"`
}
Request struct {
Mem string `default:"200Mi"`
Cpu string `default:"50m"`
Mem string `default:"500Mi"`
Cpu string `default:"150m"`
}
}
ConfigReloaderCPU string `default:"100m"`
ConfigReloaderMemory string `default:"25Mi"`
}
AlertManager struct {
VMAlertManager struct {
ConfigReloaderImage string `default:"jimmidyson/configmap-reload:v0.3.0"`
ConfigReloaderCPU string `default:"100m"`
ConfigReloaderMemory string `default:"25Mi"`
Expand All @@ -85,13 +85,13 @@ type BaseOperatorConf struct {
ClusterDomain string `default:""`
KubeletObject string
}
DisabledServiceMonitorCreation bool `default:"false"`
Host string `default:"0.0.0.0"`
ListenAddress string `default:"0.0.0.0"`
DefaultLabels string `default:"managed-by=vm-operator"`
Labels Labels `ignored:"true"`
LogLevel string
LogFormat string
DisableSelfServiceMonitorCreation bool `default:"false"`
Host string `default:"0.0.0.0"`
ListenAddress string `default:"0.0.0.0"`
DefaultLabels string `default:"managed-by=vm-operator"`
Labels Labels `ignored:"true"`
LogLevel string
LogFormat string
}

func MustGetBaseConfig() *BaseOperatorConf {
Expand Down
7 changes: 0 additions & 7 deletions deploy/crds/monitoring.coreos.com_podmonitors_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ spec:
items:
type: string
type: array
x-kubernetes-list-type: set
type: object
podMetricsEndpoints:
description: A list of endpoints allowed as part of this PodMonitor.
Expand Down Expand Up @@ -103,15 +102,13 @@ spec:
items:
type: string
type: array
x-kubernetes-list-type: set
targetLabel:
description: Label to which the resulting value is written
in a replace action. It is mandatory for replace actions.
Regex capture groups are available.
type: string
type: object
type: array
x-kubernetes-list-type: set
params:
additionalProperties:
items:
Expand Down Expand Up @@ -169,15 +166,13 @@ spec:
items:
type: string
type: array
x-kubernetes-list-type: set
targetLabel:
description: Label to which the resulting value is written
in a replace action. It is mandatory for replace actions.
Regex capture groups are available.
type: string
type: object
type: array
x-kubernetes-list-type: set
scheme:
description: HTTP scheme to use for scraping.
type: string
Expand All @@ -192,14 +187,12 @@ spec:
x-kubernetes-int-or-string: true
type: object
type: array
x-kubernetes-list-type: set
podTargetLabels:
description: PodTargetLabels transfers labels on the Kubernetes Pod
onto the target.
items:
type: string
type: array
x-kubernetes-list-type: set
sampleLimit:
description: SampleLimit defines per-scrape limit on number of scraped
samples that will be accepted.
Expand Down
2 changes: 0 additions & 2 deletions deploy/crds/monitoring.coreos.com_prometheusrules_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,11 @@ spec:
- expr
type: object
type: array
x-kubernetes-list-type: set
required:
- name
- rules
type: object
type: array
x-kubernetes-list-type: set
type: object
required:
- spec
Expand Down
8 changes: 0 additions & 8 deletions deploy/crds/monitoring.coreos.com_servicemonitors_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,13 @@ spec:
items:
type: string
type: array
x-kubernetes-list-type: set
targetLabel:
description: Label to which the resulting value is written
in a replace action. It is mandatory for replace actions.
Regex capture groups are available.
type: string
type: object
type: array
x-kubernetes-list-type: set
params:
additionalProperties:
items:
Expand Down Expand Up @@ -220,15 +218,13 @@ spec:
items:
type: string
type: array
x-kubernetes-list-type: set
targetLabel:
description: Label to which the resulting value is written
in a replace action. It is mandatory for replace actions.
Regex capture groups are available.
type: string
type: object
type: array
x-kubernetes-list-type: set
scheme:
description: HTTP scheme to use for scraping.
type: string
Expand Down Expand Up @@ -370,7 +366,6 @@ spec:
type: object
type: object
type: array
x-kubernetes-list-type: set
jobLabel:
description: The label to use to retrieve the job name from.
type: string
Expand All @@ -387,15 +382,13 @@ spec:
items:
type: string
type: array
x-kubernetes-list-type: set
type: object
podTargetLabels:
description: PodTargetLabels transfers labels on the Kubernetes Pod
onto the target.
items:
type: string
type: array
x-kubernetes-list-type: set
sampleLimit:
description: SampleLimit defines per-scrape limit on number of scraped
samples that will be accepted.
Expand Down Expand Up @@ -450,7 +443,6 @@ spec:
items:
type: string
type: array
x-kubernetes-list-type: set
required:
- endpoints
- selector
Expand Down
Loading