Skip to content

Commit

Permalink
Updated manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
MuneebAijaz committed Oct 28, 2022
1 parent 70cf5e1 commit 2f1ce45
Show file tree
Hide file tree
Showing 11 changed files with 171 additions and 54 deletions.
38 changes: 32 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ IMAGE_TAG_BASE ?= stakater/ingressmonitorcontroller
# BUNDLE_IMG defines the image:tag used for the bundle.
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION)
# BUNDLE_GEN_FLAGS are the flags passed to the operator-sdk generate bundle command
BUNDLE_GEN_FLAGS ?= -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)

# USE_IMAGE_DIGESTS defines if images are resolved via tags or digests
# You can enable this value if you would like to use SHA Based Digests
# To enable set flag to true
USE_IMAGE_DIGESTS ?= false
ifeq ($(USE_IMAGE_DIGESTS), true)
BUNDLE_GEN_FLAGS += --use-image-digests
endif

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

all: build

Expand Down Expand Up @@ -83,8 +99,13 @@ fmt: ## Run go fmt against code.
vet: ## Run go vet against code.
go vet ./...

## ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_ASSETS_DIR = $(shell pwd)/testbin
.PHONY: test
test: generate fmt vet manifests
go test -v ./... -coverprofile cover.out
mkdir -p $(ENVTEST_ASSETS_DIR)
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
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

##@ Build

Expand All @@ -100,20 +121,25 @@ docker-build: test ## Build docker image with the manager.
docker-push: ## Push docker image with the manager.
docker push ${IMG}


ifndef ignore-not-found
ignore-not-found = false
endif

##@ Deployment

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

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

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

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


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

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

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

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

# Bump Chart
bump-chart: bump-chart-operator
bump-chart: bump-chart-operator

generate-crds: controller-gen
$(CONTROLLER_GEN) crd paths="./..." output:crd:artifacts:config=charts/ingressmonitorcontroller/crds
4 changes: 2 additions & 2 deletions bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=ingressmonitorcontroller
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.6.1+git
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.18.0+git
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3

# Labels for testing.
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
Expand Down
63 changes: 45 additions & 18 deletions bundle/manifests/endpointmonitor.stakater.com_endpointmonitors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ spec:
description: EndpointMonitor is the Schema for the endpointmonitors API
properties:
apiVersion:
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'
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'
type: string
kind:
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'
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'
type: string
metadata:
type: object
Expand All @@ -34,10 +38,12 @@ spec:
description: Configuration for AppInsights Monitor Provider
properties:
frequency:
description: 'Sets how often the test should run from each test location. Possible values: `300,600,900` seconds'
description: 'Sets how often the test should run from each test
location. Possible values: `300,600,900` seconds'
type: integer
retryEnable:
description: 'If its `true`, falied test will be retry after a short interval. Possible values: `true, false`'
description: 'If its `true`, falied test will be retry after a
short interval. Possible values: `true, false`'
type: boolean
statusCode:
description: Returned status code that is counted as a success
Expand All @@ -62,7 +68,8 @@ spec:
description: '`-` separated contact id''s (e.g. "1234567_8_9-9876543_2_1")'
type: string
alertIntegrations:
description: '`-` separated set list of integrations ids (e.g. "91166-12168")'
description: '`-` separated set list of integrations ids (e.g.
"91166-12168")'
type: string
basicAuthUser:
description: Required for basic-authentication
Expand All @@ -83,19 +90,29 @@ spec:
description: How many failed check attempts before notifying
type: integer
shouldContain:
description: Set to text string that has to be present in the HTML code of the page
description: Set to text string that has to be present in the
HTML code of the page
type: string
sslDownDaysBefore:
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.
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.
type: integer
tags:
description: Comma separated set of tags to apply to check (e.g. "testing,aws")
description: Comma separated set of tags to apply to check (e.g.
"testing,aws")
type: string
teamAlertContacts:
description: '`-` separated team id''s (e.g. "1234567_8_9-9876543_2_1")'
type: string
verifyCertificate:
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.
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.
type: boolean
type: object
providers:
Expand Down Expand Up @@ -140,7 +157,8 @@ spec:
description: Enable Real Browser
type: boolean
statusCodes:
description: Comma seperated list of HTTP codes to trigger error on
description: Comma seperated list of HTTP codes to trigger error
on
type: string
testTags:
description: Comma separated list of tags
Expand Down Expand Up @@ -191,26 +209,32 @@ spec:
description: Configuration for UptimeRobot Monitor Provider
properties:
alertContacts:
description: The uptimerobot alertContacts to be associated with this monitor
description: The uptimerobot alertContacts to be associated with
this monitor
type: string
customHTTPStatuses:
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)'
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)'
type: string
interval:
description: The uptimerobot check interval in seconds
minimum: 60
type: integer
keywordExists:
description: Alert if value exist (yes) or doesn't exist (no) (Only if monitor-type is keyword)
description: Alert if value exist (yes) or doesn't exist (no)
(Only if monitor-type is keyword)
enum:
- "yes"
- "no"
type: string
keywordValue:
description: keyword to check on URL (e.g.'search' or '404') (Only if monitor-type is keyword)
description: keyword to check on URL (e.g.'search' or '404') (Only
if monitor-type is keyword)
type: string
maintenanceWindows:
description: Specify maintenanceWindows i.e. once or recurring “do-not-monitor periods”
description: Specify maintenanceWindows i.e. once or recurring
“do-not-monitor periods”
type: string
monitorType:
description: The uptimerobot monitor type (http or keyword)
Expand All @@ -219,7 +243,8 @@ spec:
- keyword
type: string
statusPages:
description: The uptimerobot public status page ID to add this monitor to
description: The uptimerobot public status page ID to add this
monitor to
type: string
type: object
url:
Expand All @@ -229,15 +254,17 @@ spec:
description: URL to monitor from either an ingress or route reference
properties:
ingressRef:
description: IngressURLSource selects an Ingress to populate the URL with
description: IngressURLSource selects an Ingress to populate the
URL with
properties:
name:
type: string
required:
- name
type: object
routeRef:
description: RouteURLSource selects a Route to populate the URL with
description: RouteURLSource selects a Route to populate the URL
with
properties:
name:
type: string
Expand Down

This file was deleted.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions bundle/metadata/annotations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ annotations:
operators.operatorframework.io.bundle.package.v1: ingressmonitorcontroller
operators.operatorframework.io.bundle.channels.v1: alpha
operators.operatorframework.io.bundle.channel.default.v1: alpha
operators.operatorframework.io.metrics.builder: operator-sdk-v1.6.1+git
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3
operators.operatorframework.io.metrics.builder: operator-sdk-v1.18.0+git
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3

# Annotations for testing.
operators.operatorframework.io.test.mediatype.v1: scorecard+v1
Expand Down
21 changes: 21 additions & 0 deletions bundle/tests/scorecard/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,59 @@ stages:
labels:
suite: basic
test: basic-check-spec-test
storage:
spec:
mountPath: {}
- entrypoint:
- scorecard-test
- olm-bundle-validation
image: quay.io/operator-framework/scorecard-test:v1.6.2
labels:
suite: olm
test: olm-bundle-validation-test
storage:
spec:
mountPath: {}
- entrypoint:
- scorecard-test
- olm-crds-have-validation
image: quay.io/operator-framework/scorecard-test:v1.6.2
labels:
suite: olm
test: olm-crds-have-validation-test
storage:
spec:
mountPath: {}
- entrypoint:
- scorecard-test
- olm-crds-have-resources
image: quay.io/operator-framework/scorecard-test:v1.6.2
labels:
suite: olm
test: olm-crds-have-resources-test
storage:
spec:
mountPath: {}
- entrypoint:
- scorecard-test
- olm-spec-descriptors
image: quay.io/operator-framework/scorecard-test:v1.6.2
labels:
suite: olm
test: olm-spec-descriptors-test
storage:
spec:
mountPath: {}
- entrypoint:
- scorecard-test
- olm-status-descriptors
image: quay.io/operator-framework/scorecard-test:v1.6.2
labels:
suite: olm
test: olm-status-descriptors-test
storage:
spec:
mountPath: {}
storage:
spec:
mountPath: {}
2 changes: 1 addition & 1 deletion charts/ingressmonitorcontroller/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
- --secure-listen-address=0.0.0.0:8443
- --upstream=http://127.0.0.1:8080/
- --logtostderr=true
- --v=10
- --v=0
image: {{ printf "%s:%s" .image.repository .image.tag | default "gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0" | quote }}
imagePullPolicy: {{ .image.pullPolicy | quote }}
name: kube-rbac-proxy
Expand Down
16 changes: 15 additions & 1 deletion config/default/manager_auth_proxy_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,26 @@ spec:
- "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/"
- "--logtostderr=true"
- "--v=10"
- "--v=0"
ports:
- containerPort: 8443
name: https
resources:
limits:
cpu: 10m
memory: 128Mi
requests:
cpu: 5m
memory: 64Mi
- name: manager
args:
- "--health-probe-bind-address=:8081"
- "--metrics-bind-address=127.0.0.1:8080"
- "--leader-elect"
resources:
limits:
cpu: 50m
memory: 500Mi
requests:
cpu: 5m
memory: 64Mi

Large diffs are not rendered by default.

Loading

0 comments on commit 2f1ce45

Please sign in to comment.