/*
Copyright 2016 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.kubernetes.federation.apis.federation.v1beta1;

import "k8s.io/kubernetes/pkg/api/resource/generated.proto";
import "k8s.io/kubernetes/pkg/api/unversioned/generated.proto";
import "k8s.io/kubernetes/pkg/api/v1/generated.proto";
import "k8s.io/kubernetes/pkg/runtime/generated.proto";
import "k8s.io/kubernetes/pkg/util/intstr/generated.proto";

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

// Information about a registered cluster in a federated kubernetes setup. Clusters are not namespaced and have unique names in the federation.
message Cluster {
  // Standard object's metadata.
  // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
  // +optional
  optional k8s.io.kubernetes.pkg.api.v1.ObjectMeta metadata = 1;

  // Spec defines the behavior of the Cluster.
  // +optional
  optional ClusterSpec spec = 2;

  // Status describes the current status of a Cluster
  // +optional
  optional ClusterStatus status = 3;
}

// ClusterCondition describes current state of a cluster.
message ClusterCondition {
  // Type of cluster condition, Complete or Failed.
  optional string type = 1;

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

  // Last time the condition was checked.
  // +optional
  optional k8s.io.kubernetes.pkg.api.unversioned.Time lastProbeTime = 3;

  // Last time the condition transit from one status to another.
  // +optional
  optional k8s.io.kubernetes.pkg.api.unversioned.Time lastTransitionTime = 4;

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

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

// A list of all the kubernetes clusters registered to the federation
message ClusterList {
  // Standard list metadata.
  // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
  // +optional
  optional k8s.io.kubernetes.pkg.api.unversioned.ListMeta metadata = 1;

  // List of Cluster objects.
  repeated Cluster items = 2;
}

// ClusterSpec describes the attributes of a kubernetes cluster.
message ClusterSpec {
  // A map of client CIDR to server address.
  // This is to help clients reach servers in the most network-efficient way possible.
  // Clients can use the appropriate server address as per the CIDR that they match.
  // In case of multiple matches, clients should use the longest matching CIDR.
  repeated ServerAddressByClientCIDR serverAddressByClientCIDRs = 1;

  // Name of the secret containing kubeconfig to access this cluster.
  // The secret is read from the kubernetes cluster that is hosting federation control plane.
  // Admin needs to ensure that the required secret exists. Secret should be in the same namespace where federation control plane is hosted and it should have kubeconfig in its data with key "kubeconfig".
  // This will later be changed to a reference to secret in federation control plane when the federation control plane supports secrets.
  // This can be left empty if the cluster allows insecure access.
  // +optional
  optional k8s.io.kubernetes.pkg.api.v1.LocalObjectReference secretRef = 2;
}

// ClusterStatus is information about the current status of a cluster updated by cluster controller peridocally.
message ClusterStatus {
  // Conditions is an array of current cluster conditions.
  // +optional
  repeated ClusterCondition conditions = 1;

  // Zones is the list of availability zones in which the nodes of the cluster exist, e.g. 'us-east1-a'.
  // These will always be in the same region.
  // +optional
  repeated string zones = 5;

  // Region is the name of the region in which all of the nodes in the cluster exist.  e.g. 'us-east1'.
  // +optional
  optional string region = 6;
}

// ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.
message ServerAddressByClientCIDR {
  // The CIDR with which clients can match their IP to figure out the server address that they should use.
  optional string clientCIDR = 1;

  // Address of this server, suitable for a client that matches the above CIDR.
  // This can be a hostname, hostname:port, IP or IP:port.
  optional string serverAddress = 2;
}

