Skip to content
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

deploy, kustomize: provide an OpenShift overlay #21

Closed
wants to merge 1 commit into from
Closed
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
43 changes: 43 additions & 0 deletions config/openshift/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Adds namespace to all resources.
namespace: openshift-kubevirt-ipam-controller-system

# Value of this field is prepended to the
# names of all resources, e.g. a deployment named
# "wordpress" becomes "alices-wordpress".
# Note that it should also match with the prefix (text before '-') of the namespace
# field above.
namePrefix: kubevirt-ipam-controller-

labels:
- includeSelectors: true
pairs:
app: ipam-virt-workloads

resources:
- ../rbac
- ../manager
- ../webhook

patches:
- path: manager_webhook_patch.yaml
- path: webhookcainjection_patch.yaml
- patch: |-
- op: add
path: /webhooks/0/objectSelector
value:
matchLabels:
kubevirt.io: virt-launcher
target:
kind: MutatingWebhookConfiguration
group: admissionregistration.k8s.io
version: v1
name: mutating-webhook-configuration
- patch: |-
- op: add
path: /metadata/annotations
value:
service.beta.openshift.io/serving-cert-secret-name: webhook-service
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to figure out the name of the service here ... the prefix above (line 9) is not playing along here.

maybe consider removing the prefix ?...

Copy link
Collaborator

@oshoval oshoval Jun 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ye no need the prefix imo
fwiw note please that CNAO will know to do it all itself based only on dist/install.yaml

so this PR is needed only if you want to be able to deploy the repo standalone on OCP

i would even suggest the minimalist manifest kustomize if so for this
even seds or easiest possible
no need naming / namespace changes

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah thanks. I had forgotten about that.

Well, it still makes sense, but, the priority surely drops quite a lot.

It would still be useful to test drive the feature early on OpenShift though.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing manually only the required bit, the secret need to be "kubevirt-ipam-claims-webhook-service"
maybe you can set it as such for both U/S and D/S
without prefixing stuff (or at least not the secret) and it will work ?

(adapting to kubevirt-ipam-controller-webhook-service once time comes)

target:
kind: Service
version: v1
name: webhook-service
26 changes: 26 additions & 0 deletions config/openshift/manager_webhook_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
namespace: system
spec:
template:
spec:
containers:
- name: manager
args:
- --leader-elect
- --certificates-dir=/etc/ipam-controller/certificates
ports:
- containerPort: 9443
name: webhook-server
protocol: TCP
volumeMounts:
- mountPath: /etc/ipam-controller/certificates
name: cert
readOnly: true
volumes:
- name: cert
secret:
defaultMode: 420
secretName: webhook-server-cert
16 changes: 16 additions & 0 deletions config/openshift/webhookcainjection_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This patch add annotation to admission webhook config and
# CERTIFICATE_NAMESPACE and CERTIFICATE_NAME will be substituted by kustomize
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
labels:
app.kubernetes.io/name: mutatingwebhookconfiguration
app.kubernetes.io/instance: mutating-webhook-configuration
app.kubernetes.io/component: webhook
app.kubernetes.io/created-by: kubevirt-ipam-controller
app.kubernetes.io/part-of: kubevirt-ipam-controller
app.kubernetes.io/managed-by: kustomize
name: mutating-webhook-configuration
namespace: openshift-kubevirt-ipam-controller-system
annotations:
service.beta.openshift.io/inject-cabundle: "true"
Loading