/*
Copyright The Kubernetes 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.
*/


// This file was autogenerated by go-to-protobuf. Do not edit it manually!

syntax = 'proto2';

package k8s.io.apiextensions_apiserver.pkg.apis.apiextensions.v1beta1;

import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";

// Package-wide variables from generator "generated".
option go_package = "v1beta1";

// ConversionRequest describes the conversion request parameters.
message ConversionRequest {
  // `uid` is an identifier for the individual request/response. It allows us to distinguish instances of requests which are
  // otherwise identical (parallel requests, requests when earlier requests did not modify etc)
  // The UID is meant to track the round trip (request/response) between the KAS and the WebHook, not the user request.
  // It is suitable for correlating log entries between the webhook and apiserver, for either auditing or debugging.
  optional string uid = 1;

  // `desiredAPIVersion` is the version to convert given objects to. e.g. "myapi.example.com/v1"
  optional string desiredAPIVersion = 2;

  // `objects` is the list of CR objects to be converted.
  repeated k8s.io.apimachinery.pkg.runtime.RawExtension objects = 3;
}

// ConversionResponse describes a conversion response.
message ConversionResponse {
  // `uid` is an identifier for the individual request/response.
  // This should be copied over from the corresponding AdmissionRequest.
  optional string uid = 1;

  // `convertedObjects` is the list of converted version of `request.objects` if the `result` is successful otherwise empty.
  // The webhook is expected to set apiVersion of these objects to the ConversionRequest.desiredAPIVersion. The list
  // must also has the same size as input list with the same objects in the same order(i.e. equal UIDs and object meta)
  repeated k8s.io.apimachinery.pkg.runtime.RawExtension convertedObjects = 2;

  // `result` contains the result of conversion with extra details if the conversion failed. `result.status` determines if
  // the conversion failed or succeeded. The `result.status` field is required and represent the success or failure of the
  // conversion. A successful conversion must set `result.status` to `Success`. A failed conversion must set
  // `result.status` to `Failure` and provide more details in `result.message` and return http status 200. The `result.message`
  // will be used to construct an error message for the end user.
  optional k8s.io.apimachinery.pkg.apis.meta.v1.Status result = 3;
}

// ConversionReview describes a conversion request/response.
message ConversionReview {
  // `request` describes the attributes for the conversion request.
  // +optional
  optional ConversionRequest request = 1;

  // `response` describes the attributes for the conversion response.
  // +optional
  optional ConversionResponse response = 2;
}

// CustomResourceColumnDefinition specifies a column for server side printing.
message CustomResourceColumnDefinition {
  // name is a human readable name for the column.
  optional string name = 1;

  // type is an OpenAPI type definition for this column.
  // See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.
  optional string type = 2;

  // format is an optional OpenAPI type definition for this column. The 'name' format is applied
  // to the primary identifier column to assist in clients identifying column is the resource name.
  // See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for more.
  // +optional
  optional string format = 3;

  // description is a human readable description of this column.
  // +optional
  optional string description = 4;

  // priority is an integer defining the relative importance of this column compared to others. Lower
  // numbers are considered higher priority. Columns that may be omitted in limited space scenarios
  // should be given a higher priority.
  // +optional
  optional int32 priority = 5;

  // JSONPath is a simple JSON path, i.e. with array notation.
  optional string JSONPath = 6;
}

// CustomResourceConversion describes how to convert different versions of a CR.
message CustomResourceConversion {
  // `strategy` specifies the conversion strategy. Allowed values are:
  // - `None`: The converter only change the apiVersion and would not touch any other field in the CR.
  // - `Webhook`: API Server will call to an external webhook to do the conversion. Additional information is needed for this option.
  optional string strategy = 1;

  // `webhookClientConfig` is the instructions for how to call the webhook if strategy is `Webhook`. This field is
  // alpha-level and is only honored by servers that enable the CustomResourceWebhookConversion feature.
  // +optional
  optional WebhookClientConfig webhookClientConfig = 2;
}

// CustomResourceDefinition represents a resource that should be exposed on the API server.  Its name MUST be in the format
// <.spec.name>.<.spec.group>.
message CustomResourceDefinition {
  optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;

  // Spec describes how the user wants the resources to appear
  optional CustomResourceDefinitionSpec spec = 2;

  // Status indicates the actual state of the CustomResourceDefinition
  // +optional
  optional CustomResourceDefinitionStatus status = 3;
}

// CustomResourceDefinitionCondition contains details for the current condition of this pod.
message CustomResourceDefinitionCondition {
  // Type is the type of the condition.
  optional string type = 1;

  // Status is the status of the condition.
  // Can be True, False, Unknown.
  optional string status = 2;

  // Last time the condition transitioned from one status to another.
  // +optional
  optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3;

  // Unique, one-word, CamelCase reason for the condition's last transition.
  // +optional
  optional string reason = 4;

  // Human-readable message indicating details about last transition.
  // +optional
  optional string message = 5;
}

// CustomResourceDefinitionList is a list of CustomResourceDefinition objects.
message CustomResourceDefinitionList {
  optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;

  // Items individual CustomResourceDefinitions
  repeated CustomResourceDefinition items = 2;
}

// CustomResourceDefinitionNames indicates the names to serve this CustomResourceDefinition
message CustomResourceDefinitionNames {
  // Plural is the plural name of the resource to serve.  It must match the name of the CustomResourceDefinition-registration
  // too: plural.group and it must be all lowercase.
  optional string plural = 1;

  // Singular is the singular name of the resource.  It must be all lowercase  Defaults to lowercased <kind>
  // +optional
  optional string singular = 2;

  // ShortNames are short names for the resource.  It must be all lowercase.
  // +optional
  repeated string shortNames = 3;

  // Kind is the serialized kind of the resource.  It is normally CamelCase and singular.
  optional string kind = 4;

  // ListKind is the serialized kind of the list for this resource.  Defaults to <kind>List.
  // +optional
  optional string listKind = 5;

  // Categories is a list of grouped resources custom resources belong to (e.g. 'all')
  // +optional
  repeated string categories = 6;
}

// CustomResourceDefinitionSpec describes how a user wants their resource to appear
message CustomResourceDefinitionSpec {
  // Group is the group this resource belongs in
  optional string group = 1;

  // Version is the version this resource belongs in
  // Should be always first item in Versions field if provided.
  // Optional, but at least one of Version or Versions must be set.
  // Deprecated: Please use `Versions`.
  // +optional
  optional string version = 2;

  // Names are the names used to describe this custom resource
  optional CustomResourceDefinitionNames names = 3;

  // Scope indicates whether this resource is cluster or namespace scoped.  Default is namespaced
  optional string scope = 4;

  // Validation describes the validation methods for CustomResources
  // Optional, the global validation schema for all versions.
  // Top-level and per-version schemas are mutually exclusive.
  // +optional
  optional CustomResourceValidation validation = 5;

  // Subresources describes the subresources for CustomResource
  // Optional, the global subresources for all versions.
  // Top-level and per-version subresources are mutually exclusive.
  // +optional
  optional CustomResourceSubresources subresources = 6;

  // Versions is the list of all supported versions for this resource.
  // If Version field is provided, this field is optional.
  // Validation: All versions must use the same validation schema for now. i.e., top
  // level Validation field is applied to all of these versions.
  // Order: The version name will be used to compute the order.
  // If the version string is "kube-like", it will sort above non "kube-like" version strings, which are ordered
  // lexicographically. "Kube-like" versions start with a "v", then are followed by a number (the major version),
  // then optionally the string "alpha" or "beta" and another number (the minor version). These are sorted first
  // by GA > beta > alpha (where GA is a version with no suffix such as beta or alpha), and then by comparing
  // major version, then minor version. An example sorted list of versions:
  // v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10.
  // +optional
  repeated CustomResourceDefinitionVersion versions = 7;

  // AdditionalPrinterColumns are additional columns shown e.g. in kubectl next to the name. Defaults to a created-at column.
  // Optional, the global columns for all versions.
  // Top-level and per-version columns are mutually exclusive.
  // +optional
  repeated CustomResourceColumnDefinition additionalPrinterColumns = 8;

  // `conversion` defines conversion settings for the CRD.
  // +optional
  optional CustomResourceConversion conversion = 9;
}

// CustomResourceDefinitionStatus indicates the state of the CustomResourceDefinition
message CustomResourceDefinitionStatus {
  // Conditions indicate state for particular aspects of a CustomResourceDefinition
  repeated CustomResourceDefinitionCondition conditions = 1;

  // AcceptedNames are the names that are actually being used to serve discovery
  // They may be different than the names in spec.
  optional CustomResourceDefinitionNames acceptedNames = 2;

  // StoredVersions are all versions of CustomResources that were ever persisted. Tracking these
  // versions allows a migration path for stored versions in etcd. The field is mutable
  // so the migration controller can first finish a migration to another version (i.e.
  // that no old objects are left in the storage), and then remove the rest of the
  // versions from this list.
  // None of the versions in this list can be removed from the spec.Versions field.
  repeated string storedVersions = 3;
}

// CustomResourceDefinitionVersion describes a version for CRD.
message CustomResourceDefinitionVersion {
  // Name is the version name, e.g. “v1”, “v2beta1”, etc.
  optional string name = 1;

  // Served is a flag enabling/disabling this version from being served via REST APIs
  optional bool served = 2;

  // Storage flags the version as storage version. There must be exactly one
  // flagged as storage version.
  optional bool storage = 3;

  // Schema describes the schema for CustomResource used in validation, pruning, and defaulting.
  // Top-level and per-version schemas are mutually exclusive.
  // Per-version schemas must not all be set to identical values (top-level validation schema should be used instead)
  // This field is alpha-level and is only honored by servers that enable the CustomResourceWebhookConversion feature.
  // +optional
  optional CustomResourceValidation schema = 4;

  // Subresources describes the subresources for CustomResource
  // Top-level and per-version subresources are mutually exclusive.
  // Per-version subresources must not all be set to identical values (top-level subresources should be used instead)
  // This field is alpha-level and is only honored by servers that enable the CustomResourceWebhookConversion feature.
  // +optional
  optional CustomResourceSubresources subresources = 5;

  // AdditionalPrinterColumns are additional columns shown e.g. in kubectl next to the name. Defaults to a created-at column.
  // Top-level and per-version columns are mutually exclusive.
  // Per-version columns must not all be set to identical values (top-level columns should be used instead)
  // This field is alpha-level and is only honored by servers that enable the CustomResourceWebhookConversion feature.
  // NOTE: CRDs created prior to 1.13 populated the top-level additionalPrinterColumns field by default. To apply an
  // update that changes to per-version additionalPrinterColumns, the top-level additionalPrinterColumns field must
  // be explicitly set to null
  // +optional
  repeated CustomResourceColumnDefinition additionalPrinterColumns = 6;
}

// CustomResourceSubresourceScale defines how to serve the scale subresource for CustomResources.
message CustomResourceSubresourceScale {
  // SpecReplicasPath defines the JSON path inside of a CustomResource that corresponds to Scale.Spec.Replicas.
  // Only JSON paths without the array notation are allowed.
  // Must be a JSON Path under .spec.
  // If there is no value under the given path in the CustomResource, the /scale subresource will return an error on GET.
  optional string specReplicasPath = 1;

  // StatusReplicasPath defines the JSON path inside of a CustomResource that corresponds to Scale.Status.Replicas.
  // Only JSON paths without the array notation are allowed.
  // Must be a JSON Path under .status.
  // If there is no value under the given path in the CustomResource, the status replica value in the /scale subresource
  // will default to 0.
  optional string statusReplicasPath = 2;

  // LabelSelectorPath defines the JSON path inside of a CustomResource that corresponds to Scale.Status.Selector.
  // Only JSON paths without the array notation are allowed.
  // Must be a JSON Path under .status.
  // Must be set to work with HPA.
  // If there is no value under the given path in the CustomResource, the status label selector value in the /scale
  // subresource will default to the empty string.
  // +optional
  optional string labelSelectorPath = 3;
}

// CustomResourceSubresourceStatus defines how to serve the status subresource for CustomResources.
// Status is represented by the `.status` JSON path inside of a CustomResource. When set,
// * exposes a /status subresource for the custom resource
// * PUT requests to the /status subresource take a custom resource object, and ignore changes to anything except the status stanza
// * PUT/POST/PATCH requests to the custom resource ignore changes to the status stanza
message CustomResourceSubresourceStatus {
}

// CustomResourceSubresources defines the status and scale subresources for CustomResources.
message CustomResourceSubresources {
  // Status denotes the status subresource for CustomResources
  // +optional
  optional CustomResourceSubresourceStatus status = 1;

  // Scale denotes the scale subresource for CustomResources
  // +optional
  optional CustomResourceSubresourceScale scale = 2;
}

// CustomResourceValidation is a list of validation methods for CustomResources.
message CustomResourceValidation {
  // OpenAPIV3Schema is the OpenAPI v3 schema to be validated against.
  // +optional
  optional JSONSchemaProps openAPIV3Schema = 1;
}

// ExternalDocumentation allows referencing an external resource for extended documentation.
message ExternalDocumentation {
  optional string description = 1;

  optional string url = 2;
}

// JSON represents any valid JSON value.
// These types are supported: bool, int64, float64, string, []interface{}, map[string]interface{} and nil.
message JSON {
  optional bytes raw = 1;
}

// JSONSchemaProps is a JSON-Schema following Specification Draft 4 (http://json-schema.org/).
message JSONSchemaProps {
  optional string id = 1;

  optional string schema = 2;

  optional string ref = 3;

  optional string description = 4;

  optional string type = 5;

  optional string format = 6;

  optional string title = 7;

  optional JSON default = 8;

  optional double maximum = 9;

  optional bool exclusiveMaximum = 10;

  optional double minimum = 11;

  optional bool exclusiveMinimum = 12;

  optional int64 maxLength = 13;

  optional int64 minLength = 14;

  optional string pattern = 15;

  optional int64 maxItems = 16;

  optional int64 minItems = 17;

  optional bool uniqueItems = 18;

  optional double multipleOf = 19;

  repeated JSON enum = 20;

  optional int64 maxProperties = 21;

  optional int64 minProperties = 22;

  repeated string required = 23;

  optional JSONSchemaPropsOrArray items = 24;

  repeated JSONSchemaProps allOf = 25;

  repeated JSONSchemaProps oneOf = 26;

  repeated JSONSchemaProps anyOf = 27;

  optional JSONSchemaProps not = 28;

  map<string, JSONSchemaProps> properties = 29;

  optional JSONSchemaPropsOrBool additionalProperties = 30;

  map<string, JSONSchemaProps> patternProperties = 31;

  map<string, JSONSchemaPropsOrStringArray> dependencies = 32;

  optional JSONSchemaPropsOrBool additionalItems = 33;

  map<string, JSONSchemaProps> definitions = 34;

  optional ExternalDocumentation externalDocs = 35;

  optional JSON example = 36;
}

// JSONSchemaPropsOrArray represents a value that can either be a JSONSchemaProps
// or an array of JSONSchemaProps. Mainly here for serialization purposes.
message JSONSchemaPropsOrArray {
  optional JSONSchemaProps schema = 1;

  repeated JSONSchemaProps jSONSchemas = 2;
}

// JSONSchemaPropsOrBool represents JSONSchemaProps or a boolean value.
// Defaults to true for the boolean property.
message JSONSchemaPropsOrBool {
  optional bool allows = 1;

  optional JSONSchemaProps schema = 2;
}

// JSONSchemaPropsOrStringArray represents a JSONSchemaProps or a string array.
message JSONSchemaPropsOrStringArray {
  optional JSONSchemaProps schema = 1;

  repeated string property = 2;
}

// ServiceReference holds a reference to Service.legacy.k8s.io
message ServiceReference {
  // `namespace` is the namespace of the service.
  // Required
  optional string namespace = 1;

  // `name` is the name of the service.
  // Required
  optional string name = 2;

  // `path` is an optional URL path which will be sent in any request to
  // this service.
  // +optional
  optional string path = 3;
}

// WebhookClientConfig contains the information to make a TLS
// connection with the webhook. It has the same field as admissionregistration.v1beta1.WebhookClientConfig.
message WebhookClientConfig {
  // `url` gives the location of the webhook, in standard URL form
  // (`scheme://host:port/path`). Exactly one of `url` or `service`
  // must be specified.
  //
  // The `host` should not refer to a service running in the cluster; use
  // the `service` field instead. The host might be resolved via external
  // DNS in some apiservers (e.g., `kube-apiserver` cannot resolve
  // in-cluster DNS as that would be a layering violation). `host` may
  // also be an IP address.
  //
  // Please note that using `localhost` or `127.0.0.1` as a `host` is
  // risky unless you take great care to run this webhook on all hosts
  // which run an apiserver which might need to make calls to this
  // webhook. Such installs are likely to be non-portable, i.e., not easy
  // to turn up in a new cluster.
  //
  // The scheme must be "https"; the URL must begin with "https://".
  //
  // A path is optional, and if present may be any string permissible in
  // a URL. You may use the path to pass an arbitrary string to the
  // webhook, for example, a cluster identifier.
  //
  // Attempting to use a user or basic auth e.g. "user:password@" is not
  // allowed. Fragments ("#...") and query parameters ("?...") are not
  // allowed, either.
  //
  // +optional
  optional string url = 3;

  // `service` is a reference to the service for this webhook. Either
  // `service` or `url` must be specified.
  //
  // If the webhook is running within the cluster, then you should use `service`.
  //
  // Port 443 will be used if it is open, otherwise it is an error.
  //
  // +optional
  optional ServiceReference service = 1;

  // `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate.
  // If unspecified, system trust roots on the apiserver are used.
  // +optional
  optional bytes caBundle = 2;
}

