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

Add prometheus metrics to CSI external-resizer using new csi-lib-utils library #67

Merged
merged 2 commits into from
Jan 3, 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ Note that the external-resizer does not scale with more replicas. Only one exter

* `--workers <num>`: Number of simultaneously running `ControllerExpandVolume` operations. Default value is `10`.

* `--metrics-address`: The TCP network address where the prometheus metrics endpoint will run (example: `:8080` which corresponds to port 8080 on local host). The default is empty string, which means metrics endpoint is disabled.

* `--metrics-path`: The HTTP path where prometheus metrics will be exposed. Default is `/metrics`.

#### Other recognized arguments

* `--kubeconfig <path>`: Path to Kubernetes client configuration that the external-resizer uses to connect to Kubernetes API server. When omitted, default token provided by Kubernetes will be used. This option is useful only when the external-resizer does not run as a Kubernetes pod, e.g. for debugging. Either this or `--master` needs to be set if the external-resizer is being run out of cluster.
Expand Down
11 changes: 10 additions & 1 deletion cmd/csi-resizer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ var (
enableLeaderElection = flag.Bool("leader-election", false, "Enable leader election.")
leaderElectionNamespace = flag.String("leader-election-namespace", "", "Namespace where the leader election resource lives. Defaults to the pod namespace if not set.")

metricsAddress = flag.String("metrics-address", "", "The TCP network address where the prometheus metrics endpoint will listen (example: `:8080`). The default is empty string, which means metrics endpoint is disabled.")
metricsPath = flag.String("metrics-path", "/metrics", "The HTTP path where prometheus metrics will be exposed. Default is `/metrics`.")

version = "unknown"
)

Expand All @@ -67,7 +70,13 @@ func main() {

informerFactory := informers.NewSharedInformerFactory(kubeClient, *resyncPeriod)

csiResizer, err := resizer.NewResizer(*csiAddress, *csiTimeout, kubeClient, informerFactory)
csiResizer, err := resizer.NewResizer(
*csiAddress,
*csiTimeout,
kubeClient,
informerFactory,
*metricsAddress,
*metricsPath)
if err != nil {
klog.Fatal(err.Error())
}
Expand Down
80 changes: 29 additions & 51 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,77 +3,55 @@ module github.com/kubernetes-csi/external-resizer
go 1.12

require (
github.com/container-storage-interface/spec v0.0.0-20190314210110-c3707a60a2d4
github.com/evanphx/json-patch v4.1.0+incompatible // indirect
github.com/gogo/protobuf v1.2.1 // indirect
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect
github.com/golang/protobuf v1.3.1 // indirect
github.com/googleapis/gnostic v0.2.0 // indirect
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/container-storage-interface/spec v1.1.0
github.com/imdario/mergo v0.3.7 // indirect
github.com/json-iterator/go v1.1.6 // indirect
github.com/kubernetes-csi/csi-lib-utils v0.6.1
github.com/spf13/pflag v1.0.3 // indirect
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c // indirect
golang.org/x/sys v0.0.0-20190329044733-9eb1bfa1ce65 // indirect
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
google.golang.org/genproto v0.0.0-20190327125643-d831d65fe17d // indirect
google.golang.org/grpc v1.19.1
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.2.2 // indirect
k8s.io/api v0.0.0-20190918195907-bd6ac527cfd2
k8s.io/apimachinery v0.0.0-20190817020851-f2f3a405f61d
k8s.io/client-go v0.0.0-20190918200256-06eb1244587a
k8s.io/csi-translation-lib v0.0.0-20190918203248-97c07dcbb623
k8s.io/klog v0.3.1
k8s.io/kube-openapi v0.0.0-20190320154901-5e45bb682580 // indirect
k8s.io/utils v0.0.0-20190308190857-21c4ce38f2a7 // indirect
github.com/kubernetes-csi/csi-lib-utils v0.7.0
google.golang.org/grpc v1.26.0
k8s.io/api v0.17.0
k8s.io/apimachinery v0.17.1-beta.0
k8s.io/client-go v0.17.0
k8s.io/csi-translation-lib v0.17.0
k8s.io/klog v1.0.0
)

replace k8s.io/api => k8s.io/api v0.0.0-20190918195907-bd6ac527cfd2
replace k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.17.0

replace k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.0.0-20190918201827-3de75813f604
replace k8s.io/apiserver => k8s.io/apiserver v0.17.0

replace k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190817020851-f2f3a405f61d
replace k8s.io/cli-runtime => k8s.io/cli-runtime v0.17.0

replace k8s.io/apiserver => k8s.io/apiserver v0.0.0-20190918200908-1e17798da8c1
replace k8s.io/cloud-provider => k8s.io/cloud-provider v0.17.0

replace k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20190918202139-0b14c719ca62
replace k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.17.0

replace k8s.io/client-go => k8s.io/client-go v0.0.0-20190918200256-06eb1244587a
replace k8s.io/code-generator => k8s.io/code-generator v0.17.1-beta.0

replace k8s.io/cloud-provider => k8s.io/cloud-provider v0.0.0-20190918203125-ae665f80358a
replace k8s.io/component-base => k8s.io/component-base v0.17.0

replace k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.0.0-20190918202959-c340507a5d48
replace k8s.io/cri-api => k8s.io/cri-api v0.17.1-beta.0

replace k8s.io/code-generator => k8s.io/code-generator v0.0.0-20190612205613-18da4a14b22b
replace k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.17.0

replace k8s.io/component-base => k8s.io/component-base v0.0.0-20190918200425-ed2f0867c778
replace k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.17.0

replace k8s.io/cri-api => k8s.io/cri-api v0.0.0-20190817025403-3ae76f584e79
replace k8s.io/kube-proxy => k8s.io/kube-proxy v0.17.0

replace k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.0.0-20190918203248-97c07dcbb623

replace k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.0.0-20190918201136-c3a845f1fbb2

replace k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.0.0-20190918202837-c54ce30c680e
replace k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.17.0

replace k8s.io/kube-proxy => k8s.io/kube-proxy v0.0.0-20190918202429-08c8357f8e2d
replace k8s.io/kubectl => k8s.io/kubectl v0.17.0

replace k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.0.0-20190918202713-c34a54b3ec8e
replace k8s.io/kubelet => k8s.io/kubelet v0.17.0

replace k8s.io/kubectl => k8s.io/kubectl v0.0.0-20190602132728-7075c07e78bf
replace k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.17.0

replace k8s.io/kubelet => k8s.io/kubelet v0.0.0-20190918202550-958285cf3eef
replace k8s.io/metrics => k8s.io/metrics v0.17.0

replace k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.0.0-20190918203421-225f0541b3ea
replace k8s.io/node-api => k8s.io/node-api v0.17.0

replace k8s.io/metrics => k8s.io/metrics v0.0.0-20190918202012-3c1ca76f5bda
replace k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.17.0

replace k8s.io/node-api => k8s.io/node-api v0.0.0-20190918203548-2c4c2679bece
replace k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.17.0

replace k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.0.0-20190918201353-5cc279503896
replace k8s.io/sample-controller => k8s.io/sample-controller v0.17.0

replace k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.0.0-20190918202305-ed68a9f09ae1

replace k8s.io/sample-controller => k8s.io/sample-controller v0.0.0-20190918201537-fabef0de90df
replace k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.0.0-20190918203248-97c07dcbb623
Loading