Skip to content

Commit e87cc0c

Browse files
committed
drop generated bundles, switch to make build-installer
1 parent 9021d0a commit e87cc0c

23 files changed

+16515
-24874
lines changed

.github/workflows/update-images.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ jobs:
194194
sudo mv operator-sdk /usr/local/bin/
195195
make test
196196
make docker-build IMG=kctf-operator
197+
make build-installer IMG=kctf-operator
198+
mv dist/install.yaml ../dist/resources/install.yaml
197199
198200
- id: push
199201
name: Push images
@@ -250,7 +252,7 @@ jobs:
250252
if: needs.build-operator.outputs.kctf-operator-modified
251253
run: |
252254
IMAGE="gcr.io/${{ secrets.GCR_PROJECT }}/kctf-operator@${{ needs.build-operator.outputs.kctf-operator-digest }}"
253-
sed -i "s#image: .*kctf-operator.*#image: ${IMAGE}#" dist/resources/operator.yaml
255+
sed -i "s#image: .*kctf-operator.*#image: ${IMAGE}#" dist/resources/install.yaml
254256
255257
- name: Download kubectl
256258
run: |
@@ -338,9 +340,8 @@ jobs:
338340
run: |
339341
# git add returns success for files that exist and haven't been modified
340342
git add kctf-operator/resources/constants.go
341-
git add dist/resources/operator.yaml
343+
git add dist/resources/install.yaml
342344
git add kctf-operator/config/crd/bases/kctf.dev_challenges.yaml
343-
git add dist/resources/kctf.dev_challenges.yaml
344345
for dir in dist/challenge-templates/* samples/*; do
345346
if [[ ! -e "${dir}/challenge.yaml" ]]; then
346347
continue

dist/bin/kctf-cluster

+6-10
Original file line numberDiff line numberDiff line change
@@ -393,22 +393,22 @@ function kctf_cluster_ip_ranges {
393393
set_cloud_armor_policy "${RANGES}" || return
394394

395395
# stop the operator
396-
"${KCTF_BIN}/yq" eval "select(.kind == \"Deployment\")" "${KCTF_CTF_DIR}/kctf/resources/operator.yaml" \
396+
"${KCTF_BIN}/yq" eval "select(.kind == \"Deployment\")" "${KCTF_CTF_DIR}/kctf/resources/install.yaml" \
397397
| "${KCTF_BIN}/kubectl" delete -f - || return
398398

399399
start_operator_gce || return
400400
}
401401

402402
function start_operator_gce {
403403
if [[ "${DISABLE_SRC_RANGES}" == "1" ]]; then
404-
"${KCTF_BIN}/kubectl" apply -f "${KCTF_CTF_DIR}/kctf/resources/operator.yaml" || return
404+
"${KCTF_BIN}/kubectl" apply --server-side -f "${KCTF_CTF_DIR}/kctf/resources/install.yaml" || return
405405
else
406406
get_cloud_armor_policy || return
407407
RANGES=$ret
408408
SUFFIX=$(echo "${PROJECT}-${CLUSTER_NAME}-${ZONE}" | sha1sum)
409409
POLICY_NAME="kctf-policy-${SUFFIX:0:16}"
410410
# restart the operator with the new range
411-
"${KCTF_BIN}/yq" eval "(select(.kind == \"Deployment\").spec.template.spec.containers[] | select(.name == \"manager\").env[] | select(.name == \"ALLOWED_IPS\").value) |= \"${RANGES}\"" "${KCTF_CTF_DIR}/kctf/resources/operator.yaml" \
411+
"${KCTF_BIN}/yq" eval "(select(.kind == \"Deployment\").spec.template.spec.containers[] | select(.name == \"manager\").env[] | select(.name == \"ALLOWED_IPS\").value) |= \"${RANGES}\"" "${KCTF_CTF_DIR}/kctf/resources/install.yaml" \
412412
| "${KCTF_BIN}/yq" eval "(select(.kind == \"Deployment\").spec.template.spec.containers[] | select(.name == \"manager\").env[] | select(.name == \"SECURITY_POLICY\").value) |= \"${POLICY_NAME}\"" - \
413413
| "${KCTF_BIN}/kubectl" apply -f - || return
414414
fi
@@ -441,17 +441,13 @@ function create_cloud_armor_policy {
441441
}
442442

443443
function create_operator {
444-
# Creating CRD, rbac and operator
445-
"${KCTF_BIN}/kubectl" apply -f "${KCTF_CTF_DIR}/kctf/resources/kctf.dev_challenges.yaml" || return
446-
"${KCTF_BIN}/kubectl" apply -f "${KCTF_CTF_DIR}/kctf/resources/kctf-operator-metrics-reader_rbac.authorization.k8s.io_v1_clusterrole.yaml" || return
447-
"${KCTF_BIN}/kubectl" apply -f "${KCTF_CTF_DIR}/kctf/resources/kctf-operator-manager-config_v1_configmap.yaml" || return
448-
"${KCTF_BIN}/kubectl" apply -f "${KCTF_CTF_DIR}/kctf/resources/kctf-operator-controller-manager-metrics-service_v1_service.yaml" || return
444+
# install.yaml is an unified file for creating CRD, rbac and operator
449445
if [[ "$CLUSTER_TYPE" == "gce" ]]; then
450446
start_operator_gce || return
451447
else
452-
"${KCTF_BIN}/kubectl" apply -f "${KCTF_CTF_DIR}/kctf/resources/operator.yaml" || return
448+
"${KCTF_BIN}/kubectl" apply --server-side -f "${KCTF_CTF_DIR}/kctf/resources/install.yaml" || return
453449
fi
454-
OPERATOR_IMAGE=$("${KCTF_BIN}/yq" eval '.spec.template.spec.containers[].image | select(.=="*kctf-operator*")' "${KCTF_CTF_DIR}/kctf/resources/operator.yaml")
450+
OPERATOR_IMAGE=$("${KCTF_BIN}/yq" eval '.spec.template.spec.containers[].image | select(.=="*kctf-operator*")' "${KCTF_CTF_DIR}/kctf/resources/install.yaml")
455451
if [[ $? -ne 0 ]]; then
456452
echo "Failed to find the operator image." >&2
457453
return 1

dist/resources/install.yaml

+8,251
Large diffs are not rendered by default.

dist/resources/kctf-operator-controller-manager-metrics-service_v1_service.yaml

-17
This file was deleted.

dist/resources/kctf-operator-manager-config_v1_configmap.yaml

-17
This file was deleted.

dist/resources/kctf-operator-metrics-reader_rbac.authorization.k8s.io_v1_clusterrole.yaml

-10
This file was deleted.

0 commit comments

Comments
 (0)