# Copyright 2024 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
#
#     https://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:
    controller-gen.kubebuilder.io/version: v0.16.5
  name: networks.networking.gke.io
spec:
  group: networking.gke.io
  names:
    kind: Network
    listKind: NetworkList
    plural: networks
    singular: network
  scope: Cluster
  versions:
  - name: v1
    schema:
      openAPIV3Schema:
        description: |-
          Network represent a logical network on the K8s Cluster.
          This logical network depends on the host networking setup on cluster nodes.
        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: NetworkSpec contains the specifications for network object
            properties:
              IPAMMode:
                description: |-
                  IPAMMode specifies the IPAM mode for the network.
                  Valid options include: internal, external
                enum:
                - Internal
                - External
                type: string
              IPAMMode6:
                description: |-
                  IPAMMode6 specifies the IPAM mode for the IPv6 network.
                  Valid options include: internal, external
                enum:
                - Internal
                - External
                type: string
              dnsConfig:
                description: |-
                  Specifies the DNS configuration of the network.
                  Required if ExternalDHCP4 is false or not set on L2 type network.
                properties:
                  nameservers:
                    description: |-
                      A list of nameserver IP addresses.
                      Duplicated nameservers will be removed.
                    items:
                      type: string
                    minItems: 1
                    type: array
                  searches:
                    description: |-
                      A list of DNS search domains for host-name lookup.
                      Duplicated search paths will be removed.
                    items:
                      type: string
                    type: array
                required:
                - nameservers
                type: object
              externalDHCP4:
                description: ExternalDHCP4 indicates whether the IPAM is static or
                  allocation by the external DHCP server
                type: boolean
              gateway4:
                description: |-
                  Gateway4 defines the gateway IPv4 address for the network.
                  Required if ExternalDHCP4 is false or not set on L2 type network.
                type: string
              l2NetworkConfig:
                description: L2NetworkConfig includes all the network config related
                  to L2 type network
                properties:
                  prefixLength4:
                    description: |-
                      PrefixLength4 denotes the IPv4 prefix length of the range
                      corresponding to the network. It is used to assign IPs to the pods for
                      multi-networking. This field is required when IPAM is handled internally and dynamically
                      via CCC. It's disallowed for other cases. For static IP, the prefix length is set as
                      part of the address in NetworkInterface object.
                    format: int32
                    maximum: 32
                    minimum: 1
                    type: integer
                  vlanID:
                    description: |-
                      VlanID is the vlan ID used for the network.
                      If unspecified, vlan tagging is not enabled.
                    format: int32
                    maximum: 4094
                    minimum: 1
                    type: integer
                type: object
              networkLifecycle:
                description: |-
                  NetworkLifecycle specifies who manages the lifecycle of the network.
                  This field can only be used when L2NetworkConfig.VlanID is specified. Otherwise the value will be ignored. If
                  L2NetworkConfig.VlanID is specified and this field is empty, the value is assumed to be AnthosManaged.
                enum:
                - AnthosManaged
                - UserManaged
                type: string
              nodeInterfaceMatcher:
                description: |-
                  NodeInterfaceMatcher defines the matcher to discover the corresponding node interface associated with the network.
                  This field is required for L2 network.
                properties:
                  interfaceName:
                    description: InterfaceName specifies the interface name to search
                      on the node.
                    minLength: 1
                    type: string
                type: object
              parametersRef:
                description: |-
                  ParametersRef is a reference to a resource that contains vendor or implementation specific
                  configurations for the network.
                properties:
                  group:
                    description: Group is the API group of k8s resource, e.g. "networking.k8s.io".
                    type: string
                  kind:
                    description: Kind is kind of the referent, e.g. "networkpolicy".
                    type: string
                  name:
                    description: Name is the name of the resource object.
                    type: string
                  namespace:
                    description: |-
                      Namespace is the namespace of the referent. This field is required when referring to a
                      Namespace-scoped resource and MUST be unset when referring to a Cluster-scoped resource.
                    type: string
                required:
                - group
                - kind
                - name
                type: object
              provider:
                description: Provider specifies the provider implementing this network,
                  e.g. "GKE".
                enum:
                - GKE
                type: string
              routes:
                description: Routes contains a list of routes for the network.
                items:
                  description: Route defines a routing table entry to a specific subnetwork.
                  properties:
                    to:
                      description: |-
                        To defines a destination IPv4 block in CIDR annotation. e.g. 192.168.0.0/24.
                        The CIDR 0.0.0.0/0 will be rejected.
                      type: string
                  required:
                  - to
                  type: object
                type: array
              type:
                description: |-
                  Type defines type of network.
                  Valid options include: L2, L3, Device.
                  L2 network type enables L2 connectivity on the network.
                  L3 network type enables L3 connectivity on the network.
                  Device network type enables direct device access on the network.
                enum:
                - L2
                - L3
                - Device
                type: string
            required:
            - type
            type: object
          status:
            description: NetworkStatus contains the status information related to
              the network.
            properties:
              conditions:
                description: |-
                  Conditions is a field representing the current conditions of the Network.

                  Known condition types are:

                  * "Ready"
                  * "ParamsReady"
                items:
                  description: Condition contains details for one aspect of the current
                    state of this API Resource.
                  properties:
                    lastTransitionTime:
                      description: |-
                        lastTransitionTime is the last time the condition transitioned from one status to another.
                        This should be when the underlying condition changed.  If that is not known, then using the time when the API field changed is acceptable.
                      format: date-time
                      type: string
                    message:
                      description: |-
                        message is a human readable message indicating details about the transition.
                        This may be an empty string.
                      maxLength: 32768
                      type: string
                    observedGeneration:
                      description: |-
                        observedGeneration represents the .metadata.generation that the condition was set based upon.
                        For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
                        with respect to the current state of the instance.
                      format: int64
                      minimum: 0
                      type: integer
                    reason:
                      description: |-
                        reason contains a programmatic identifier indicating the reason for the condition's last transition.
                        Producers of specific condition types may define expected values and meanings for this field,
                        and whether the values are considered a guaranteed API.
                        The value should be a CamelCase string.
                        This field may not be empty.
                      maxLength: 1024
                      minLength: 1
                      pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
                      type: string
                    status:
                      description: status of the condition, one of True, False, Unknown.
                      enum:
                      - "True"
                      - "False"
                      - Unknown
                      type: string
                    type:
                      description: type of condition in CamelCase or in foo.example.com/CamelCase.
                      maxLength: 316
                      pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
                      type: string
                  required:
                  - lastTransitionTime
                  - message
                  - reason
                  - status
                  - type
                  type: object
                type: array
                x-kubernetes-list-map-keys:
                - type
                x-kubernetes-list-type: map
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
