Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
operator-controller/scripts/install.tpl.sh at main · nader-ziada/operator-controller · GitHub
Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
nader-ziada
operator-controller
Repository navigation
Code
Pull requests
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
operator-controller
/
scripts
/
install.tpl.sh
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
134 lines (111 loc) · 4.44 KB
main
Breadcrumbs
operator-controller
/
scripts
/
install.tpl.sh
Copy path
Top
File metadata and controls
Code
Blame
134 lines (111 loc) · 4.44 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!
/bin/bash
set
-euo pipefail
IFS=
$'
\n\t
'
olmv1_manifest=
$MANIFEST
olmv1_namespace=olmv1-system
usage
() {
cmd=
$(
basename
$0
)
cat
<<
EOF
NAME
${cmd}
- install OLMv1 into a cluster
SYNOPSIS
${cmd}
[-n <namespace>] [-h]
DESCRIPTION
Installs OLMv1 in the provided <namespace> with cert-manager.
A kubernetes configuration must already be present.
-n <namespace>
install OLMv1 in the given <namespace>. Defaults to olmv1-system.
-h
help (this text)
EOF
exit
0
}
while
getopts
n:h opt
;
do
case
${opt}
in
n) olmv1_namespace=
${OPTARG}
;;
h) usage ;;
*
)
echo
"
Unknown option
"
>&2
exit
1
esac
done
if
[[
-z
"
$olmv1_manifest
"
]]
;
then
echo
"
Error: Missing required MANIFEST variable
"
exit
1
fi
default_catalogs_manifest=
$DEFAULT_CATALOG
cert_mgr_version=
$CERT_MGR_VERSION
install_default_catalogs=
$INSTALL_DEFAULT_CATALOGS
catalog_wait_timeout=
${CATALOG_WAIT_TIMEOUT
:-
60s}
if
[[
-z
"
$cert_mgr_version
"
]]
;
then
echo
"
Error: Missing CERT_MGR_VERSION variable
"
exit
1
fi
kubectl_wait
() {
namespace=
$1
runtime=
$2
timeout=
$3
kubectl
wait
--for=condition=Available --namespace=
"
${namespace}
"
"
${runtime}
"
--timeout=
"
${timeout}
"
}
kubectl_wait_rollout
() {
namespace=
$1
runtime=
$2
timeout=
$3
kubectl rollout status --namespace=
"
${namespace}
"
"
${runtime}
"
--timeout=
"
${timeout}
"
}
kubectl_wait_for_query
() {
manifest=
$1
query=
$2
timeout=
$3
poll_interval_in_seconds=
$4
if
[[
-z
"
$manifest
"
||
-z
"
$query
"
||
-z
"
$timeout
"
||
-z
"
$poll_interval_in_seconds
"
]]
;
then
echo
"
Error: Missing arguments.
"
echo
"
Usage: kubectl_wait_for_query <manifest> <query> <timeout> <poll_interval_in_seconds>
"
exit
1
fi
start_time=
$(
date +%s
)
while
true
;
do
val=
$(
kubectl get
"
${manifest}
"
-o jsonpath=
"
${query}
"
2>
/dev/null
||
echo
"
"
)
if
[[
-n
"
${val}
"
]]
;
then
echo
"
${manifest}
has
${query}
.
"
break
fi
if
[[
$((
$(date
+%
s)
-
start_time
))
-ge
${timeout}
]]
;
then
echo
"
Timed out waiting for
${manifest}
to have
${query}
.
"
exit
1
fi
sleep
${poll_interval_in_seconds}
s
done
}
#
Install cert-manager only if it is not already present on the cluster.
#
Check both the CRD and the controller deployments to avoid false positives
#
from stale CRDs left behind by a partial or incomplete installation.
if
kubectl get crd certificates.cert-manager.io
&
>
/dev/null
&&
\
kubectl get deployment -n cert-manager cert-manager-webhook
&
>
/dev/null
&&
\
kubectl get deployment -n cert-manager cert-manager-cainjector
&
>
/dev/null
;
then
echo
"
cert-manager is already installed, skipping installation
"
else
kubectl apply -f
"
https://github.com/cert-manager/cert-manager/releases/download/
${cert_mgr_version}
/cert-manager.yaml
"
fi
#
Wait for cert-manager to be fully ready
kubectl_wait
"
cert-manager
"
"
deployment/cert-manager-webhook
"
"
60s
"
kubectl_wait
"
cert-manager
"
"
deployment/cert-manager-cainjector
"
"
60s
"
kubectl_wait
"
cert-manager
"
"
deployment/cert-manager
"
"
60s
"
kubectl_wait_for_query
"
mutatingwebhookconfigurations/cert-manager-webhook
"
'
{.webhooks[0].clientConfig.caBundle}
'
60 5
kubectl_wait_for_query
"
validatingwebhookconfigurations/cert-manager-webhook
"
'
{.webhooks[0].clientConfig.caBundle}
'
60 5
#
Change the file into a file:// url
if
[
-f
"
${olmv1_manifest}
"
]
;
then
olmv1_manifest=file://localhost
$(
realpath
${olmv1_manifest}
)
fi
#
Clean up old RBAC resources from previous releases. The ClusterRoleBinding was
#
renamed and the custom ClusterRole replaced with cluster-admin.
kubectl delete clusterrolebinding operator-controller-manager-rolebinding operator-controller-manager-admin-rolebinding --ignore-not-found
kubectl delete clusterrole operator-controller-manager-role --ignore-not-found
curl -L -s
"
${olmv1_manifest}
"
|
sed
"
s/olmv1-system/
${olmv1_namespace}
/g
"
|
kubectl apply -f -
#
Wait for the rollout, and then wait for the deployment to be Available
kubectl_wait_rollout
"
${olmv1_namespace}
"
"
deployment/catalogd-controller-manager
"
"
60s
"
kubectl_wait
"
${olmv1_namespace}
"
"
deployment/catalogd-controller-manager
"
"
60s
"
kubectl_wait
"
${olmv1_namespace}
"
"
deployment/operator-controller-controller-manager
"
"
60s
"
if
[[
"
${install_default_catalogs}
"
!=
"
false
"
]]
;
then
kubectl apply -f
"
${default_catalogs_manifest}
"
kubectl
wait
--for=condition=Serving
"
clustercatalog/operatorhubio
"
--timeout=
"
${catalog_wait_timeout}
"
fi
You can’t perform that action at this time.