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

feature: get namespace name from release command #1499

Merged
merged 9 commits into from
Mar 15, 2023
Merged
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,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
3 changes: 0 additions & 3 deletions deploy/base/role_binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: security-profiles-operator
namespace: security-profiles-operator
tuxerrante marked this conversation as resolved.
Show resolved Hide resolved
subjects:
- kind: ServiceAccount
name: security-profiles-operator
Expand Down Expand Up @@ -32,7 +31,6 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: spod
namespace: security-profiles-operator
subjects:
- kind: ServiceAccount
name: spod
Expand Down Expand Up @@ -62,7 +60,6 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: spo-webhook
namespace: security-profiles-operator
subjects:
- kind: ServiceAccount
name: spo-webhook
Expand Down
9 changes: 8 additions & 1 deletion deploy/helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ Create chart name and version as used by the chart label.
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common annotations
*/}}
{{- define "security-profiles-operator.annotations" -}}
meta.helm.sh/release-name: {{ include "security-profiles-operator.name" . }}
{{- end }}

{{/*
Common labels
*/}}
Expand All @@ -47,7 +54,7 @@ Selector labels
*/}}
{{- define "security-profiles-operator.selectorLabels" -}}
app.kubernetes.io/name: {{ include "security-profiles-operator.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/instance: {{ include "security-profiles-operator.name" . }}
{{- end }}

{{/*
Expand Down
3 changes: 2 additions & 1 deletion deploy/helm/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ kind: SecurityProfilesOperatorDaemon
metadata:
labels:
app: security-profiles-operator
{{- include "security-profiles-operator.labels" . | nindent 4 }}
name: spod
namespace: security-profiles-operator
namespace: {{ .Release.Namespace }}
spec:
enableSelinux: {{ .Values.enableSelinux }}
enableLogEnricher: {{ .Values.enableLogEnricher }}
Expand Down
3 changes: 2 additions & 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 All @@ -18,6 +18,7 @@ spec:
metadata:
annotations:
seccomp.security.alpha.kubernetes.io/pod: runtime/default
{{- include "security-profiles-operator.annotations" . | nindent 8 }}
labels:
app: security-profiles-operator
name: security-profiles-operator
Expand Down
Loading