/*
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.api.apiserverinternal.v1alpha1;

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 = "k8s.io/api/apiserverinternal/v1alpha1";

// An API server instance reports the version it can decode and the version it
// encodes objects to when persisting objects in the backend.
message ServerStorageVersion {
  // apiServerID is the ID of the reporting API server.
  // +required
  optional string apiServerID = 1;

  // encodingVersion the API server encodes the object to when persisting it in
  // the backend (e.g., etcd).
  // +required
  optional string encodingVersion = 2;

  // decodableVersions are the encoding versions the API server can handle to decode.
  // The API server can decode objects encoded in these versions.
  // The encodingVersion must be included in the decodableVersions.
  // +listType=set
  // +required
  repeated string decodableVersions = 3;

  // servedVersions lists all versions the API server can serve.
  // DecodableVersions must include all ServedVersions.
  // +listType=set
  // +optional
  repeated string servedVersions = 4;
}

// Storage version of a specific resource.
message StorageVersion {
  // metadata is the standard object metadata.
  // The name is <group>.<resource>.
  // +required
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;

  // spec is an empty spec. It is here to comply with Kubernetes API style.
  // +optional
  optional StorageVersionSpec spec = 2;

  // status on the version the API server instance can decode from and
  // encode objects to when persisting objects in the backend.
  // +optional
  optional StorageVersionStatus status = 3;
}

// Describes the state of the storageVersion at a certain point.
message StorageVersionCondition {
  // type of the condition.
  // +required
  optional string type = 1;

  // status of the condition, one of True, False, Unknown.
  // +required
  optional string status = 2;

  // observedGeneration represents the .metadata.generation that the condition was set based upon, if field is set.
  // +optional
  optional int64 observedGeneration = 3;

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

  // reason for the condition's last transition.
  // +required
  optional string reason = 5;

  // message is a human readable string indicating details about the transition.
  // +required
  optional string message = 6;
}

// A list of StorageVersions.
message StorageVersionList {
  // Standard list metadata.
  // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  // +optional
  optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;

  // Items holds a list of StorageVersion
  repeated StorageVersion items = 2;
}

// StorageVersionSpec is an empty spec.
message StorageVersionSpec {
}

// API server instances report the versions they can decode and the version they
// encode objects to when persisting objects in the backend.
message StorageVersionStatus {
  // storageVersions lists the reported versions per API server instance.
  // +optional
  // +listType=map
  // +listMapKey=apiServerID
  repeated ServerStorageVersion storageVersions = 1;

  // commonEncodingVersion is set to an encoding storage version if all API server
  // instances share that same version. If they don't share one storage version, this
  // field is left empty.
  // API servers should finish updating its storageVersionStatus entry before
  // serving write operations, so that this field will be in sync with the reality.
  // +optional
  optional string commonEncodingVersion = 2;

  // conditions lists the latest available observations of the storageVersion's state.
  // +optional
  // +listType=map
  // +listMapKey=type
  repeated StorageVersionCondition conditions = 3;
}

