Skip to content

Commit

Permalink
feature: get namespace name from release command
Browse files Browse the repository at this point in the history
Signed-off-by: Alessandro Affinito <affinito.ale@gmail.com>
  • Loading branch information
tuxerrante committed Feb 28, 2023
1 parent e37aef5 commit d0695d9
Show file tree
Hide file tree
Showing 21 changed files with 630 additions and 606 deletions.
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ $(BUILD_DIR)/kubernetes-split-yaml: $(BUILD_DIR)

.PHONY: deployments
deployments: $(BUILD_DIR)/kustomize manifests generate ## Generate the deployment files with kustomize
$(BUILD_DIR)/kustomize build --reorder=none deploy/overlays/cluster -o deploy/operator.yaml
$(BUILD_DIR)/kustomize build --reorder=none deploy/overlays/namespaced -o deploy/namespace-operator.yaml
$(BUILD_DIR)/kustomize build --reorder=none deploy/overlays/openshift-dev -o deploy/openshift-dev.yaml
$(BUILD_DIR)/kustomize build --reorder=none deploy/overlays/openshift-downstream -o deploy/openshift-downstream.yaml
$(BUILD_DIR)/kustomize build --reorder=none deploy/overlays/helm -o deploy/helm/templates/static-resources.yaml
$(BUILD_DIR)/kustomize build --reorder=none deploy/base-crds -o deploy/helm/crds/crds.yaml
$(BUILD_DIR)/kustomize build --reorder=legacy deploy/overlays/webhook -o deploy/webhook-operator.yaml
$(BUILD_DIR)/kustomize build deploy/overlays/cluster -o deploy/operator.yaml
$(BUILD_DIR)/kustomize build deploy/overlays/namespaced -o deploy/namespace-operator.yaml
$(BUILD_DIR)/kustomize build deploy/overlays/openshift-dev -o deploy/openshift-dev.yaml
$(BUILD_DIR)/kustomize build deploy/overlays/openshift-downstream -o deploy/openshift-downstream.yaml
$(BUILD_DIR)/kustomize build deploy/overlays/helm -o deploy/helm/templates/static-resources.yaml
$(BUILD_DIR)/kustomize build deploy/base-crds -o deploy/helm/crds/crds.yaml
$(BUILD_DIR)/kustomize build deploy/overlays/webhook -o deploy/webhook-operator.yaml

.PHONY: image
image: ## Build the container image
Expand Down
23 changes: 13 additions & 10 deletions deploy/base-crds/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

commonLabels:
app: security-profiles-operator
sortOptions:
order: fifo

resources:
- crds/profilebinding.yaml
- crds/profilerecording.yaml
- crds/seccompprofile.yaml
- crds/securityprofilenodestatus.yaml
- crds/securityprofilesoperatordaemon.yaml
- crds/selinuxpolicy.yaml
- crds/apparmorprofile.yaml
- crds/profilebinding.yaml
- crds/profilerecording.yaml
- crds/seccompprofile.yaml
- crds/securityprofilenodestatus.yaml
- crds/securityprofilesoperatordaemon.yaml
- crds/selinuxpolicy.yaml
- crds/apparmorprofile.yaml

generatorOptions:
disableNameSuffixHash: true
labels:
- includeSelectors: true
pairs:
app: security-profiles-operator
29 changes: 15 additions & 14 deletions deploy/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

commonLabels:
app: security-profiles-operator

resources:
- ns.yaml
- service_account.yaml
- role.yaml
- role_binding.yaml
- mutatingwebhookconfig.yaml
- metrics_client.yaml
- ns.yaml
- service_account.yaml
- role.yaml
- role_binding.yaml
- mutatingwebhookconfig.yaml
- metrics_client.yaml

configMapGenerator:
- name: security-profiles-operator-profile
files:
- profiles/security-profiles-operator.json
- profiles/selinuxd.cil
- profiles/selinuxrecording.cil
- files:
- profiles/security-profiles-operator.json
- profiles/selinuxd.cil
- profiles/selinuxrecording.cil
name: security-profiles-operator-profile

generatorOptions:
disableNameSuffixHash: true
labels:
- includeSelectors: true
pairs:
app: security-profiles-operator
2 changes: 1 addition & 1 deletion deploy/helm/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
labels:
app: security-profiles-operator
name: spod
namespace: security-profiles-operator
namespace: {{ .Release.Namespace }}
spec:
enableSelinux: {{ .Values.enableSelinux }}
enableLogEnricher: {{ .Values.enableLogEnricher }}
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
app: security-profiles-operator
{{- include "security-profiles-operator.labels" . | nindent 4 }}
name: security-profiles-operator
namespace: security-profiles-operator
namespace: {{ .Release.Namespace }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
Expand Down
42 changes: 22 additions & 20 deletions deploy/helm/templates/static-resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@ metadata:
pod-security.kubernetes.io/audit: privileged
pod-security.kubernetes.io/enforce: privileged
pod-security.kubernetes.io/warn: privileged
name: security-profiles-operator
name: '{{ .Release.Namespace }}'
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: security-profiles-operator
name: security-profiles-operator
namespace: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: security-profiles-operator
name: spod
namespace: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: security-profiles-operator
name: spo-webhook
namespace: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down Expand Up @@ -294,7 +294,7 @@ metadata:
labels:
app: security-profiles-operator
name: security-profiles-operator
namespace: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
rules:
- apiGroups:
- coordination.k8s.io
Expand Down Expand Up @@ -508,7 +508,7 @@ metadata:
labels:
app: security-profiles-operator
name: spod
namespace: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
rules:
- apiGroups:
- security.openshift.io
Expand Down Expand Up @@ -619,7 +619,7 @@ metadata:
labels:
app: security-profiles-operator
name: spo-webhook
namespace: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
rules:
- apiGroups:
- coordination.k8s.io
Expand Down Expand Up @@ -650,93 +650,95 @@ metadata:
labels:
app: security-profiles-operator
name: security-profiles-operator
namespace: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: security-profiles-operator
subjects:
- kind: ServiceAccount
name: security-profiles-operator
namespace: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app: security-profiles-operator
name: security-profiles-operator
namespace: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: security-profiles-operator
subjects:
- kind: ServiceAccount
name: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app: security-profiles-operator
name: spod
namespace: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: spod
subjects:
- kind: ServiceAccount
name: spod
namespace: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app: security-profiles-operator
name: spod
namespace: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: spod
subjects:
- kind: ServiceAccount
name: spod
namespace: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app: security-profiles-operator
name: spo-webhook
namespace: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: spo-webhook
subjects:
- kind: ServiceAccount
name: spo-webhook
namespace: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app: security-profiles-operator
name: spo-webhook
namespace: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: spo-webhook
subjects:
- kind: ServiceAccount
name: spo-webhook
namespace: '{{ .Release.Namespace }}'
---
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
Expand Down Expand Up @@ -764,14 +766,15 @@ metadata:
labels:
app: security-profiles-operator
name: spo-metrics-client
namespace: '{{ .Release.Namespace }}'
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: spo-metrics-client
subjects:
- kind: ServiceAccount
name: default
namespace: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
---
apiVersion: v1
kind: Secret
Expand All @@ -781,7 +784,7 @@ metadata:
labels:
app: security-profiles-operator
name: metrics-token
namespace: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
type: kubernetes.io/service-account-token
---
apiVersion: v1
Expand Down Expand Up @@ -926,4 +929,3 @@ metadata:
labels:
app: security-profiles-operator
name: security-profiles-operator-profile
namespace: security-profiles-operator
15 changes: 8 additions & 7 deletions deploy/kustomize-deployment/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

images:
- name: security-profiles-operator
newName: gcr.io/k8s-staging-sp-operator/security-profiles-operator
newTag: latest
- name: security-profiles-operator
newName: gcr.io/k8s-staging-sp-operator/security-profiles-operator
newTag: latest
# For images to be released:
# newName: registry.k8s.io/security-profiles-operator/security-profiles-operator
# newTag: v0.6.1

commonLabels:
app: security-profiles-operator

resources:
- manager_deployment.yaml
- manager_deployment.yaml
labels:
- includeSelectors: true
pairs:
app: security-profiles-operator
2 changes: 1 addition & 1 deletion deploy/namespace-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2944,7 +2944,7 @@ metadata:
labels:
app: security-profiles-operator
name: security-profiles-operator-profile
namespace: security-profiles-operator
namespace: '{{ .Release.Namespace }}'
---
apiVersion: apps/v1
kind: Deployment
Expand Down
Loading

0 comments on commit d0695d9

Please sign in to comment.