Skip to content

Commit

Permalink
Merge pull request #101 from topolvm/add-separate-metrics-for-pv-prov…
Browse files Browse the repository at this point in the history
…ision-and-mounting

Separate probes for PV provisioning and mounting
  • Loading branch information
satoru-takeuchi authored Feb 27, 2024
2 parents 4ed3fe5 + 23a2ee4 commit 24f8469
Show file tree
Hide file tree
Showing 49 changed files with 2,581 additions and 28 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ COPY go.sum go.sum
RUN go mod download

# Copy the go source
COPY api api
COPY cmd cmd
COPY constants constants
COPY internal internal
COPY main.go main.go
COPY metrics metrics
COPY probe probe
COPY types types
Expand All @@ -25,7 +25,7 @@ COPY types types
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o pie main.go
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o pie ./cmd

FROM ubuntu:20.04

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ test: manifests generate fmt vet envtest ## Run tests.

.PHONY: build
build: manifests generate fmt vet ## Build manager binary.
go build -o bin/manager ./main.go
go build -o bin/manager ./cmd

.PHONY: run
run: manifests generate fmt vet ## Run a controller from your host.
go run ./main.go
go run ./cmd

# If you wish built the manager image targeting other platforms you can use the --platform flag.
# (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it.
Expand Down
10 changes: 10 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
domain: topolvm.io
layout:
- go.kubebuilder.io/v4
multigroup: true
projectName: pie
repo: github.com/topolvm/pie
resources:
Expand All @@ -19,4 +20,13 @@ resources:
kind: StorageClass
path: k8s.io/api/storage/v1
version: v1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: topolvm.io
group: pie
kind: PieProbe
path: github.com/topolvm/pie/api/pie/v1alpha1
version: v1alpha1
version: "3"
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,42 @@ IO latency of read.
TYPE: gauge

### `pie_create_probe_total`
The number of attempts that the creation of the Pod object and the creation of the container.
The number of attempts of the creation of the Pod object and the creation of the container.

TYPE: counter

### `pie_performance_probe_total`
The number of attempts that the creation of the Pod object and the creation of the container.
The number of attempts of performing the IO benchmarks.

TYPE: counter

### `pie_io_write_latency_on_mount_probe_seconds`

_Experimental metrics._ IO latency of write, benchmarked on mount-probe Pods.

TYPE: gauge

### `pie_io_read_latency_on_mount_probe_seconds`

_Experimental metrics._ IO latency of read, benchmarked on mount-probe Pods.

TYPE: gauge

### `pie_mount_probe_total`

_Experimental metrics._ The number of attempts of the creation of the mount-probe Pod object and the creation of the container.

TYPE: counter

### `pie_performance_on_mount_probe_total`

_Experimental metrics._ The number of attempts of performing the IO benchmarks on mount-probe Pods.

TYPE: counter

### `pie_provision_probe_total`

_Experimental metrics._ The number of attempts of the creation of the provision-probe Pod object and the creation of the container.

TYPE: counter

Expand Down
20 changes: 20 additions & 0 deletions api/pie/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Package v1alpha1 contains API Schema definitions for the pie v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=pie.topolvm.io
package v1alpha1

import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "pie.topolvm.io", Version: "v1alpha1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)
54 changes: 54 additions & 0 deletions api/pie/v1alpha1/pieprobe_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package v1alpha1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// PieProbeSpec defines the desired state of PieProbe
type PieProbeSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="monitoringStorageClass is immutable"
MonitoringStorageClass string `json:"monitoringStorageClass"`

NodeSelector corev1.NodeSelector `json:"nodeSelector"`
ProbePeriod int `json:"probePeriod"`
ProbeThreshold string `json:"probeThreshold"`
}

// PieProbeStatus defines the observed state of PieProbe
type PieProbeStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// PieProbe is the Schema for the pieprobes API
type PieProbe struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec PieProbeSpec `json:"spec,omitempty"`
Status PieProbeStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// PieProbeList contains a list of PieProbe
type PieProbeList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []PieProbe `json:"items"`
}

func init() {
SchemeBuilder.Register(&PieProbe{}, &PieProbeList{})
}
99 changes: 99 additions & 0 deletions api/pie/v1alpha1/zz_generated.deepcopy.go

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

Loading

0 comments on commit 24f8469

Please sign in to comment.