# Copyright 2025 Google LLC
#
# 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.

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    cnrm.cloud.google.com/version: 1.128.0
  creationTimestamp: null
  labels:
    cnrm.cloud.google.com/managed-by-kcc: "true"
    cnrm.cloud.google.com/system: "true"
    cnrm.cloud.google.com/tf2crd: "true"
  name: spannerinstances.spanner.cnrm.cloud.google.com
spec:
  group: spanner.cnrm.cloud.google.com
  names:
    categories:
    - gcp
    kind: SpannerInstance
    listKind: SpannerInstanceList
    plural: spannerinstances
    shortNames:
    - gcpspannerinstance
    - gcpspannerinstances
    singular: spannerinstance
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    - description: When 'True', the most recent reconcile of the resource succeeded
      jsonPath: .status.conditions[?(@.type=='Ready')].status
      name: Ready
      type: string
    - description: The reason for the value in 'Ready'
      jsonPath: .status.conditions[?(@.type=='Ready')].reason
      name: Status
      type: string
    - description: The last transition time for the value in 'Status'
      jsonPath: .status.conditions[?(@.type=='Ready')].lastTransitionTime
      name: Status Age
      type: date
    name: v1beta1
    schema:
      openAPIV3Schema:
        description: SpannerInstance is the Schema for the SpannerInstance API
        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: SpannerInstanceSpec defines the desired state of SpannerInstance
            properties:
              autoscalingConfig:
                description: Optional. The autoscaling configuration. Autoscaling
                  is enabled if this field is set. When autoscaling is enabled, node_count
                  and processing_units are treated as OUTPUT_ONLY fields and reflect
                  the current compute capacity allocated to the instance.
                properties:
                  autoscalingLimits:
                    description: Required. Autoscaling limits for an instance.
                    properties:
                      maxNodes:
                        description: Maximum number of nodes allocated to the instance.
                          If set, this number should be greater than or equal to min_nodes.
                        format: int32
                        type: integer
                      maxProcessingUnits:
                        description: Maximum number of processing units allocated
                          to the instance. If set, this number should be multiples
                          of 1000 and be greater than or equal to min_processing_units.
                        format: int32
                        type: integer
                      minNodes:
                        description: Minimum number of nodes allocated to the instance.
                          If set, this number should be greater than or equal to 1.
                        format: int32
                        type: integer
                      minProcessingUnits:
                        description: Minimum number of processing units allocated
                          to the instance. If set, this number should be multiples
                          of 1000.
                        format: int32
                        type: integer
                    type: object
                  autoscalingTargets:
                    description: Required. The autoscaling targets for an instance.
                    properties:
                      highPriorityCpuUtilizationPercent:
                        description: Required. The target high priority cpu utilization
                          percentage that the autoscaler should be trying to achieve
                          for the instance. This number is on a scale from 0 (no utilization)
                          to 100 (full utilization). The valid range is [10, 90] inclusive.
                        format: int32
                        type: integer
                      storageUtilizationPercent:
                        description: Required. The target storage utilization percentage
                          that the autoscaler should be trying to achieve for the
                          instance. This number is on a scale from 0 (no utilization)
                          to 100 (full utilization). The valid range is [10, 100]
                          inclusive.
                        format: int32
                        type: integer
                    type: object
                type: object
              config:
                description: Immutable. The name of the instance's configuration (similar
                  but not quite the same as a region) which defines the geographic
                  placement and replication of your databases in this instance. It
                  determines where your data is stored. Values are typically of the
                  form 'regional-europe-west1' , 'us-central' etc. In order to obtain
                  a valid list please consult the [Configuration section of the docs](https://cloud.google.com/spanner/docs/instances).
                type: string
                x-kubernetes-validations:
                - message: Config field is immutable
                  rule: self == oldSelf
              displayName:
                description: The descriptive name for this instance as it appears
                  in UIs. Must be unique per project and between 4 and 30 characters
                  in length.
                type: string
              edition:
                description: Optional. The `Edition` of the current instance. Currently
                  accepted values are EDITION_UNSPECIFIED, STANDARD, ENTERPRISE, ENTERPRISE_PLUS
                type: string
              numNodes:
                format: int32
                type: integer
              processingUnits:
                format: int32
                type: integer
              resourceID:
                description: The SpannerInstance name. If not given, the metadata.name
                  will be used.
                type: string
            required:
            - config
            - displayName
            type: object
          status:
            description: SpannerInstanceStatus defines the config connector machine
              state of SpannerInstance
            properties:
              conditions:
                description: Conditions represent the latest available observations
                  of the SpannerInstance's current state.
                items:
                  properties:
                    lastTransitionTime:
                      description: Last time the condition transitioned from one status
                        to another.
                      type: string
                    message:
                      description: Human-readable message indicating details about
                        last transition.
                      type: string
                    reason:
                      description: Unique, one-word, CamelCase reason for the condition's
                        last transition.
                      type: string
                    status:
                      description: Status is the status of the condition. Can be True,
                        False, Unknown.
                      type: string
                    type:
                      description: Type is the type of the condition.
                      type: string
                  type: object
                type: array
              externalRef:
                description: A unique specifier for the SpannerInstance resource in
                  GCP.
                type: string
              observedGeneration:
                description: ObservedGeneration is the generation of the resource
                  that was most recently observed by the Config Connector controller.
                  If this is equal to metadata.generation, then that means that the
                  current reported status reflects the most recent desired state of
                  the resource.
                format: int64
                type: integer
              observedState:
                description: ObservedState is the state of the resource as most recently
                  observed in GCP.
                properties:
                  numNodes:
                    description: NumNodes and ProcessUnits is output fields with AutoScaler
                      is set.
                    format: int32
                    type: integer
                  processingUnits:
                    format: int32
                    type: integer
                type: object
              state:
                description: 'Instance status: ''CREATING'' or ''READY''.'
                type: string
            type: object
        required:
        - spec
        type: object
    served: true
    storage: true
    subresources:
      status: {}
status:
  acceptedNames:
    kind: ""
    plural: ""
  conditions: null
  storedVersions: null
