Skip to content

Commit

Permalink
enable_windows support, automount token support, move webhook config …
Browse files Browse the repository at this point in the history
…to internal/webhook
  • Loading branch information
AndrewChubatiuk committed Mar 5, 2025
1 parent 4c5133d commit 8a10932
Show file tree
Hide file tree
Showing 80 changed files with 3,274 additions and 2,900 deletions.
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ REPODIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
WORKDIR := $(REPODIR)/..

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.30.0
ENVTEST_K8S_VERSION = 1.32.0
PLATFORM = $(shell uname -o)

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
Expand Down Expand Up @@ -364,16 +364,16 @@ GINKGO_BIN ?= $(LOCALBIN)/ginkgo
GINKGO_VERSION ?= v2.19.0

## Tool Versions
KUSTOMIZE_VERSION ?= v5.5.0
CONTROLLER_TOOLS_VERSION ?= v0.16.5
ENVTEST_VERSION ?= release-0.19
KUSTOMIZE_VERSION ?= v5.6.0
CONTROLLER_TOOLS_VERSION ?= v0.17.2
ENVTEST_VERSION ?= release-0.20
GOLANGCI_LINT_VERSION ?= v1.64.6
CODEGENERATOR_VERSION ?= v0.31.4
KIND_VERSION ?= v0.25.0
OLM_VERSION ?= 0.30.0
OPERATOR_SDK_VERSION ?= v1.38.0
OPM_VERSION ?= v1.49.0
YQ_VERSION ?= v4.44.6
CODEGENERATOR_VERSION ?= v0.32.4
KIND_VERSION ?= v0.27.0
OLM_VERSION ?= 0.31.0
OPERATOR_SDK_VERSION ?= v1.39.1
OPM_VERSION ?= v1.51.0
YQ_VERSION ?= v4.45.1

ENVCONFIG_DOCS_VERSION ?= 746866a6303f8e7e610d39389aa951b3c0d97123
CRD_REF_DOCS_VERSION ?= latest
Expand Down
10 changes: 0 additions & 10 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ resources:
path: github.com/VictoriaMetrics/operator/api/operator/v1beta1
version: v1beta1
webhooks:
conversion: false
validation: true
webhookVersion: v1
- api:
Expand All @@ -32,7 +31,6 @@ resources:
path: github.com/VictoriaMetrics/operator/api/operator/v1beta1
version: v1beta1
webhooks:
conversion: false
validation: true
webhookVersion: v1
- api:
Expand All @@ -45,7 +43,6 @@ resources:
path: github.com/VictoriaMetrics/operator/api/operator/v1beta1
version: v1beta1
webhooks:
conversion: false
validation: true
webhookVersion: v1
- api:
Expand All @@ -58,7 +55,6 @@ resources:
path: github.com/VictoriaMetrics/operator/api/operator/v1beta1
version: v1beta1
webhooks:
conversion: false
validation: true
webhookVersion: v1
- api:
Expand All @@ -80,7 +76,6 @@ resources:
path: github.com/VictoriaMetrics/operator/api/operator/v1beta1
version: v1beta1
webhooks:
conversion: false
validation: true
webhookVersion: v1
- api:
Expand All @@ -102,7 +97,6 @@ resources:
path: github.com/VictoriaMetrics/operator/api/operator/v1beta1
version: v1beta1
webhooks:
conversion: false
validation: true
webhookVersion: v1
- api:
Expand All @@ -115,7 +109,6 @@ resources:
path: github.com/VictoriaMetrics/operator/api/operator/v1beta1
version: v1beta1
webhooks:
conversion: false
validation: true
webhookVersion: v1
- api:
Expand Down Expand Up @@ -155,7 +148,6 @@ resources:
path: github.com/VictoriaMetrics/operator/api/operator/v1beta1
version: v1beta1
webhooks:
conversion: false
validation: true
webhookVersion: v1
- api:
Expand All @@ -168,7 +160,6 @@ resources:
path: github.com/VictoriaMetrics/operator/api/operator/v1beta1
version: v1beta1
webhooks:
conversion: false
validation: true
webhookVersion: v1
- api:
Expand All @@ -190,7 +181,6 @@ resources:
path: github.com/VictoriaMetrics/operator/api/operator/v1beta1
version: v1beta1
webhooks:
conversion: false
validation: true
webhookVersion: v1
version: "3"
45 changes: 29 additions & 16 deletions api/operator/v1beta1/vlogs_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ type VLogsSpec struct {
// LivenessProbe that will be added to VLogs pod
*EmbeddedProbes `json:",inline"`

// ServiceAccountName is the name of the ServiceAccount to use to run the pods
// +optional
ServiceAccountName string `json:"serviceAccountName,omitempty"`
*ServiceAccount `json:",inline,omitempty"`
}

// VLogsStatus defines the observed state of VLogs
Expand Down Expand Up @@ -256,37 +254,52 @@ func (r *VLogs) AllLabels() map[string]string {
return labels.Merge(result, selectorLabels)
}

func (r VLogs) PrefixedName() string {
func (r *VLogs) PrefixedName() string {
return fmt.Sprintf("vlogs-%s", r.Name)
}

// GetMetricPath returns prefixed path for metric requests
func (r VLogs) GetMetricPath() string {
func (r *VLogs) GetMetricPath() string {
return buildPathWithPrefixFlag(r.Spec.ExtraArgs, metricPath)
}

// Validate checks if spec is correct
func (r *VLogs) Validate() error {
if r.Spec.ServiceSpec != nil && r.Spec.ServiceSpec.Name == r.PrefixedName() {
return fmt.Errorf("spec.serviceSpec.Name cannot be equal to prefixed name=%q", r.PrefixedName())
}
return nil
}

// GetExtraArgs returns additionally configured command-line arguments
func (r VLogs) GetExtraArgs() map[string]string {
func (r *VLogs) GetExtraArgs() map[string]string {
return r.Spec.ExtraArgs
}

// GetServiceScrape returns overrides for serviceScrape builder
func (r VLogs) GetServiceScrape() *VMServiceScrapeSpec {
func (r *VLogs) GetServiceScrape() *VMServiceScrapeSpec {
return r.Spec.ServiceScrapeSpec
}

func (r VLogs) GetServiceAccountName() string {
if r.Spec.ServiceAccountName == "" {
return r.PrefixedName()
func (r *VLogs) GetServiceAccount() *ServiceAccount {
sa := r.Spec.ServiceAccount
if sa == nil {
sa = &ServiceAccount{
Name: r.PrefixedName(),
AutomountToken: true,
}
}
return r.Spec.ServiceAccountName
return sa
}

func (r VLogs) IsOwnsServiceAccount() bool {
return r.Spec.ServiceAccountName == ""
func (r *VLogs) IsOwnsServiceAccount() bool {
if r.Spec.ServiceAccount != nil && r.Spec.ServiceAccount.Name != "" {
return r.Spec.ServiceAccount.Name == ""
}
return false
}

func (r VLogs) GetNSName() string {
func (r *VLogs) GetNSName() string {
return r.GetNamespace()
}

Expand Down Expand Up @@ -324,8 +337,8 @@ func (r *VLogs) Paused() bool {
func (r *VLogs) SetUpdateStatusTo(ctx context.Context, c client.Client, status UpdateStatus, maybeErr error) error {
return updateObjectStatus(ctx, c, &patchStatusOpts[*VLogs, *VLogsStatus]{
actualStatus: status,
cr: r,
crStatus: &r.Status,
r: r,
rStatus: &r.Status,
maybeErr: maybeErr,
})
}
Expand Down
Loading

0 comments on commit 8a10932

Please # to comment.