Skip to content
Merged
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
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,16 @@ help: ## Display this help.
.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role crd paths="./api/...;./onmetal-api-net/..." output:crd:artifacts:config=config/onmetal-api-net/crd/bases output:rbac:artifacts:config=config/onmetal-api-net/rbac

# apinetlet
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role paths="./apinetlet/..." output:rbac:artifacts:config=config/apinetlet/rbac

# poollet system roles
cp config/apinetlet/apinet-rbac/role.yaml config/onmetal-api-net/rbac/apinetlet_role.yaml
./hack/replace.sh config/onmetal-api-net/rbac/apinetlet_role.yaml 's/apinet-role/apinet.api.onmetal.de:system:apinetlets/g'
./hack/replace.sh config/onmetal-api-net/rbac/apinetlet_role.yaml 's/Role/ClusterRole/g'
./hack/replace.sh config/onmetal-api-net/rbac/apinetlet_role.yaml '/namespace: system/d'

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
Expand Down
66 changes: 46 additions & 20 deletions config/onmetal-api-net/rbac/apinetlet_role.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,57 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: apinet.api.onmetal.de:system:apinetlets
rules:
- apiGroups:
- apinet.api.onmetal.de
- apinet.api.onmetal.de
resources:
- networks
- networks
verbs:
- get
- list
- patch
- update
- watch
- create
- delete
- get
- list
- patch
- update
- watch
- create
- delete
- deletecollection
- apiGroups:
- apinet.api.onmetal.de
- apinet.api.onmetal.de
resources:
- publicips
- publicips
verbs:
- get
- list
- patch
- update
- watch
- create
- delete
- get
- list
- patch
- update
- watch
- create
- delete
- deletecollection
- apiGroups:
- certificates.k8s.io
resources:
- certificatesigningrequests
verbs:
- create
- get
- list
- watch
- apiGroups:
- certificates.k8s.io
resources:
- certificatesigningrequests/networkpluginclient
verbs:
- create
- apiGroups:
- ""
resources:
- secrets
verbs:
- create
- get
- list
- patch
- update
- watch
11 changes: 11 additions & 0 deletions hack/replace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail

FILE="$1"
EXPRESSION="$2"

sed "$EXPRESSION" "$FILE" > "$FILE.bak"
mv "$FILE.bak" "$FILE"