Skip to content

Commit

Permalink
include a job for migrating storage versions to the latest (#7499)
Browse files Browse the repository at this point in the history
  • Loading branch information
dprotaso committed Apr 10, 2020
1 parent da0adb6 commit f38e976
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DEVELOPMENT.md
Expand Up @@ -199,8 +199,8 @@ ko apply -f config/

# Run post-install job to setup nice XIP.IO domain name. This only works
# if your Kubernetes LoadBalancer has an IPv4 address.
ko delete -f config/post-install --ignore-not-found
ko apply -f config/post-install
ko delete -f config/post-install/default-domain.yaml --ignore-not-found
ko apply -f config/post-install/default-domain.yaml
```

The above step is equivalent to applying the `serving.yaml` for released
Expand Down
2 changes: 1 addition & 1 deletion config/core/roles/clusterrole.yaml
Expand Up @@ -33,7 +33,7 @@ rules:
resources: ["mutatingwebhookconfigurations", "validatingwebhookconfigurations"]
verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
resources: ["customresourcedefinitions", "customresourcedefinitions/status"]
verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
- apiGroups: ["autoscaling"]
resources: ["horizontalpodautoscalers"]
Expand Down
44 changes: 44 additions & 0 deletions config/post-install/storage-version-migration.yaml
@@ -0,0 +1,44 @@
# Copyright 2020 The Knative Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: batch/v1
kind: Job
metadata:
name: storage-version-migration
namespace: knative-serving
labels:
app: "storage-version-migration"
serving.knative.dev/release: devel
spec:
ttlSecondsAfterFinished: 600
backoffLimit: 10
template:
metadata:
labels:
app: "storage-version-migration"
serving.knative.dev/release: devel
spec:
serviceAccountName: controller
restartPolicy: OnFailure
containers:
- name: migrate
# This is the Go import path for the binary that is containerized
# and substituted here.
image: ko://knative.dev/serving/vendor/knative.dev/pkg/apiextensions/storageversion/cmd/migrate
args:
- "services.serving.knative.dev"
- "configurations.serving.knative.dev"
- "revisions.serving.knative.dev"
- "routes.serving.knative.dev"

6 changes: 5 additions & 1 deletion hack/generate-yamls.sh
Expand Up @@ -51,6 +51,7 @@ rm -fr ${YAML_OUTPUT_DIR}/*.yaml
readonly SERVING_YAML=${YAML_OUTPUT_DIR}/serving.yaml
readonly SERVING_CORE_YAML=${YAML_OUTPUT_DIR}/serving-core.yaml
readonly SERVING_DEFAULT_DOMAIN_YAML=${YAML_OUTPUT_DIR}/serving-default-domain.yaml
readonly SERVING_STORAGE_VERSION_MIGRATE_YAML=${YAML_OUTPUT_DIR}/serving-storage-version-migration.yaml
readonly SERVING_HPA_YAML=${YAML_OUTPUT_DIR}/serving-hpa.yaml
readonly SERVING_CRD_YAML=${YAML_OUTPUT_DIR}/serving-crds.yaml
readonly SERVING_CERT_MANAGER_YAML=${YAML_OUTPUT_DIR}/serving-cert-manager.yaml
Expand Down Expand Up @@ -85,7 +86,9 @@ cd "${YAML_REPO_ROOT}"
echo "Building Knative Serving"
ko resolve ${KO_YAML_FLAGS} -R -f config/300-imagecache.yaml -f config/core/ | "${LABEL_YAML_CMD[@]}" > "${SERVING_CORE_YAML}"

ko resolve ${KO_YAML_FLAGS} -f config/post-install/ | "${LABEL_YAML_CMD[@]}" > "${SERVING_DEFAULT_DOMAIN_YAML}"
ko resolve ${KO_YAML_FLAGS} -f config/post-install/default-domain.yaml | "${LABEL_YAML_CMD[@]}" > "${SERVING_DEFAULT_DOMAIN_YAML}"

ko resolve ${KO_YAML_FLAGS} -f config/post-install/storage-version-migration.yaml | "${LABEL_YAML_CMD[@]}" > "${SERVING_STORAGE_VERSION_MIGRATE_YAML}"

# These don't have images, but ko will concatenate them for us.
ko resolve ${KO_YAML_FLAGS} -f config/core/resources/ -f config/300-imagecache.yaml | "${LABEL_YAML_CMD[@]}" > "${SERVING_CRD_YAML}"
Expand Down Expand Up @@ -152,6 +155,7 @@ cat << EOF > ${YAML_LIST_FILE}
${SERVING_YAML}
${SERVING_CORE_YAML}
${SERVING_DEFAULT_DOMAIN_YAML}
${SERVING_STORAGE_VERSION_MIGRATE_YAML}
${SERVING_HPA_YAML}
${SERVING_CRD_YAML}
${SERVING_CERT_MANAGER_YAML}
Expand Down

0 comments on commit f38e976

Please sign in to comment.