Skip to content

Commit

Permalink
provided manifest installation without webhook (#1156)
Browse files Browse the repository at this point in the history
* provided manifest installation without webhook

* upgraded binaries
  • Loading branch information
AndrewChubatiuk authored Dec 13, 2024
1 parent d1d50f9 commit 289b149
Show file tree
Hide file tree
Showing 21 changed files with 282 additions and 225 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ jobs:
echo ${{secrets.REPO_KEY}} | docker login --username ${{secrets.REPO_USER}} --password-stdin
make publish
TAG=${TAG} make olm
gh release upload ${{github.event.release.tag_name}} ./dist/install.yaml#install.yaml --clobber || echo "fix me NOT enough security permissions"
gh release upload ${{github.event.release.tag_name}} ./dist/install-no-webhook.yaml#install-no-webhook.yaml --clobber || echo "fix me NOT enough security permissions"
gh release upload ${{github.event.release.tag_name}} ./dist/install-with-webhook.yaml#install-with-webhook.yaml --clobber || echo "fix me NOT enough security permissions"
gh release upload ${{github.event.release.tag_name}} ./config/crd/overlay/crd.yaml#crd.yaml --clobber || echo "fix me NOT enough security permissions"
- name: Prapare binary cache
uses: actions/cache@v4
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ linters:
disable-all: true
enable:
- dupl
- exportloopref
- copyloopvar
- ginkgolinter
- gofmt
- goimports
Expand Down
12 changes: 10 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ COPY go.* .
COPY api/go.* api/
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
RUN \
--mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go mod download

# Copy the go source
COPY cmd/ cmd/
Expand All @@ -26,7 +29,12 @@ ARG BUILDINFO
# 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 \
ENV GOCACHE=/root/.cache/go-build
RUN --mount=type=cache,target="/root/.cache/go-build"
RUN \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/go/pkg/mod \
CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a \
-ldflags="-X 'github.com/VictoriaMetrics/VictoriaMetrics/lib/buildinfo.Version=operator-${BUILDINFO}'" \
-o app ${ROOT}/

Expand Down
21 changes: 11 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ publish:
build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment.
mkdir -p dist
cd config/manager && $(KUSTOMIZE) edit set image manager=$(REGISTRY)/$(ORG)/$(REPO):$(TAG)
$(KUSTOMIZE) build config/base > dist/install.yaml
$(KUSTOMIZE) build config/base > dist/install-no-webhook.yaml
$(KUSTOMIZE) build config/base-with-webhook > dist/install-with-webhook.yaml

olm: operator-sdk opm yq docs
rm -rf bundle*
Expand Down Expand Up @@ -292,7 +293,7 @@ kustomize-set-annotation:
cd $(OVERLAY) && \
$(KUSTOMIZE) edit set annotation $(ANNOTATION)

deploy-kind: OVERLAY=config/base
deploy-kind: OVERLAY=config/base-with-webhook
deploy-kind: REGISTRY=localhost:$(LOCAL_REGISTRY_PORT)
deploy-kind: load-kind docker-push deploy

Expand Down Expand Up @@ -360,15 +361,15 @@ GINKGO_VERSION ?= v2.19.0

## Tool Versions
KUSTOMIZE_VERSION ?= v5.5.0
CONTROLLER_TOOLS_VERSION ?= v0.16.4
CONTROLLER_TOOLS_VERSION ?= v0.16.5
ENVTEST_VERSION ?= release-0.19
GOLANGCI_LINT_VERSION ?= v1.61.0
CODEGENERATOR_VERSION ?= v0.31.1
KIND_VERSION ?= v0.24.0
OLM_VERSION ?= 0.28.0
OPERATOR_SDK_VERSION ?= v1.37.0
OPM_VERSION ?= v1.47.0
YQ_VERSION ?= v4.44.3
GOLANGCI_LINT_VERSION ?= v1.62.2
CODEGENERATOR_VERSION ?= v0.31.4
KIND_VERSION ?= v0.25.0
OLM_VERSION ?= 0.30.0
OPERATOR_SDK_VERSION ?= v1.38.0
OPM_VERSION ?= v1.48.0
YQ_VERSION ?= v4.44.6

ENVCONFIG_DOCS_VERSION ?= 746866a6303f8e7e610d39389aa951b3c0d97123
CRD_REF_DOCS_VERSION ?= latest
Expand Down
8 changes: 8 additions & 0 deletions config/base-with-webhook/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace: vm
namePrefix: vm-
resources:
- ../default-with-webhook
patches:
- path: manager_webhook_patch.yaml
target:
kind: Deployment
File renamed without changes.
6 changes: 2 additions & 4 deletions config/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
namespace: vm
namePrefix: vm-
resources:
- ../default
patches:
- path: manager_webhook_patch.yaml
target:
kind: Deployment
32 changes: 16 additions & 16 deletions config/crd/overlay/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.16.5
name: vlogs.operator.victoriametrics.com
spec:
conversion:
Expand Down Expand Up @@ -1000,7 +1000,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.16.5
name: vmagents.operator.victoriametrics.com
spec:
conversion:
Expand Down Expand Up @@ -5606,7 +5606,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.16.5
name: vmalertmanagerconfigs.operator.victoriametrics.com
spec:
conversion:
Expand Down Expand Up @@ -9532,7 +9532,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.16.5
name: vmalertmanagers.operator.victoriametrics.com
spec:
conversion:
Expand Down Expand Up @@ -11920,7 +11920,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.16.5
name: vmalerts.operator.victoriametrics.com
spec:
conversion:
Expand Down Expand Up @@ -13805,7 +13805,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.16.5
name: vmauths.operator.victoriametrics.com
spec:
conversion:
Expand Down Expand Up @@ -15393,7 +15393,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.16.5
name: vmclusters.operator.victoriametrics.com
spec:
conversion:
Expand Down Expand Up @@ -19528,7 +19528,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.16.5
name: vmnodescrapes.operator.victoriametrics.com
spec:
group: operator.victoriametrics.com
Expand Down Expand Up @@ -20530,7 +20530,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.16.5
name: vmpodscrapes.operator.victoriametrics.com
spec:
group: operator.victoriametrics.com
Expand Down Expand Up @@ -21615,7 +21615,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.16.5
name: vmprobes.operator.victoriametrics.com
spec:
group: operator.victoriametrics.com
Expand Down Expand Up @@ -22763,7 +22763,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.16.5
name: vmrules.operator.victoriametrics.com
spec:
conversion:
Expand Down Expand Up @@ -22995,7 +22995,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.16.5
name: vmscrapeconfigs.operator.victoriametrics.com
spec:
group: operator.victoriametrics.com
Expand Down Expand Up @@ -26959,7 +26959,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.16.5
name: vmservicescrapes.operator.victoriametrics.com
spec:
group: operator.victoriametrics.com
Expand Down Expand Up @@ -28059,7 +28059,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.16.5
name: vmsingles.operator.victoriametrics.com
spec:
conversion:
Expand Down Expand Up @@ -29797,7 +29797,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.16.5
name: vmstaticscrapes.operator.victoriametrics.com
spec:
group: operator.victoriametrics.com
Expand Down Expand Up @@ -30787,7 +30787,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.16.5
name: vmusers.operator.victoriametrics.com
spec:
conversion:
Expand Down
107 changes: 107 additions & 0 deletions config/default-with-webhook/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
namespace: vm
resources:
- ../default
- ../webhook
- ../certmanager
patches:
- path: manager_webhook_patch.yaml
target:
kind: Deployment
- path: webhookcainjection_patch.yaml

# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
# Uncomment the following replacements to add the cert-manager CA injection annotations
# - select:
# kind: MutatingWebhookConfiguration
# fieldPaths:
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
# options:
# delimiter: '/'
# index: 0
# create: true
# - select:
# kind: MutatingWebhookConfiguration
# fieldPaths:
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
# options:
# delimiter: '/'
# index: 1
# create: true
replacements:
- source:
fieldPath: .metadata.namespace
group: cert-manager.io
kind: Certificate
name: serving-cert
version: v1
targets:
- fieldPaths:
- .metadata.annotations.[cert-manager.io/inject-ca-from]
options:
create: true
delimiter: /
select:
kind: ValidatingWebhookConfiguration
- fieldPaths:
- .metadata.annotations.[cert-manager.io/inject-ca-from]
options:
create: true
delimiter: /
select:
kind: CustomResourceDefinition
- source:
fieldPath: .metadata.name
group: cert-manager.io
kind: Certificate
name: serving-cert
version: v1
targets:
- fieldPaths:
- .metadata.annotations.[cert-manager.io/inject-ca-from]
options:
create: true
delimiter: /
index: 1
select:
kind: ValidatingWebhookConfiguration
- fieldPaths:
- .metadata.annotations.[cert-manager.io/inject-ca-from]
options:
create: true
delimiter: /
index: 1
select:
kind: CustomResourceDefinition
- source:
fieldPath: .metadata.name
kind: Service
name: webhook-service
version: v1
targets:
- fieldPaths:
- .spec.dnsNames.0
- .spec.dnsNames.1
options:
create: true
delimiter: .
select:
group: cert-manager.io
kind: Certificate
version: v1
- source:
fieldPath: .metadata.namespace
kind: Service
name: webhook-service
version: v1
targets:
- fieldPaths:
- .spec.dnsNames.0
- .spec.dnsNames.1
options:
create: true
delimiter: .
index: 1
select:
group: cert-manager.io
kind: Certificate
version: v1
File renamed without changes.
Loading

0 comments on commit 289b149

Please sign in to comment.