Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include a job to help operators migrate their storage version #7499

Merged
merged 1 commit into from Apr 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
mattmoor marked this conversation as resolved.
Show resolved Hide resolved
# 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}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add docs for this new artifact.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the repo or website?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did it for the website - knative/docs#2369


# 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