-
Notifications
You must be signed in to change notification settings - Fork 69
/
update-manifests.sh
executable file
·253 lines (203 loc) · 8.53 KB
/
update-manifests.sh
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
#!/usr/bin/env bash
set -Eeuo pipefail
root="$(dirname "$(dirname "$(dirname "$(realpath "${BASH_SOURCE[0]}")")")")"
# Source the main vars file to get the serving/eventing version to be used.
# shellcheck disable=SC1091,SC1090
source "$root/hack/lib/__sources__.bash"
# These files could in theory change from release to release, though their names should
# be fairly stable.
serving_files=(serving-crds serving-core serving-hpa serving-post-install-jobs)
eventing_files=(eventing-crds.yaml eventing-core.yaml in-memory-channel.yaml mt-channel-broker.yaml eventing-post-install.yaml eventing-tls-networking.yaml)
eventing_istio_files=(eventing-istio-controller.yaml)
backstage_plugins_files=(backstage-plugins-eventmesh-backend.yaml)
# This excludes the gateways and peerauthentication settings as we want customers to do
# manipulate those.
istio_files=(net-istio-core)
kourier_files=(net-kourier)
export KNATIVE_EVENTING_MANIFESTS_DIR=${KNATIVE_EVENTING_MANIFESTS_DIR:-""}
export KNATIVE_EVENTING_ISTIO_MANIFESTS_DIR=${KNATIVE_EVENTING_ISTIO_MANIFESTS_DIR:-""}
export KNATIVE_BACKSTAGE_PLUGINS_MANIFESTS_DIR=${KNATIVE_BACKSTAGE_PLUGINS_MANIFESTS_DIR:-""}
export KNATIVE_SERVING_MANIFESTS_DIR=${KNATIVE_SERVING_MANIFESTS_DIR:-""}
export KNATIVE_SERVING_TEST_MANIFESTS_DIR=${KNATIVE_SERVING_TEST_MANIFESTS_DIR:-""}
function download_serving {
component=$1
shift
files=("$@")
echo "Files: ${files[*]}"
component_dir="$root/openshift-knative-operator/cmd/openshift-knative-operator/kodata/knative-${component}"
target_dir="${component_dir}/latest"
rm -r "$component_dir"
mkdir -p "$target_dir"
for (( i=0; i<${#files[@]}; i++ ));
do
index=$(( i+1 ))
file="${files[$i]}.yaml"
target_file="$target_dir/$index-$file"
if [[ ${KNATIVE_SERVING_MANIFESTS_DIR} = "" ]]; then
if [[ "${USE_RELEASE_NEXT}" == "true" ]]; then
branch="release-next"
else
branch=$(metadata.get dependencies.serving_artifacts_branch)
fi
url="https://raw.githubusercontent.com/openshift-knative/serving/${branch}/openshift/release/artifacts/$file"
echo "Downloading file from ${url}"
wget --no-check-certificate "$url" -O "$target_file"
else
cp "${KNATIVE_SERVING_MANIFESTS_DIR}/${file}" "$target_file"
fi
# Break all image references so we know our overrides work correctly.
yaml.break_image_references "$target_file"
done
}
function download_eventing {
component=$1
shift
files=("$@")
echo "Files: ${files[*]}"
component_dir="$root/openshift-knative-operator/cmd/openshift-knative-operator/kodata/knative-${component}"
target_dir="${component_dir}/latest"
rm -r "$component_dir"
mkdir -p "$target_dir"
for ((i = 0; i < ${#files[@]}; i++)); do
index=$(( i+1 ))
file="${files[$i]}"
target_file="$target_dir/$index-$file"
if [[ ${KNATIVE_EVENTING_MANIFESTS_DIR} = "" ]]; then
if [[ "${USE_RELEASE_NEXT}" == "true" ]]; then
branch="release-next"
else
branch=$(metadata.get dependencies.eventing_artifacts_branch)
fi
url="https://raw.githubusercontent.com/openshift-knative/eventing/${branch}/openshift/release/artifacts/$file"
echo "Downloading file from ${url}"
wget --no-check-certificate "$url" -O "$target_file"
else
cp "${KNATIVE_EVENTING_MANIFESTS_DIR}/${file}" "$target_file"
fi
# Break all image references so we know our overrides work correctly.
yaml.break_image_references "$target_file"
done
}
function download_eventing_istio {
component=$1
shift
files=("$@")
echo "Files: ${files[*]}"
component_dir="$root/openshift-knative-operator/cmd/openshift-knative-operator/kodata/knative-${component}"
target_dir="${component_dir}/latest"
for ((i = 0; i < ${#files[@]}; i++)); do
index=$(( i+1 ))
file="${files[$i]}"
target_file="$target_dir/$index-$file"
if [[ ${KNATIVE_EVENTING_ISTIO_MANIFESTS_DIR} = "" ]]; then
if [[ "${USE_RELEASE_NEXT}" == "true" ]]; then
branch="release-next"
else
branch=$(metadata.get dependencies.eventing_istio_artifacts_branch)
fi
url="https://raw.githubusercontent.com/openshift-knative/eventing-istio/${branch}/openshift/release/artifacts/$file"
echo "Downloading file from ${url}"
wget --no-check-certificate "$url" -O "$target_file"
else
cp "${KNATIVE_EVENTING_ISTIO_MANIFESTS_DIR}/${file}" "$target_file"
fi
# Break all image references so we know our overrides work correctly.
yaml.break_image_references "$target_file"
done
}
function download_backstage_plugins {
component=$1
shift
files=("$@")
echo "Files: ${files[*]}"
component_dir="$root/openshift-knative-operator/cmd/openshift-knative-operator/kodata/knative-${component}"
target_dir="${component_dir}/latest"
for ((i = 0; i < ${#files[@]}; i++)); do
index=$(( i+1 ))
file="${files[$i]}"
target_file="$target_dir/$index-$file"
if [[ ${KNATIVE_BACKSTAGE_PLUGINS_MANIFESTS_DIR} = "" ]]; then
if [[ "${USE_RELEASE_NEXT}" == "true" ]]; then
branch="release-next"
else
branch=$(metadata.get dependencies.backstage_plugins_artifacts_branch)
fi
url="https://raw.githubusercontent.com/openshift-knative/backstage-plugins/${branch}/openshift/release/artifacts/$file"
echo "Downloading file from ${url}"
wget --no-check-certificate "$url" -O "$target_file"
else
cp "${KNATIVE_BACKSTAGE_PLUGINS_MANIFESTS_DIR}/${file}" "$target_file"
fi
# Break all image references so we know our overrides work correctly.
yaml.break_image_references "$target_file"
done
}
function download_ingress {
component=$1
ingress_dir=$2
subdir=$3
shift
shift
shift
mkdir -p "$ingress_dir/$subdir"
files=("$@")
echo "Files: ${files[*]}"
branch=$(metadata.get "dependencies.${component/-/_}_artifacts_branch")
for (( i=0; i<${#files[@]}; i++ ));
do
index=$(( i+1 ))
file="${files[$i]}.yaml"
ingress_target_file="$ingress_dir/$subdir/$index-$file"
url="https://raw.githubusercontent.com/openshift-knative/${component}/${branch}/openshift/release/artifacts/$file"
wget --no-check-certificate "$url" -O "$ingress_target_file"
# Break all image references so we know our overrides work correctly.
yaml.break_image_references "$ingress_target_file"
done
}
function download_eventing_tls_testing_resources {
files=("$@")
echo "Files: ${files[*]}"
component_dir="$root/hack/lib/certmanager_resources"
target_dir="${component_dir}"
branch=$(metadata.get dependencies.eventing_artifacts_branch)
for ((i = 0; i < ${#files[@]}; i++)); do
index=$(( i+1 ))
file="${files[$i]}"
target_file="$target_dir/$file"
url="https://raw.githubusercontent.com/openshift-knative/eventing/${branch}/openshift/tls/issuers/$file"
echo "Downloading file from ${url}"
wget --no-check-certificate "$url" -O "$target_file"
# Break all image references so we know our overrides work correctly.
yaml.break_image_references "$target_file"
done
}
#
# DOWNLOAD SERVING
#
# When openshift-knative/serving uses this repo to run a job (eg. PR against openshift-knative/serving) it will use a minimum
# setup with net-kourier. Thus it will not use the release artifacts generated under openshift-knative-operator/cmd/kodata/knative-serving.
# Instead openshift-knative/serving uses its own generated ci manifests and sets KNATIVE_SERVING_TEST_MANIFESTS_DIR.
# Extensive Serving testing is done at this repo only. For the latter we do use manifests under openshift-knative-operator/cmd/kodata/knative-serving which are fetched from the midstream
# repo.
if [[ ${KNATIVE_SERVING_TEST_MANIFESTS_DIR} = "" ]]; then
download_serving serving "${serving_files[@]}"
fi
#
# DOWNLOAD INGRESS
#
# clean up ingreess_dir
ingress_root_dir="$root/openshift-knative-operator/cmd/openshift-knative-operator/kodata/ingress/"
rm -rf "${ingress_root_dir}"
ingress_dir="${ingress_root_dir}/latest"
mkdir -p "${ingress_dir}"
# ingress_dir has to contain a sub folder for each ingress
# that corresponds to the string in https://github.com/knative/operator/blob/main/pkg/reconciler/knativeserving/ingress/ingress.go#L76
download_ingress net-istio "${ingress_dir}" "istio" "${istio_files[@]}"
download_ingress net-kourier "${ingress_dir}" "kourier" "${kourier_files[@]}"
#
# DOWNLOAD EVENTING
#
download_eventing eventing "${eventing_files[@]}"
download_eventing_istio eventing "${eventing_istio_files[@]}"
download_eventing_tls_testing_resources "ca-certificate.yaml" "eventing-ca-issuer.yaml" "selfsigned-issuer.yaml"
download_backstage_plugins eventing "${backstage_plugins_files[@]}"