mirror of https://github.com/knative/caching.git
generate schema for caching types (#655)
This commit is contained in:
parent
4a0a1e0b73
commit
bd32ea7681
|
@ -27,24 +27,93 @@ spec:
|
|||
plural: images
|
||||
singular: image
|
||||
categories:
|
||||
- knative-internal
|
||||
- caching
|
||||
- knative-internal
|
||||
- caching
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1alpha1
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
# this is a work around so we don't need to flush out the
|
||||
# schema for each version at this time
|
||||
#
|
||||
# see issue: https://github.com/knative/serving/issues/912
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
additionalPrinterColumns:
|
||||
- name: Image
|
||||
type: string
|
||||
jsonPath: .spec.image
|
||||
- name: v1alpha1
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: Image is a Knative abstraction that encapsulates the interface by which Knative components express a desire to have a particular image cached.
|
||||
type: object
|
||||
properties:
|
||||
apiVersion:
|
||||
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
|
||||
type: string
|
||||
kind:
|
||||
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
|
||||
type: string
|
||||
metadata:
|
||||
type: object
|
||||
spec:
|
||||
description: Spec holds the desired state of the Image (from the client).
|
||||
type: object
|
||||
required:
|
||||
- image
|
||||
properties:
|
||||
image:
|
||||
description: Image is the name of the container image url to cache across the cluster.
|
||||
type: string
|
||||
imagePullSecrets:
|
||||
description: ImagePullSecrets contains the names of the Kubernetes Secrets containing login information used by the Pods which will run this container.
|
||||
type: array
|
||||
items:
|
||||
description: LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?'
|
||||
type: string
|
||||
x-kubernetes-map-type: atomic
|
||||
serviceAccountName:
|
||||
description: 'ServiceAccountName is the name of the Kubernetes ServiceAccount as which the Pods will run this container. This is potentially used to authenticate the image pull if the service account has attached pull secrets. For more information: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#add-imagepullsecrets-to-a-service-account'
|
||||
type: string
|
||||
status:
|
||||
description: Status communicates the observed state of the Image (from the controller).
|
||||
type: object
|
||||
properties:
|
||||
annotations:
|
||||
description: Annotations is additional Status fields for the Resource to save some additional State as well as convey more information to the user. This is roughly akin to Annotations on any k8s resource, just the reconciler conveying richer information outwards.
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: string
|
||||
conditions:
|
||||
description: Conditions the latest available observations of a resource's current state.
|
||||
type: array
|
||||
items:
|
||||
description: 'Condition defines a readiness condition for a Knative resource. See: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties'
|
||||
type: object
|
||||
required:
|
||||
- status
|
||||
- type
|
||||
properties:
|
||||
lastTransitionTime:
|
||||
description: LastTransitionTime is the last time the condition transitioned from one status to another. We use VolatileTime in place of metav1.Time to exclude this from creating equality.Semantic differences (all other things held constant).
|
||||
type: string
|
||||
message:
|
||||
description: A human readable message indicating details about the transition.
|
||||
type: string
|
||||
reason:
|
||||
description: The reason for the condition's last transition.
|
||||
type: string
|
||||
severity:
|
||||
description: Severity with which to treat failures of this type of condition. When this is not specified, it defaults to Error.
|
||||
type: string
|
||||
status:
|
||||
description: Status of the condition, one of True, False, Unknown.
|
||||
type: string
|
||||
type:
|
||||
description: Type of condition.
|
||||
type: string
|
||||
observedGeneration:
|
||||
description: ObservedGeneration is the 'Generation' of the Service that was last processed by the controller.
|
||||
type: integer
|
||||
format: int64
|
||||
additionalPrinterColumns:
|
||||
- name: Image
|
||||
type: string
|
||||
jsonPath: .spec.image
|
||||
|
|
|
@ -48,3 +48,7 @@ group "Update deps post-codegen"
|
|||
|
||||
# Make sure our dependencies are up-to-date
|
||||
${REPO_ROOT_DIR}/hack/update-deps.sh
|
||||
|
||||
group "Generating schemas"
|
||||
|
||||
${REPO_ROOT_DIR}/hack/update-schemas.sh
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2022 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
|
||||
#
|
||||
# http://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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
||||
|
||||
go run sigs.k8s.io/controller-tools/cmd/controller-gen@v0.9.2 \
|
||||
schemapatch:manifests=config/,generateEmbeddedObjectMeta=false \
|
||||
output:dir=config \
|
||||
paths=./pkg/apis/...
|
||||
|
|
@ -19,7 +19,7 @@ set -o nounset
|
|||
set -o pipefail
|
||||
|
||||
readonly REPO_ROOT_DIR="$(git rev-parse --show-toplevel)"
|
||||
readonly TMP_DIFFROOT="$(mktemp -d -p ${REPO_ROOT_DIR})"
|
||||
readonly TMP_DIFFROOT="$(mktemp -d ${REPO_ROOT_DIR}/tmpdiffroot.XXXXXX)"
|
||||
|
||||
cleanup() {
|
||||
rm -rf "${TMP_DIFFROOT}"
|
||||
|
@ -33,16 +33,20 @@ cleanup
|
|||
mkdir -p "${TMP_DIFFROOT}/pkg"
|
||||
cp -aR "${REPO_ROOT_DIR}/go.sum" "${REPO_ROOT_DIR}/pkg" "${REPO_ROOT_DIR}/vendor" "${TMP_DIFFROOT}"
|
||||
|
||||
mkdir -p "${TMP_DIFFROOT}/config"
|
||||
cp -a "${REPO_ROOT_DIR}/config"/* "${TMP_DIFFROOT}/config"
|
||||
|
||||
# TODO(mattmoor): We should be able to rm -rf pkg/client/ and vendor/
|
||||
|
||||
"${REPO_ROOT_DIR}/hack/update-codegen.sh"
|
||||
echo "Diffing ${REPO_ROOT_DIR} against freshly generated codegen"
|
||||
ret=0
|
||||
diff -Naupr "${REPO_ROOT_DIR}/pkg" "${TMP_DIFFROOT}/pkg" || ret=1
|
||||
diff -Naupr --no-dereference "${REPO_ROOT_DIR}/vendor" "${TMP_DIFFROOT}/vendor" || ret=1
|
||||
diff -Nupr --no-dereference "${REPO_ROOT_DIR}/config" "${TMP_DIFFROOT}/config" || ret=1
|
||||
diff -Nupr --no-dereference "${REPO_ROOT_DIR}/pkg" "${TMP_DIFFROOT}/pkg" || ret=1
|
||||
diff -Nupr --no-dereference "${REPO_ROOT_DIR}/vendor" "${TMP_DIFFROOT}/vendor" || ret=1
|
||||
|
||||
# Restore working tree state
|
||||
rm -fr "${TMP_DIFFROOT}/config"
|
||||
rm -fr "${REPO_ROOT_DIR}/config"
|
||||
rm -fr "${REPO_ROOT_DIR}/go.sum" "${REPO_ROOT_DIR}/pkg" "${REPO_ROOT_DIR}/vendor"
|
||||
cp -aR "${TMP_DIFFROOT}"/* "${REPO_ROOT_DIR}"
|
||||
|
||||
|
|
Loading…
Reference in New Issue