Skip to content

Commit bfd8651

Browse files
authored
Merge pull request #639 from stakater/sa-7353-remove-kube-rbac-proxy
Removed kube-rbac-proxy and upgraded to operator-sdk 1.39.2
2 parents dff447a + 921763a commit bfd8651

Some content is hidden

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

46 files changed

+664
-858
lines changed

.github/workflows/push.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ on:
1414
env:
1515
DOCKER_FILE_PATH: Dockerfile
1616
BUNDLE_DOCKER_FILE_PATH: bundle.Dockerfile
17-
GOLANG_VERSION: 1.21
18-
OPERATOR_SDK_VERSION: "1.19.0"
19-
KUSTOMIZE_VERSION: "4.5.7"
17+
GOLANG_VERSION: 1.22
18+
OPERATOR_SDK_VERSION: "1.39.2"
19+
KUSTOMIZE_VERSION: "5.4.3"
2020
KUBERNETES_VERSION: "1.23.5"
2121
KIND_VERSION: "v0.17.0"
2222
HELM_REGISTRY_URL: "https://stakater.github.io/stakater-charts"

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM golang:1.21 as builder
2+
FROM golang:1.22 AS builder
33

44
WORKDIR /workspace
55
# Copy the Go Modules manifests
@@ -10,13 +10,14 @@ COPY go.sum go.sum
1010
RUN go mod download
1111

1212
# Copy the go source
13-
COPY main.go main.go
13+
COPY cmd/main.go cmd/main.go
1414
COPY api/ api/
1515
COPY pkg/ pkg/
16+
COPY internal/ internal/
1617

1718
# Build
1819
ARG TARGETARCH
19-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH GO111MODULE=on go build -mod=mod -a -o manager main.go
20+
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go
2021

2122
# Use distroless as minimal base image to package the manager binary
2223
# Refer to https://github.com/GoogleContainerTools/distroless for more details

Makefile

Lines changed: 63 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ ifeq ($(USE_IMAGE_DIGESTS), true)
4747
endif
4848

4949
# Image URL to use all building/pushing image targets
50-
IMG ?= controller:latest
50+
IMG ?= stakater/ingressmonitorcontroller:v2.2.4
5151

5252
# GOLANGCI_LINT env
5353
GOLANGCI_LINT = _output/tools/golangci-lint
@@ -100,44 +100,67 @@ vet: ## Run go vet against code.
100100
go vet ./...
101101

102102
ENVTEST_ASSETS_DIR = $(shell pwd)/testbin
103+
ENVTEST_K8S_VERSION = 1.31.0
103104
.PHONY: test
104105
test: generate fmt vet manifests envtest
105106
$(ENVTEST) use -p path 1.28.x!
106-
go test ./... -count=1 -coverprofile cover.out
107+
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out,
108+
107109

108110
##@ Build
109111

110-
build: generate fmt vet ## Build manager binary.
111-
go build -o bin/manager main.go
112+
.PHONY: build
113+
build: manifests generate fmt vet ## Build manager binary.
114+
go build -o bin/manager cmd/main.go
112115

116+
.PHONY: run
113117
run: manifests generate fmt vet ## Run a controller from your host.
114-
go run ./main.go
118+
go run ./cmd/main.go
115119

116120
docker-build: test ## Build docker image with the manager.
117121
docker build -t ${IMG} .
118122

119123
docker-push: ## Push docker image with the manager.
120124
docker push ${IMG}
121125

126+
# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
127+
# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
128+
# - able to use docker buildx . More info: https://docs.docker.com/build/buildx/
129+
# - have enable BuildKit, More info: https://docs.docker.com/develop/develop-images/build_enhancements/
130+
# - be able to push the image for your registry (i.e. if you do not inform a valid value via IMG=<myregistry/image:<tag>> than the export will fail)
131+
# To properly provided solutions that supports more than one platform you should use this option.
132+
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
133+
.PHONY: docker-buildx
134+
docker-buildx: ## Build and push docker image for the manager for cross-platform support
135+
- docker buildx create --name project-v3-builder
136+
docker buildx use project-v3-builder
137+
- docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile .
138+
- docker buildx rm project-v3-builder
122139

123140
ifndef ignore-not-found
124141
ignore-not-found = false
125142
endif
126143

144+
.PHONY: build-installer
145+
build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment.
146+
mkdir -p dist
147+
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
148+
$(KUSTOMIZE) build config/default > dist/install.yaml
149+
127150
##@ Deployment
128151

129152
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
130-
$(KUSTOMIZE) build config/crd | kubectl apply -f -
153+
$(KUSTOMIZE) build config/crd | $(KUBECTL) apply -f -
131154

132155
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
133-
$(KUSTOMIZE) build config/crd | kubectl delete -f - --ignore-not-found=$(ignore-not-found)
156+
$(KUSTOMIZE) build config/crd | $(KUBECTL) delete -f - --ignore-not-found=$(ignore-not-found)
134157

135158
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
136159
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
137-
$(KUSTOMIZE) build config/default | kubectl apply -f -
160+
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -
138161

139162
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
140-
$(KUSTOMIZE) build config/default | kubectl delete -f - --ignore-not-found=$(ignore-not-found)
163+
$(KUSTOMIZE) build config/default | $(KUBECTL) delete -f - --ignore-not-found=$(ignore-not-found)
141164

142165

143166
##@ Build Dependencies
@@ -148,29 +171,53 @@ $(LOCALBIN):
148171
mkdir -p $(LOCALBIN)
149172

150173
## Tool Binaries
174+
KUBECTL ?= kubectl
151175
KUSTOMIZE ?= $(LOCALBIN)/kustomize
152176
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
153177
ENVTEST ?= $(LOCALBIN)/setup-envtest
178+
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
154179

155180
## Tool Versions
156-
KUSTOMIZE_VERSION ?= v3.8.7
157-
CONTROLLER_TOOLS_VERSION ?= v0.9.0
181+
KUSTOMIZE_VERSION ?= v5.4.3
182+
CONTROLLER_TOOLS_VERSION ?= v0.16.1
183+
ENVTEST_VERSION ?= release-0.19
184+
GOLANGCI_LINT_VERSION ?= v1.59.1
158185

159-
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
160186
.PHONY: kustomize
161187
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
162188
$(KUSTOMIZE): $(LOCALBIN)
163-
@[ -f $(LOCALBIN)/kustomize ] || curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN)
189+
$(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v5,$(KUSTOMIZE_VERSION))
164190

165191
.PHONY: controller-gen
166192
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
167193
$(CONTROLLER_GEN): $(LOCALBIN)
168-
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
194+
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION))
169195

170196
.PHONY: envtest
171-
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
197+
envtest: $(ENVTEST) ## Download setup-envtest locally if necessary.
172198
$(ENVTEST): $(LOCALBIN)
173-
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
199+
$(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest,$(ENVTEST_VERSION))
200+
201+
.PHONY: golangci-lint
202+
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
203+
$(GOLANGCI_LINT): $(LOCALBIN)
204+
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
205+
206+
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
207+
# $1 - target path with name of binary (ideally with version)
208+
# $2 - package url which can be installed
209+
# $3 - specific version of package
210+
define go-install-tool
211+
@[ -f "$(1)-$(3)" ] || { \
212+
set -e; \
213+
package=$(2)@$(3) ;\
214+
echo "Downloading $${package}" ;\
215+
rm -f $(1) || true ;\
216+
GOBIN=$(LOCALBIN) go install $${package} ;\
217+
mv $(1) $(1)-$(3) ;\
218+
} ;\
219+
ln -sf $(1)-$(3) $(1)
220+
endef
174221

175222
.PHONY: bundle
176223
bundle: manifests kustomize ## Generate bundle manifests and metadata, then validate generated files.
@@ -228,9 +275,6 @@ catalog-build: opm ## Build a catalog image.
228275
catalog-push: ## Push a catalog image.
229276
$(MAKE) docker-push IMG=$(CATALOG_IMG)
230277

231-
$(GOLANGCI_LINT):
232-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(dir $@) $(GOLANGCI_LINT_VERSION)
233-
234278
verify-golangci-lint: $(GOLANGCI_LINT)
235279
GOLANGCI_LINT_CACHE=$(GOLANGCI_LINT_CACHE) $(GOLANGCI_LINT) run --timeout=300s ./...
236280

PROJECT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
domain: stakater.com
22
layout:
3-
- go.kubebuilder.io/v3
3+
- go.kubebuilder.io/v4
44
plugins:
55
manifests.sdk.operatorframework.io/v2: {}
66
scorecard.sdk.operatorframework.io/v2: {}

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,6 @@ Join and talk to us on the #tools-ingressmonitor channel for discussing the Ingr
172172
[![Join Slack](https://stakater.github.io/README/stakater-join-slack-btn.png)](https://slack.stakater.com/)
173173
[![Chat](https://stakater.github.io/README/stakater-chat-btn.png)](https://stakater-community.slack.com/messages/CA66MMYSE)
174174

175-
## Known Issues
176-
177-
- Latest image of kube-rbac-proxy fails on openshift with permission issues. To resolve use `registry.redhat.io/openshift4/ose-kube-rbac-proxy:v4.7.0` instead of kube-rbac-proxy. This issue can be tracked [here](https://github.com/operator-framework/operator-sdk/issues/4684).
178-
179175
## License
180176

181177
Apache2 © [Stakater][website]

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
77
LABEL operators.operatorframework.io.bundle.package.v1=ingressmonitorcontroller
88
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
99
LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha
10-
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.18.0+git
10+
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.39.2
1111
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
12-
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
12+
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v4
1313

1414
# Labels for testing.
1515
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1

bundle/manifests/endpointmonitor.stakater.com_endpointmonitors.yaml

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
44
annotations:
5-
controller-gen.kubebuilder.io/version: v0.9.0
5+
controller-gen.kubebuilder.io/version: v0.16.1
66
creationTimestamp: null
77
name: endpointmonitors.endpointmonitor.stakater.com
88
spec:
@@ -20,14 +20,19 @@ spec:
2020
description: EndpointMonitor is the Schema for the endpointmonitors API
2121
properties:
2222
apiVersion:
23-
description: 'APIVersion defines the versioned schema of this representation
24-
of an object. Servers should convert recognized schemas to the latest
25-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
23+
description: |-
24+
APIVersion defines the versioned schema of this representation of an object.
25+
Servers should convert recognized schemas to the latest internal value, and
26+
may reject unrecognized values.
27+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
2628
type: string
2729
kind:
28-
description: 'Kind is a string value representing the REST resource this
29-
object represents. Servers may infer this from the endpoint the client
30-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
30+
description: |-
31+
Kind is a string value representing the REST resource this object represents.
32+
Servers may infer this from the endpoint the client submits requests to.
33+
Cannot be updated.
34+
In CamelCase.
35+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
3136
type: string
3237
metadata:
3338
type: object
@@ -64,9 +69,9 @@ spec:
6469
properties:
6570
alertSensitivity:
6671
default: none
67-
description: The alertSensitivity value defaults to none if there
68-
are no alerts or can be set to low, medium, or high to correspond
69-
to the check alert levels.
72+
description: |-
73+
The alertSensitivity value defaults to none if there are no alerts or can be set to low, medium,
74+
or high to correspond to the check alert levels.
7075
enum:
7176
- none
7277
- low
@@ -79,11 +84,10 @@ spec:
7984
format: int64
8085
type: integer
8186
probes:
82-
description: Probes are the monitoring agents responsible for
83-
simulating user interactions with your web applications or services.
84-
These agents periodically send requests to predefined URLs and
85-
record the responses, checking for expected outcomes and measuring
86-
performance.
87+
description: |-
88+
Probes are the monitoring agents responsible for simulating user interactions with your web applications
89+
or services. These agents periodically send requests to predefined URLs and record the responses,
90+
checking for expected outcomes and measuring performance.
8791
items:
8892
type: string
8993
type: array
@@ -113,18 +117,17 @@ spec:
113117
description: Set to "true" to pause checks
114118
type: boolean
115119
postDataEnvVar:
116-
description: Data that should be posted to the web page, for example
117-
submission data for a sign-up or login form. The data needs
118-
to be formatted in the same way as a web browser would send
119-
it to the web server. Because post data contains sensitive secret
120-
this field is only a reference to an environment variable.
120+
description: |-
121+
Data that should be posted to the web page, for example submission data for a sign-up or login form.
122+
The data needs to be formatted in the same way as a web browser would send it to the web server.
123+
Because post data contains sensitive secret this field is only a reference to an environment variable.
121124
type: string
122125
requestHeaders:
123126
description: Custom request headers
124127
type: string
125128
requestHeadersEnvVar:
126-
description: Custom request headers that should be read from an
127-
environment variable as it possibly contains sensitive data.
129+
description: |-
130+
Custom request headers that should be read from an environment variable as it possibly contains sensitive data.
128131
An example would be an API token.
129132
type: string
130133
resolution:
@@ -138,11 +141,10 @@ spec:
138141
HTML code of the page
139142
type: string
140143
sslDownDaysBefore:
141-
description: Consider down prior to certificate expiring Select
142-
the number of days prior to your certificate expiry date that
143-
you want to consider the check down. At this day your check
144-
will be considered down and if applicable a down alert will
145-
be sent.
144+
description: |-
145+
Consider down prior to certificate expiring
146+
Select the number of days prior to your certificate expiry date that you want to consider the check down.
147+
At this day your check will be considered down and if applicable a down alert will be sent.
146148
type: integer
147149
tags:
148150
description: Comma separated set of tags to apply to check (e.g.
@@ -152,11 +154,11 @@ spec:
152154
description: '`-` separated team id''s (e.g. "1234567_8_9-9876543_2_1")'
153155
type: string
154156
verifyCertificate:
155-
description: Monitor SSL/TLS certificate Monitor the validity
156-
of your SSL/TLS certificate. With this enabled Uptime checks
157-
will be considered DOWN when the certificate becomes invalid
158-
or expires. SSL/TLS certificate monitoring is available for
159-
HTTP checks.
157+
description: |-
158+
Monitor SSL/TLS certificate
159+
Monitor the validity of your SSL/TLS certificate. With this enabled Uptime checks will be considered DOWN when
160+
the certificate becomes invalid or expires.
161+
SSL/TLS certificate monitoring is available for HTTP checks.
160162
type: boolean
161163
type: object
162164
pingdomTransactionConfig:
@@ -217,18 +219,17 @@ spec:
217219
args:
218220
additionalProperties:
219221
type: string
220-
description: 'contains the html element with assigned value
221-
the key element is always lowercase for example {"url":
222-
"https://www.pingdom.com"} see available values at https://pkg.go.dev/github.com/karlderkaefer/pingdom-golang-client@latest/pkg/pingdom/client/tmschecks#StepArg'
222+
description: |-
223+
contains the html element with assigned value
224+
the key element is always lowercase for example {"url": "https://www.pingdom.com"}
225+
see available values at https://pkg.go.dev/github.com/karlderkaefer/pingdom-golang-client@latest/pkg/pingdom/client/tmschecks#StepArg
223226
type: object
224227
function:
225-
description: 'contains the function that is executed as
226-
part of the step commands: go_to, click, fill, check,
227-
uncheck, sleep, select_radio, basic_auth, submit, wait_for_element,
228-
wait_for_contains validations: url, exists, not_exists,
229-
contains, not_contains, field_contains, field_not_contains,
230-
is_checked, is_not_checked, radio_selected, dropdown_selected,
231-
dropdown_not_selected see updated list https://docs.pingdom.com/api/#section/TMS-Steps-Vocabulary/Script-transaction-checks'
228+
description: |-
229+
contains the function that is executed as part of the step
230+
commands: go_to, click, fill, check, uncheck, sleep, select_radio, basic_auth, submit, wait_for_element, wait_for_contains
231+
validations: url, exists, not_exists, contains, not_contains, field_contains, field_not_contains, is_checked, is_not_checked, radio_selected, dropdown_selected, dropdown_not_selected
232+
see updated list https://docs.pingdom.com/api/#section/TMS-Steps-Vocabulary/Script-transaction-checks
232233
type: string
233234
required:
234235
- args
@@ -360,9 +361,9 @@ spec:
360361
this monitor
361362
type: string
362363
customHTTPStatuses:
363-
description: 'Defines which http status codes are treated as up
364-
or down For ex: 200:0_401:1_503:1 (to accept 200 as down and
365-
401 and 503 as up)'
364+
description: |-
365+
Defines which http status codes are treated as up or down
366+
For ex: 200:0_401:1_503:1 (to accept 200 as down and 401 and 503 as up)
366367
type: string
367368
interval:
368369
description: The uptimerobot check interval in seconds

0 commit comments

Comments
 (0)