This repository was archived by the owner on Jan 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
96 lines (86 loc) · 3.37 KB
/
generate-operator.yaml
File metadata and controls
96 lines (86 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Generate Operator
on:
workflow_call:
inputs:
version:
required: false
type: string
workflow_dispatch:
jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install operator-sdk
run: |
export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)
export OS=$(uname | awk '{print tolower($0)}')
export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v1.26.0
curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
chmod +x operator-sdk_${OS}_${ARCH} && sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk
- name: Initialize Operator
run: |
rm -rf github-arc-operator
mkdir github-arc-operator
cd github-arc-operator
operator-sdk init \
--plugins helm \
--domain boxboat.com \
--group github-practice \
--helm-chart actions-runner-controller \
--helm-chart-repo https://actions-runner-controller.github.io/actions-runner-controller
- name: Configure Operator Manifests
run: |
# modify operator manifests with yq
yq -i eval '.spec.template.spec.containers[0].resources.limits.memory = "500Mi"' \
github-arc-operator/config/manager/manager.yaml
yq -i eval '.rules += [
{
"apiGroups": ["apiextensions.k8s.io"],
"resources": ["customresourcedefinitions"],
"verbs": ["*"]
},
{
"apiGroups": ["cert-manager.io"],
"resources": ["certificates", "issuers"],
"verbs": ["*"]
},
{
"apiGroups": [""],
"resources": ["serviceaccounts", "namespaces"],
"verbs": ["*"]
},
{
"apiGroups": ["rbac.authorization.k8s.io"],
"resources": ["clusterrolebindings", "clusterroles", "roles", "rolebindings"],
"verbs": ["*"]
},
{
"apiGroups": ["admissionregistration.k8s.io"],
"resources": ["mutatingwebhookconfigurations", "validatingwebhookconfigurations"],
"verbs": ["*"]
},
{
"apiGroups": ["security.openshift.io"],
"resources": ["securitycontextconstraints"],
"verbs": ["*"]
}
]' \
github-arc-operator/config/rbac/role.yaml
# copy Cluster Service Version (CSV)
mkdir -p github-arc-operator/config/manifests/bases &&\
cp overlays/github-arc-operator.clusterserviceversion.yaml "$_"
# add permissions to manager role
./chart-patch.sh
# add security context constraint templates to chart
cp overlays/scc_template/* github-arc-operator/helm-charts/actions-runner-controller/templates
cat overlays/scc_values.yaml >> github-arc-operator/helm-charts/actions-runner-controller/values.yaml
# simplify sample
cp samples/simple-sample.yaml github-arc-operator/config/samples/github-practice_v1alpha1_actionsrunnercontroller.yaml
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
branch: new-release
title: Regenerated operator for new chart version ${{ inputs.version }}