Skip to content

Commit 0bbee31

Browse files
authored
refactor: clean the config and fix the manifests generation
1 parent 8b8c175 commit 0bbee31

65 files changed

Lines changed: 672 additions & 42782 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ testbin/
2626
.DS_Store
2727
.envrc
2828
charts/fluent-operator.tgz
29+
30+
.cache
31+
.claude

Makefile

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ SHELL = /usr/bin/env bash -o pipefail
88

99
VERSION ?= $(shell cat version.txt | tr -d " \t\n\r")
1010
FB_VERSION?=$(shell grep -v '^#' cmd/fluent-watcher/fluentbit/VERSION | tr -d " \t\n\r")
11+
FD_VERSION?=$(shell grep -v '^#' cmd/fluent-watcher/fluentd/VERSION | tr -d " \t\n\r")
1112
# Image URL to use all building/pushing image targets
1213
FB_IMG ?= ghcr.io/fluent/fluent-operator/fluent-bit:v${FB_VERSION}
1314
FB_IMG_DEBUG ?= ghcr.io/fluent/fluent-operator/fluent-bit:v${FB_VERSION}-debug
14-
FD_IMG ?= ghcr.io/fluent/fluent-operator/fluentd:v1.19.2
15-
FO_IMG ?= kubesphere/fluent-operator:$(VERSION)
15+
FD_IMG ?= ghcr.io/fluent/fluent-operator/fluentd:v${FD_VERSION}
16+
FO_IMG ?= ghcr.io/fluent/fluent-operator/fluent-operator:$(VERSION)
1617

1718
ARCH ?= arm64
1819

@@ -51,16 +52,20 @@ help: ## Display this help.
5152
shellcheck:
5253
@find . -type f -name *.sh -exec docker run --rm -v $(shell pwd):/mnt koalaman/shellcheck:stable {} +
5354

55+
MANIFEST_PATHS := ./apis/fluentbit/...;./apis/fluentd/...;./controllers/...
56+
5457
.PHONY: manifests
5558
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
56-
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./apis/fluentbit/..." output:crd:artifacts:config=config/crd/bases
57-
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./apis/fluentd/..." output:crd:artifacts:config=config/crd/bases
58-
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./apis/fluentbit/..." output:crd:artifacts:config=charts/fluent-operator/crds
59-
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./apis/fluentd/..." output:crd:artifacts:config=charts/fluent-operator/crds
60-
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./apis/fluentbit/..." output:crd:artifacts:config=charts/fluent-operator-fluent-bit-crds/templates
61-
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./apis/fluentd/..." output:crd:artifacts:config=charts/fluent-operator-fluentd-crds/templates
62-
kubectl kustomize config/crd/bases/ | sed -e '/creationTimestamp/d' > manifests/setup/fluent-operator-crd.yaml
63-
kubectl kustomize manifests/setup/ | sed -e '/creationTimestamp/d' > manifests/setup/setup.yaml
59+
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=fluent-operator webhook \
60+
paths="$(MANIFEST_PATHS)" \
61+
output:crd:artifacts:config=config/crd/bases
62+
$(CONTROLLER_GEN) $(CRD_OPTIONS) paths="$(MANIFEST_PATHS)" \
63+
output:crd:artifacts:config=charts/fluent-operator/crds
64+
$(CONTROLLER_GEN) $(CRD_OPTIONS) paths="./apis/fluentbit/...;./controllers/..." \
65+
output:crd:artifacts:config=charts/fluent-operator-fluent-bit-crds/templates
66+
$(CONTROLLER_GEN) $(CRD_OPTIONS) paths="./apis/fluentd/...;./controllers/..." \
67+
output:crd:artifacts:config=charts/fluent-operator-fluentd-crds/templates
68+
kubectl kustomize config/default/ | sed -e '/creationTimestamp/d' > manifests/setup/setup.yaml
6469
hack/mutate-crds.sh
6570

6671
.PHONY: generate
@@ -135,7 +140,7 @@ build: generate fmt vet ## Build manager binary.
135140
go build -o bin/fd-watcher ./cmd/fluent-watcher/fluentd
136141

137142
run: manifests generate fmt vet ## Run a controller from your host.
138-
go run cmd/fluent-manager/main.go
143+
go run ./cmd/fluent-manager/
139144

140145
# Build amd64/arm64 Fluent Operator container image
141146
.PHONY: build-op
@@ -200,10 +205,10 @@ push-amd64:
200205
##@ Deployment
201206

202207
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
203-
$(KUSTOMIZE) build config/crd/bases/ | kubectl create -f -
208+
$(KUSTOMIZE) build config/crd/ | kubectl create -f -
204209

205210
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
206-
$(KUSTOMIZE) build config/crd/bases/ | kubectl delete -f -
211+
$(KUSTOMIZE) build config/crd/ | kubectl delete -f -
207212

208213
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
209214
kubectl create -f manifests/setup/setup.yaml

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ Kubernetes v1.16.13+ is necessary for running Fluent Operator.
133133
Install the latest stable version
134134

135135
```shell
136+
kubectl create namespace fluent
136137
kubectl apply -f https://github.com/fluent/fluent-operator/releases/latest/download/setup.yaml
137138

138139
# You can change the namespace in manifests/setup/kustomization.yaml
@@ -143,6 +144,7 @@ kubectl apply -f https://github.com/fluent/fluent-operator/releases/latest/downl
143144
Install the development version
144145

145146
```shell
147+
kubectl create namespace fluent
146148
kubectl apply -f https://raw.githubusercontent.com/fluent/fluent-operator/master/manifests/setup/setup.yaml
147149

148150
# You can change the namespace in manifests/setup/kustomization.yaml

cmd/fluent-manager/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} GO111MODULE=on go build
2626
FROM gcr.io/distroless/static:nonroot
2727
WORKDIR /
2828
COPY --from=builder /workspace/manager .
29-
USER nonroot:nonroot
29+
USER 65532:65532
3030

3131
ENTRYPOINT ["/manager"]

config/certmanager/certificate-metrics.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

config/certmanager/certificate-webhook.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

config/certmanager/issuer.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

config/certmanager/kustomization.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

config/certmanager/kustomizeconfig.yaml

Lines changed: 0 additions & 8 deletions
This file was deleted.

config/crd/bases/kustomization.yaml

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)