-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
171 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,5 @@ bin | |
*~ | ||
/helm/*-values.yaml | ||
dist | ||
gomock* | ||
gomock* | ||
certs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,25 +21,8 @@ test: generate mocks tidy fmt vet manifests | |
manager: generate fmt vet | ||
go build -o bin/manager main.go | ||
|
||
# Run against the configured Kubernetes cluster in ~/.kube/config | ||
run: generate fmt vet manifests | ||
go run ./main.go | ||
|
||
# Install CRDs into a cluster | ||
install: manifests kustomize | ||
$(KUSTOMIZE) build config/crd | kubectl apply -f - | ||
|
||
# Uninstall CRDs from a cluster | ||
uninstall: manifests kustomize | ||
$(KUSTOMIZE) build config/crd | kubectl delete -f - | ||
|
||
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config | ||
deploy: manifests kustomize | ||
cd config/manager && kustomize edit set image controller=${IMG} | ||
$(KUSTOMIZE) build config/default | kubectl apply -f - | ||
|
||
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. | ||
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases | ||
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./pkg/..." paths="./api/..." paths="./controllers/..." output:crd:artifacts:config=config/crd/bases | ||
cp config/crd/bases/*.yaml helm/crds/ | ||
|
||
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. | ||
|
@@ -84,6 +67,10 @@ mocks: mockgen | |
|
||
$(MOCKGEN) -destination pkg/mocks/logr/mock.go github.com/go-logr/logr LogSink | ||
|
||
.PHONY: lint-helm | ||
lint-helm: | ||
helm lint helm/ --set webhook.enabled=true --set webhook.certManager.enabled=true | ||
|
||
CONTROLLER_GEN = ./bin/controller-gen | ||
controller-gen: ## Download controller-gen locally if necessary. | ||
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/[email protected]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
domain: bakito.ch | ||
layout: go.kubebuilder.io/v2 | ||
layout: | ||
- go.kubebuilder.io/v3 | ||
plugins: | ||
manifests.sdk.operatorframework.io/v2: {} | ||
scorecard.sdk.operatorframework.io/v2: {} | ||
projectName: k8s-event-logger-operator | ||
repo: github.com/bakito/k8s-event-logger-operator | ||
resources: | ||
- group: eventlogger | ||
kind: EventLogger | ||
version: v1 | ||
- group: eventlogger | ||
kind: Event | ||
version: v1 | ||
- group: eventlogger | ||
kind: Pod | ||
version: v1 | ||
version: 3-alpha | ||
plugins: | ||
go.sdk.operatorframework.io/v2-alpha: {} | ||
webhooks: | ||
defaulting: false | ||
validation: true | ||
webhookVersion: v1 | ||
version: "3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "k8s-event-logger-operator.fullname" . }} | ||
labels: | ||
{{- include "k8s-event-logger-operator.labels" . | nindent 4 }} | ||
{{- if .Values.webhook.openShiftServiceCert.enabled }} | ||
annotations: | ||
service.beta.openshift.io/serving-cert-secret-name: {{ include "k8s-event-logger-operator.webhookCertSecretName" . }} | ||
{{- end }} | ||
namespace: {{ .Release.Namespace }} | ||
spec: | ||
ports: | ||
{{- if .Values.webhook.enabled }} | ||
- name: webhook | ||
port: 443 | ||
targetPort: webhook | ||
{{- end }} | ||
- name: metrics | ||
protocol: TCP | ||
port: 8080 | ||
targetPort: metrics | ||
selector: | ||
{{- include "k8s-event-logger-operator.selectorLabels" . | nindent 6 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{{- if and (.Values.webhook.enabled) (.Values.webhook.certManager.enabled) -}} | ||
apiVersion: cert-manager.io/v1 | ||
kind: Issuer | ||
metadata: | ||
name: {{ include "k8s-event-logger-operator.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "k8s-event-logger-operator.labels" . | nindent 4 }} | ||
spec: | ||
selfSigned: {} | ||
--- | ||
apiVersion: cert-manager.io/v1 | ||
kind: Certificate | ||
metadata: | ||
name: {{ include "k8s-event-logger-operator.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "k8s-event-logger-operator.labels" . | nindent 4 }} | ||
spec: | ||
dnsNames: | ||
- {{ include "k8s-event-logger-operator.fullname" . }}.{{ .Release.Namespace }}.svc | ||
- {{ include "k8s-event-logger-operator.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local | ||
issuerRef: | ||
kind: Issuer | ||
name: {{ include "k8s-event-logger-operator.fullname" . }} | ||
secretName: {{ include "k8s-event-logger-operator.webhookCertSecretName" . }} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{{- if .Values.webhook.enabled -}} | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: ValidatingWebhookConfiguration | ||
metadata: | ||
name: validating-webhook-configuration | ||
{{- if .Values.webhook.openShiftServiceCert.enabled }} | ||
annotations: | ||
service.beta.openshift.io/inject-cabundle: "true" | ||
{{- end }} | ||
webhooks: | ||
- admissionReviewVersions: | ||
- v1 | ||
- v1beta1 | ||
clientConfig: | ||
caBundle: {{ .Values.webhook.caBundle }} | ||
service: | ||
name: {{ include "k8s-event-logger-operator.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
path: /validate-eventlogger-bakito-ch-v1-eventlogger | ||
failurePolicy: Fail | ||
name: veventlogger.bakito.ch | ||
rules: | ||
- apiGroups: | ||
- eventlogger.bakito.ch | ||
apiVersions: | ||
- v1 | ||
operations: | ||
- CREATE | ||
- UPDATE | ||
resources: | ||
- eventloggers | ||
sideEffects: None | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters