Skip to content

Commit 22cbbcf

Browse files
authored
Merge pull request #403 from stakater/sdk-update
Updated manifests created for operator-sdk update
2 parents 70cf5e1 + d16dbde commit 22cbbcf

12 files changed

+170
-54
lines changed

Makefile

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ IMAGE_TAG_BASE ?= stakater/ingressmonitorcontroller
3535
# BUNDLE_IMG defines the image:tag used for the bundle.
3636
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
3737
BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION)
38+
# BUNDLE_GEN_FLAGS are the flags passed to the operator-sdk generate bundle command
39+
BUNDLE_GEN_FLAGS ?= -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
40+
41+
# USE_IMAGE_DIGESTS defines if images are resolved via tags or digests
42+
# You can enable this value if you would like to use SHA Based Digests
43+
# To enable set flag to true
44+
USE_IMAGE_DIGESTS ?= false
45+
ifeq ($(USE_IMAGE_DIGESTS), true)
46+
BUNDLE_GEN_FLAGS += --use-image-digests
47+
endif
3848

3949
# Image URL to use all building/pushing image targets
4050
IMG ?= controller:latest
@@ -50,6 +60,12 @@ GOBIN=$(shell go env GOPATH)/bin
5060
else
5161
GOBIN=$(shell go env GOBIN)
5262
endif
63+
# Setting SHELL to bash allows bash commands to be executed by recipes.
64+
# This is a requirement for 'setup-envtest.sh' in the test target.
65+
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
66+
SHELL = /usr/bin/env bash -o pipefail
67+
.SHELLFLAGS = -ec
68+
all: build
5369

5470
all: build
5571

@@ -83,8 +99,12 @@ fmt: ## Run go fmt against code.
8399
vet: ## Run go vet against code.
84100
go vet ./...
85101

102+
ENVTEST_ASSETS_DIR = $(shell pwd)/testbin
103+
.PHONY: test
86104
test: generate fmt vet manifests
87-
go test -v ./... -coverprofile cover.out
105+
mkdir -p $(ENVTEST_ASSETS_DIR)
106+
test -f $(ENVTEST_ASSETS_DIR)/setup-envtest.sh || curl -sSLo $(ENVTEST_ASSETS_DIR)/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.6.3/hack/setup-envtest.sh
107+
source $(ENVTEST_ASSETS_DIR)/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -count=1 -coverprofile cover.out
88108

89109
##@ Build
90110

@@ -100,20 +120,25 @@ docker-build: test ## Build docker image with the manager.
100120
docker-push: ## Push docker image with the manager.
101121
docker push ${IMG}
102122

123+
124+
ifndef ignore-not-found
125+
ignore-not-found = false
126+
endif
127+
103128
##@ Deployment
104129

105130
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
106131
$(KUSTOMIZE) build config/crd | kubectl apply -f -
107132

108133
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
109-
$(KUSTOMIZE) build config/crd | kubectl delete -f -
134+
$(KUSTOMIZE) build config/crd | kubectl delete -f - --ignore-not-found=$(ignore-not-found)
110135

111136
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
112137
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
113138
$(KUSTOMIZE) build config/default | kubectl apply -f -
114139

115140
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
116-
$(KUSTOMIZE) build config/default | kubectl delete -f -
141+
$(KUSTOMIZE) build config/default | kubectl delete -f - --ignore-not-found=$(ignore-not-found)
117142

118143

119144
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
@@ -122,7 +147,7 @@ controller-gen: ## Download controller-gen locally if necessary.
122147

123148
KUSTOMIZE = $(shell pwd)/bin/kustomize
124149
kustomize: ## Download kustomize locally if necessary.
125-
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected].4)
150+
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected].7)
126151

127152
# go-get-tool will 'go get' any package $2 and install it to $1.
128153
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
@@ -142,7 +167,7 @@ endef
142167
bundle: manifests kustomize ## Generate bundle manifests and metadata, then validate generated files.
143168
operator-sdk generate kustomize manifests -q
144169
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
145-
$(KUSTOMIZE) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
170+
$(KUSTOMIZE) build config/manifests | operator-sdk generate bundle $(BUNDLE_GEN_FLAGS)
146171
operator-sdk bundle validate ./bundle
147172

148173
.PHONY: bundle-build
@@ -208,7 +233,7 @@ bump-chart-operator:
208233
sed -i "/^image:/{n;n;s/tag:.*/tag: v$(VERSION)/}" charts/ingressmonitorcontroller/values.yaml
209234

210235
# Bump Chart
211-
bump-chart: bump-chart-operator
236+
bump-chart: bump-chart-operator
212237

213238
generate-crds: controller-gen
214239
$(CONTROLLER_GEN) crd paths="./..." output:crd:artifacts:config=charts/ingressmonitorcontroller/crds

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.6.1+git
11-
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
10+
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.18.0+git
1211
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
12+
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
1313

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

bundle/manifests/endpointmonitor.stakater.com_endpointmonitors.yaml

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ 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 of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
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'
2426
type: string
2527
kind:
26-
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
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'
2731
type: string
2832
metadata:
2933
type: object
@@ -34,10 +38,12 @@ spec:
3438
description: Configuration for AppInsights Monitor Provider
3539
properties:
3640
frequency:
37-
description: 'Sets how often the test should run from each test location. Possible values: `300,600,900` seconds'
41+
description: 'Sets how often the test should run from each test
42+
location. Possible values: `300,600,900` seconds'
3843
type: integer
3944
retryEnable:
40-
description: 'If its `true`, falied test will be retry after a short interval. Possible values: `true, false`'
45+
description: 'If its `true`, falied test will be retry after a
46+
short interval. Possible values: `true, false`'
4147
type: boolean
4248
statusCode:
4349
description: Returned status code that is counted as a success
@@ -62,7 +68,8 @@ spec:
6268
description: '`-` separated contact id''s (e.g. "1234567_8_9-9876543_2_1")'
6369
type: string
6470
alertIntegrations:
65-
description: '`-` separated set list of integrations ids (e.g. "91166-12168")'
71+
description: '`-` separated set list of integrations ids (e.g.
72+
"91166-12168")'
6673
type: string
6774
basicAuthUser:
6875
description: Required for basic-authentication
@@ -83,19 +90,29 @@ spec:
8390
description: How many failed check attempts before notifying
8491
type: integer
8592
shouldContain:
86-
description: Set to text string that has to be present in the HTML code of the page
93+
description: Set to text string that has to be present in the
94+
HTML code of the page
8795
type: string
8896
sslDownDaysBefore:
89-
description: Consider down prior to certificate expiring Select the number of days prior to your certificate expiry date that you want to consider the check down. At this day your check will be considered down and if applicable a down alert will be sent.
97+
description: Consider down prior to certificate expiring Select
98+
the number of days prior to your certificate expiry date that
99+
you want to consider the check down. At this day your check
100+
will be considered down and if applicable a down alert will
101+
be sent.
90102
type: integer
91103
tags:
92-
description: Comma separated set of tags to apply to check (e.g. "testing,aws")
104+
description: Comma separated set of tags to apply to check (e.g.
105+
"testing,aws")
93106
type: string
94107
teamAlertContacts:
95108
description: '`-` separated team id''s (e.g. "1234567_8_9-9876543_2_1")'
96109
type: string
97110
verifyCertificate:
98-
description: Monitor SSL/TLS certificate Monitor the validity of your SSL/TLS certificate. With this enabled Uptime checks will be considered DOWN when the certificate becomes invalid or expires. SSL/TLS certificate monitoring is available for HTTP checks.
111+
description: Monitor SSL/TLS certificate Monitor the validity
112+
of your SSL/TLS certificate. With this enabled Uptime checks
113+
will be considered DOWN when the certificate becomes invalid
114+
or expires. SSL/TLS certificate monitoring is available for
115+
HTTP checks.
99116
type: boolean
100117
type: object
101118
providers:
@@ -140,7 +157,8 @@ spec:
140157
description: Enable Real Browser
141158
type: boolean
142159
statusCodes:
143-
description: Comma seperated list of HTTP codes to trigger error on
160+
description: Comma seperated list of HTTP codes to trigger error
161+
on
144162
type: string
145163
testTags:
146164
description: Comma separated list of tags
@@ -191,26 +209,32 @@ spec:
191209
description: Configuration for UptimeRobot Monitor Provider
192210
properties:
193211
alertContacts:
194-
description: The uptimerobot alertContacts to be associated with this monitor
212+
description: The uptimerobot alertContacts to be associated with
213+
this monitor
195214
type: string
196215
customHTTPStatuses:
197-
description: 'Defines which http status codes are treated as up or down For ex: 200:0_401:1_503:1 (to accept 200 as down and 401 and 503 as up)'
216+
description: 'Defines which http status codes are treated as up
217+
or down For ex: 200:0_401:1_503:1 (to accept 200 as down and
218+
401 and 503 as up)'
198219
type: string
199220
interval:
200221
description: The uptimerobot check interval in seconds
201222
minimum: 60
202223
type: integer
203224
keywordExists:
204-
description: Alert if value exist (yes) or doesn't exist (no) (Only if monitor-type is keyword)
225+
description: Alert if value exist (yes) or doesn't exist (no)
226+
(Only if monitor-type is keyword)
205227
enum:
206228
- "yes"
207229
- "no"
208230
type: string
209231
keywordValue:
210-
description: keyword to check on URL (e.g.'search' or '404') (Only if monitor-type is keyword)
232+
description: keyword to check on URL (e.g.'search' or '404') (Only
233+
if monitor-type is keyword)
211234
type: string
212235
maintenanceWindows:
213-
description: Specify maintenanceWindows i.e. once or recurring “do-not-monitor periods”
236+
description: Specify maintenanceWindows i.e. once or recurring
237+
“do-not-monitor periods”
214238
type: string
215239
monitorType:
216240
description: The uptimerobot monitor type (http or keyword)
@@ -219,7 +243,8 @@ spec:
219243
- keyword
220244
type: string
221245
statusPages:
222-
description: The uptimerobot public status page ID to add this monitor to
246+
description: The uptimerobot public status page ID to add this
247+
monitor to
223248
type: string
224249
type: object
225250
url:
@@ -229,15 +254,17 @@ spec:
229254
description: URL to monitor from either an ingress or route reference
230255
properties:
231256
ingressRef:
232-
description: IngressURLSource selects an Ingress to populate the URL with
257+
description: IngressURLSource selects an Ingress to populate the
258+
URL with
233259
properties:
234260
name:
235261
type: string
236262
required:
237263
- name
238264
type: object
239265
routeRef:
240-
description: RouteURLSource selects a Route to populate the URL with
266+
description: RouteURLSource selects a Route to populate the URL
267+
with
241268
properties:
242269
name:
243270
type: string

bundle/manifests/ingressmonitorcontroller-controller-manager_v1_serviceaccount.yaml

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

bundle/manifests/ingressmonitorcontroller.clusterserviceversion.yaml

Lines changed: 34 additions & 13 deletions
Large diffs are not rendered by default.

bundle/metadata/annotations.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ annotations:
66
operators.operatorframework.io.bundle.package.v1: ingressmonitorcontroller
77
operators.operatorframework.io.bundle.channels.v1: alpha
88
operators.operatorframework.io.bundle.channel.default.v1: alpha
9-
operators.operatorframework.io.metrics.builder: operator-sdk-v1.6.1+git
10-
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3
9+
operators.operatorframework.io.metrics.builder: operator-sdk-v1.18.0+git
1110
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
11+
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3
1212

1313
# Annotations for testing.
1414
operators.operatorframework.io.test.mediatype.v1: scorecard+v1

bundle/tests/scorecard/config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,59 @@ stages:
1212
labels:
1313
suite: basic
1414
test: basic-check-spec-test
15+
storage:
16+
spec:
17+
mountPath: {}
1518
- entrypoint:
1619
- scorecard-test
1720
- olm-bundle-validation
1821
image: quay.io/operator-framework/scorecard-test:v1.6.2
1922
labels:
2023
suite: olm
2124
test: olm-bundle-validation-test
25+
storage:
26+
spec:
27+
mountPath: {}
2228
- entrypoint:
2329
- scorecard-test
2430
- olm-crds-have-validation
2531
image: quay.io/operator-framework/scorecard-test:v1.6.2
2632
labels:
2733
suite: olm
2834
test: olm-crds-have-validation-test
35+
storage:
36+
spec:
37+
mountPath: {}
2938
- entrypoint:
3039
- scorecard-test
3140
- olm-crds-have-resources
3241
image: quay.io/operator-framework/scorecard-test:v1.6.2
3342
labels:
3443
suite: olm
3544
test: olm-crds-have-resources-test
45+
storage:
46+
spec:
47+
mountPath: {}
3648
- entrypoint:
3749
- scorecard-test
3850
- olm-spec-descriptors
3951
image: quay.io/operator-framework/scorecard-test:v1.6.2
4052
labels:
4153
suite: olm
4254
test: olm-spec-descriptors-test
55+
storage:
56+
spec:
57+
mountPath: {}
4358
- entrypoint:
4459
- scorecard-test
4560
- olm-status-descriptors
4661
image: quay.io/operator-framework/scorecard-test:v1.6.2
4762
labels:
4863
suite: olm
4964
test: olm-status-descriptors-test
65+
storage:
66+
spec:
67+
mountPath: {}
68+
storage:
69+
spec:
70+
mountPath: {}

charts/ingressmonitorcontroller/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ spec:
3333
- --secure-listen-address=0.0.0.0:8443
3434
- --upstream=http://127.0.0.1:8080/
3535
- --logtostderr=true
36-
- --v=10
36+
- --v=0
3737
image: {{ printf "%s:%s" .image.repository .image.tag | default "gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0" | quote }}
3838
imagePullPolicy: {{ .image.pullPolicy | quote }}
3939
name: kube-rbac-proxy

config/default/manager_auth_proxy_patch.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,26 @@ spec:
1515
- "--secure-listen-address=0.0.0.0:8443"
1616
- "--upstream=http://127.0.0.1:8080/"
1717
- "--logtostderr=true"
18-
- "--v=10"
18+
- "--v=0"
1919
ports:
2020
- containerPort: 8443
2121
name: https
22+
resources:
23+
limits:
24+
cpu: 10m
25+
memory: 128Mi
26+
requests:
27+
cpu: 5m
28+
memory: 64Mi
2229
- name: manager
2330
args:
2431
- "--health-probe-bind-address=:8081"
2532
- "--metrics-bind-address=127.0.0.1:8080"
2633
- "--leader-elect"
34+
resources:
35+
limits:
36+
cpu: 50m
37+
memory: 500Mi
38+
requests:
39+
cpu: 5m
40+
memory: 64Mi

config/manager/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
1212
kind: Kustomization
1313
images:
1414
- name: controller
15-
newName: controller
16-
newTag: latest
15+
newName: stakater/ingressmonitorcontroller
16+
newTag: v2.1.19

0 commit comments

Comments
 (0)