Skip to content

OCPEDGE-1923: feat(config): allow custom namespace installation #1000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
$(KUSTOMIZE) build config/crd | kubectl delete -f -

deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/default && \
$(KUSTOMIZE) edit set namespace $(OPERATOR_NAMESPACE)
cd config/manager && \
$(KUSTOMIZE) edit set image controller=$(IMG) && \
$(KUSTOMIZE) edit set nameprefix $(MANAGER_NAME_PREFIX) && \
Expand Down
2 changes: 1 addition & 1 deletion config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ namespace: openshift-storage
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace.yaml
- ../crd
- ../rbac
- ../manager
- ../webhook
patches:
- path: manager_metrics_patch.yaml
- path: manager_webhook_patch.yaml
- path: webhookcainjection_patch.yaml
13 changes: 13 additions & 0 deletions config/default/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Namespace
metadata:
annotations:
workload.openshift.io/allowed: "management"
labels:
app.kubernetes.io/name: lvms-operator
security.openshift.io/scc.podSecurityLabelSync: "false"
pod-security.kubernetes.io/enforce: "privileged"
pod-security.kubernetes.io/warn: "privileged"
pod-security.kubernetes.io/audit: "privileged"
openshift.io/cluster-monitoring: "true"
name: system
9 changes: 0 additions & 9 deletions config/default/webhookcainjection_patch.yaml

This file was deleted.

10 changes: 6 additions & 4 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namePrefix: lvms-
namespace: openshift-storage

resources:
- manager.yaml

generatorOptions:
disableNameSuffixHash: true
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

images:
- name: controller
newName: quay.io/lvms_dev/lvms-operator
newTag: latest
namePrefix: lvms-
namespace: openshift-storage
14 changes: 0 additions & 14 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
apiVersion: v1
kind: Namespace
metadata:
annotations:
workload.openshift.io/allowed: "management"
labels:
app.kubernetes.io/name: lvms-operator
security.openshift.io/scc.podSecurityLabelSync: "false"
pod-security.kubernetes.io/enforce: "privileged"
pod-security.kubernetes.io/warn: "privileged"
pod-security.kubernetes.io/audit: "privileged"
openshift.io/cluster-monitoring: "true"
name: system
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
22 changes: 19 additions & 3 deletions config/prometheus/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: openshift-storage

resources:
- monitor.yaml
- prometheus_rules.yaml
- metrics_service.yaml
- vgmanager_metrics_service.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: openshift-storage

replacements:
- source:
fieldPath: metadata.namespace
kind: ServiceMonitor
targets:
- fieldPaths:
- spec.endpoints.0.tlsConfig.serverName
- spec.endpoints.1.tlsConfig.serverName
options:
delimiter: .
index: 1
select:
kind: ServiceMonitor
name: lvms-operator-metrics-monitor
8 changes: 2 additions & 6 deletions config/webhook/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: openshift-storage
namePrefix: lvms-

resources:
- manifests.yaml
- validating_webhook_config.yaml
- service.yaml

configurations:
- kustomizeconfig.yaml
namespace: openshift-storage
18 changes: 0 additions & 18 deletions config/webhook/kustomizeconfig.yaml

This file was deleted.

1 change: 0 additions & 1 deletion config/webhook/service.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

apiVersion: v1
kind: Service
metadata:
Expand Down
27 changes: 27 additions & 0 deletions config/webhook/validating_webhook_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
name: validating-webhook-configuration
annotations:
service.beta.openshift.io/inject-cabundle: "true"
webhooks:
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate-lvm-topolvm-io-v1alpha1-lvmcluster
failurePolicy: Fail
name: vlvmcluster.kb.io
rules:
- apiGroups:
- lvm.topolvm.io
apiVersions:
- v1alpha1
operations:
- CREATE
- UPDATE
resources:
- lvmclusters
sideEffects: None