Skip to content

Commit 9cba775

Browse files
committedOct 1, 2021
Adde more role items
1 parent 52b7b16 commit 9cba775

10 files changed

+92
-2
lines changed
 

‎Dockerfile

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM golang:1.16 as builder
2+
FROM registry.access.redhat.com/ubi8/go-toolset:1.15.7 as builder
33

44
WORKDIR /workspace
55
# Copy the Go Modules manifests
@@ -14,8 +14,10 @@ COPY main.go main.go
1414
COPY api/ api/
1515
COPY controllers/ controllers/
1616

17+
USER 0
18+
1719
# Build
18-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go
20+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o manager main.go
1921

2022
# Use distroless as minimal base image to package the manager binary
2123
# Refer to https://github.com/GoogleContainerTools/distroless for more details

‎Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ release: manifests kustomize controller-gen
7979

8080
##@ Development
8181

82+
build-template: manifests kustomize controller-gen
83+
$(KUSTOMIZE) build config/deployment-template | ./manifest2template.py > deploy.yml
84+
8285
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
8386
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
8487

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Adds namespace to all resources.
2+
namespace: frontend-operator-system
3+
4+
# Value of this field is prepended to the
5+
# names of all resources, e.g. a deployment named
6+
# "wordpress" becomes "alices-wordpress".
7+
# Note that it should also match with the prefix (text before '-') of the namespace
8+
# field above.
9+
namePrefix: frontend-operator-
10+
11+
# Labels to add to all resources and selectors.
12+
#commonLabels:
13+
# someName: someValue
14+
15+
bases:
16+
- ../crd
17+
- ../rbac
18+
- ../manager
19+
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
20+
# crd/kustomization.yaml
21+
#- ../webhook
22+
23+
patchesStrategicMerge:
24+
- manager.yaml # Put template param refs into image field
25+
26+
vars: []
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: controller-manager
5+
namespace: system
6+
spec:
7+
template:
8+
spec:
9+
containers:
10+
- image: ${IMAGE}:${IMAGE_TAG}
11+
name: manager

‎config/rbac/bundle_viewer_role.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ apiVersion: rbac.authorization.k8s.io/v1
33
kind: ClusterRole
44
metadata:
55
name: bundle-viewer-role
6+
labels:
7+
rbac.authorization.k8s.io/aggregate-to-view: "true"
68
rules:
79
- apiGroups:
810
- cloud.redhat.com

‎config/rbac/frontend_viewer_role.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ apiVersion: rbac.authorization.k8s.io/v1
33
kind: ClusterRole
44
metadata:
55
name: frontend-viewer-role
6+
labels:
7+
rbac.authorization.k8s.io/aggregate-to-view: "true"
8+
69
rules:
710
- apiGroups:
811
- cloud.redhat.com

‎config/rbac/frontendenvironment_viewer_role.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ apiVersion: rbac.authorization.k8s.io/v1
33
kind: ClusterRole
44
metadata:
55
name: frontendenvironment-viewer-role
6+
labels:
7+
rbac.authorization.k8s.io/aggregate-to-view: "true"
68
rules:
79
- apiGroups:
810
- cloud.redhat.com

‎config/rbac/kustomization.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,9 @@ resources:
1616
- auth_proxy_role.yaml
1717
- auth_proxy_role_binding.yaml
1818
- auth_proxy_client_clusterrole.yaml
19+
- frontend_editor_role.yaml
20+
- frontend_viewer_role.yaml
21+
- frontendenvironment_editor_role.yaml
22+
- frontendenvironment_viewer_role.yaml
23+
- bundle_editor_role.yaml
24+
- bundle_viewer_role.yaml

‎manifest2template.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env python3
2+
3+
import yaml
4+
import sys
5+
6+
yamls = yaml.safe_load_all(sys.stdin)
7+
8+
with open("template.yml") as fp:
9+
template = yaml.safe_load(fp)
10+
11+
template["objects"].extend(yamls)
12+
13+
print(yaml.dump(template))

‎template.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: v1
2+
kind: Template
3+
metadata:
4+
name: clowder
5+
parameters:
6+
- name: IMAGE_TAG
7+
value: latest
8+
- name: IMAGE
9+
value: quay.io/cloudservices/frontend-operator
10+
- name: DEBUG_TRIGGERS
11+
value: "false"
12+
- name: DEBUG_CACHE_CREATE
13+
value: "false"
14+
- name: DEBUG_CACHE_UPDATE
15+
value: "false"
16+
- name: DEBUG_CACHE_APPLY
17+
value: "false"
18+
- name: CREATE_SERVICE_MONITORS
19+
value: "false"
20+
- name: WATCH_STRIMZI_RESOURCES
21+
value: "false"
22+
objects: []

0 commit comments

Comments
 (0)
Please sign in to comment.