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

chore: DENA-828 - bases for k6-operator #356

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 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
28 changes: 28 additions & 0 deletions k6-operator/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.DEFAULT_GOAL := gen-manifests

CHART_VERSION=3.8.0
APP_VERSION=0.0.16


.PHONY: gen-manifests
gen-manifests:
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
helm template k6-operator --namespace dev-enablement -f values.yaml grafana/k6-operator --version $(CHART_VERSION) > /tmp/k6-operator.yaml

yq 'select(.kind=="CustomResourceDefinition" and .metadata.name=="k6s.k6.io")' /tmp/k6-operator.yaml > cluster/k6.yaml
yq 'select(.kind=="CustomResourceDefinition" and .metadata.name=="privateloadzones.k6.io")' /tmp/k6-operator.yaml > cluster/privateloadzones.yaml
yq 'select(.kind=="CustomResourceDefinition" and .metadata.name=="testruns.k6.io")' /tmp/k6-operator.yaml > cluster/testrun.yaml
yq 'select(.kind=="ClusterRole" and .metadata.name!="k6-operator-manager-role")' /tmp/k6-operator.yaml > cluster/clusterRole.yaml
yq 'select(.kind=="ClusterRoleBinding" and .roleRef.name!="k6-operator-manager-role")' /tmp/k6-operator.yaml > cluster/clusterRoleBinding.yaml

yq 'select(.kind=="ClusterRole" and .metadata.name=="k6-operator-manager-role")' /tmp/k6-operator.yaml > namespaced/role.yaml
yq eval -i 'del(.metadata.annotations) | .kind = "Role" | .metadata.namespace = "dev-enablement"' namespaced/role.yaml
yq 'select(.kind=="ClusterRoleBinding" and .roleRef.name=="k6-operator-manager-role")' /tmp/k6-operator.yaml > namespaced/roleBinding.yaml
yq eval -i 'del(.metadata.annotations) | .kind = "RoleBinding" | .metadata.namespace = "dev-enablement" | .roleRef.kind = "Role"' namespaced/roleBinding.yaml

yq 'select(.kind=="ServiceAccount")' /tmp/k6-operator.yaml > controller/serviceaccount.yaml
yq 'select(.kind=="Role")' /tmp/k6-operator.yaml > controller/role.yaml
yq 'select(.kind=="RoleBinding")' /tmp/k6-operator.yaml > controller/roleBinding.yaml
yq 'select(.kind=="Service")' /tmp/k6-operator.yaml > controller/service.yaml
yq 'select(.kind=="Deployment")' /tmp/k6-operator.yaml > controller/deployment.yaml
93 changes: 93 additions & 0 deletions k6-operator/cluster/clusterRole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Source: k6-operator/templates/clusterRole.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: k6-operator-metrics-reader
labels:
helm.sh/chart: k6-operator-3.8.0
app.kubernetes.io/name: k6-operator
app.kubernetes.io/instance: k6-operator
app.kubernetes.io/version: "0.0.16"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/part-of: k6-operator
annotations:
rules:
- nonResourceURLs:
- /metrics
verbs:
- get
---
# Source: k6-operator/templates/clusterRole.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: k6-operator-proxy-role
labels:
helm.sh/chart: k6-operator-3.8.0
app.kubernetes.io/name: k6-operator
app.kubernetes.io/instance: k6-operator
app.kubernetes.io/version: "0.0.16"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/part-of: k6-operator
annotations:
rules:
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
---
# Source: k6-operator/templates/clusterRole.yaml
# permissions for end users to edit privateloadzones.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: privateloadzone-editor-role
rules:
- apiGroups:
- k6.io
resources:
- privateloadzones
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- k6.io
resources:
- privateloadzones/status
verbs:
- get
---
# Source: k6-operator/templates/clusterRole.yaml
# permissions for end users to view privateloadzones.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: privateloadzone-viewer-role
rules:
- apiGroups:
- k6.io
resources:
- privateloadzones
verbs:
- get
- list
- watch
- apiGroups:
- k6.io
resources:
- privateloadzones/status
verbs:
- get
15 changes: 15 additions & 0 deletions k6-operator/cluster/clusterRoleBinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Source: k6-operator/templates/clusterRoleBinding.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: k6-operator-proxy-rolebinding
labels:
annotations:
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: k6-operator-proxy-role
subjects:
- kind: ServiceAccount
name: k6-operator-controller
namespace: dev-enablement
Loading
Loading