# Copyright 2019 Istio Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in conformance 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 is the main metadata file for Galley processing.
# ####  KEEP ENTRIES ALPHASORTED! ####
#

# The total set of collections, both Istio (i.e. MCP) and K8s (API Server/K8s).
collections:
  ## Istio collections
  - name: "istio/extensions/v1alpha1/wasmplugins"
    kind: "WasmPlugin"
    group: "extensions.istio.io"
    pilot: true

  - name: "istio/mesh/v1alpha1/MeshConfig"
    kind: "MeshConfig"
    group: ""

  - name: "istio/mesh/v1alpha1/MeshNetworks"
    kind: "MeshNetworks"
    group: ""

  - name: "istio/networking/v1alpha3/destinationrules"
    kind: DestinationRule
    group: "networking.istio.io"
    pilot: true

  - name: "istio/networking/v1alpha3/envoyfilters"
    kind: "EnvoyFilter"
    group: "networking.istio.io"
    pilot: true

  - name: "istio/networking/v1alpha3/gateways"
    kind: "Gateway"
    group: "networking.istio.io"
    pilot: true

  - name: "istio/networking/v1alpha3/serviceentries"
    kind: "ServiceEntry"
    group: "networking.istio.io"
    pilot: true

  - name: "istio/networking/v1alpha3/workloadentries"
    kind: "WorkloadEntry"
    group: "networking.istio.io"
    pilot: true

  - name: "istio/networking/v1alpha3/workloadgroups"
    kind: "WorkloadGroup"
    group: "networking.istio.io"
    pilot: true

  - name: "istio/networking/v1alpha3/sidecars"
    kind: "Sidecar"
    group: "networking.istio.io"
    pilot: true

  - name: "istio/networking/v1alpha3/virtualservices"
    kind: "VirtualService"
    group: "networking.istio.io"
    pilot: true

  - name: "istio/networking/v1beta1/proxyconfigs"
    kind: "ProxyConfig"
    group: "networking.istio.io"
    pilot: true

  - name: "istio/security/v1beta1/authorizationpolicies"
    kind: AuthorizationPolicy
    group: "security.istio.io"
    pilot: true

  - name: "istio/security/v1beta1/requestauthentications"
    kind: RequestAuthentication
    group: "security.istio.io"
    pilot: true

  - name: "istio/security/v1beta1/peerauthentications"
    kind: PeerAuthentication
    group: "security.istio.io"
    pilot: true

  - name: "istio/telemetry/v1alpha1/telemetries"
    kind: "Telemetry"
    group: "telemetry.istio.io"
    pilot: true

  ### K8s collections ###

  # Built-in K8s collections
  - name: "k8s/apiextensions.k8s.io/v1/customresourcedefinitions"
    kind: "CustomResourceDefinition"
    group: "apiextensions.k8s.io"
    builtin: true

  - name: "k8s/admissionregistration.k8s.io/v1/mutatingwebhookconfigurations"
    kind: "MutatingWebhookConfiguration"
    group: "admissionregistration.k8s.io"
    builtin: true

  - name: "k8s/apps/v1/deployments"
    kind: "Deployment"
    group: "apps"
    builtin: true

  - name: "k8s/core/v1/endpoints"
    kind: "Endpoints"
    group: ""
    builtin: true

  - name: "k8s/core/v1/namespaces"
    kind: "Namespace"
    group: ""
    builtin: true

  - name: "k8s/core/v1/nodes"
    kind: "Node"
    group: ""
    builtin: true

  - name: "k8s/core/v1/pods"
    kind: "Pod"
    group: ""
    builtin: true

  - name: "k8s/core/v1/secrets"
    kind: "Secret"
    group: ""
    builtin: true

  - name: "k8s/core/v1/services"
    kind: "Service"
    group: ""
    builtin: true

  - name: "k8s/core/v1/configmaps"
    kind: "ConfigMap"
    group: ""
    builtin: true

  - name: "k8s/extensions/v1beta1/ingresses"
    kind: "Ingress"
    group: "extensions"
    builtin: true

  - kind: "GatewayClass"
    name: "k8s/gateway_api/v1beta1/gatewayclasses"
    group: "gateway.networking.k8s.io"

  - kind: "Gateway"
    name: "k8s/gateway_api/v1beta1/gateways"
    group: "gateway.networking.k8s.io"

  - kind: "HTTPRoute"
    name: "k8s/gateway_api/v1beta1/httproutes"
    group: "gateway.networking.k8s.io"

  - kind: "TCPRoute"
    name: "k8s/gateway_api/v1alpha2/tcproutes"
    group: "gateway.networking.k8s.io"

  - kind: "TLSRoute"
    name: "k8s/gateway_api/v1alpha2/tlsroutes"
    group: "gateway.networking.k8s.io"

  - kind: "ReferencePolicy"
    name: "k8s/gateway_api/v1alpha2/referencepolicies"
    group: "gateway.networking.k8s.io"

  - kind: "ReferenceGrant"
    name: "k8s/gateway_api/v1alpha2/referencegrants"
    group: "gateway.networking.k8s.io"

# Configuration for resource types.
resources:
  # Kubernetes specific configuration.
  - kind: "CustomResourceDefinition"
    plural: "customresourcedefinitions"
    group: "apiextensions.k8s.io"
    version: "v1"
    clusterScoped: true
    proto: "k8s.io.apiextensions_apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinition"
    protoPackage: "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"

  - kind: "MutatingWebhookConfiguration"
    plural: "mutatingwebhookconfigurations"
    group: "admissionregistration.k8s.io"
    version: "v1"
    clusterScoped: true
    proto: "k8s.io.api.admissionregistration.v1.MutatingWebhookConfiguration"
    protoPackage: "k8s.io/api/admissionregistration/v1"

  - kind: "Deployment"
    plural: "deployments"
    group: "apps"
    version: "v1"
    proto: "k8s.io.api.apps.v1.DeploymentSpec"
    protoPackage: "k8s.io/api/apps/v1"

  - kind: "Endpoints"
    plural: "endpoints"
    version: "v1"
    proto: "k8s.io.api.core.v1.Endpoints"
    protoPackage: "k8s.io/api/core/v1"

  - kind: "Namespace"
    plural: "namespaces"
    version: "v1"
    clusterScoped: true
    proto: "k8s.io.api.core.v1.NamespaceSpec"
    protoPackage: "k8s.io/api/core/v1"

  - kind: "Node"
    plural: "nodes"
    version: "v1"
    clusterScoped: true
    proto: "k8s.io.api.core.v1.NodeSpec"
    protoPackage: "k8s.io/api/core/v1"

  - kind: "Pod"
    plural: "pods"
    version: "v1"
    proto: "k8s.io.api.core.v1.PodSpec"
    protoPackage: "k8s.io/api/core/v1"

  - kind: "Secret"
    plural: "secrets"
    version: "v1"
    proto: "k8s.io.api.core.v1.Secret"
    protoPackage: "k8s.io/api/core/v1"

  - kind: "Service"
    plural: "services"
    version: "v1"
    proto: "k8s.io.api.core.v1.ServiceSpec"
    protoPackage: "k8s.io/api/core/v1"

  - kind: "ConfigMap"
    plural: "configmaps"
    version: "v1"
    proto: "k8s.io.api.core.v1.ConfigMap"
    protoPackage: "k8s.io/api/core/v1"

  - kind: "Ingress"
    plural: "ingresses"
    group: "extensions"
    version: "v1beta1"
    proto: "k8s.io.api.extensions.v1beta1.IngressSpec"
    protoPackage: "k8s.io/api/extensions/v1beta1"
    statusProto: "k8s.io.gateway_api.api.v1alpha1.IngressStatus"
    statusProtoPackage: "k8s.io/api/extensions/v1beta1"

  - kind: "GatewayClass"
    plural: "gatewayclasses"
    group: "gateway.networking.k8s.io"
    version: "v1beta1"
    versionAliases:
    - "v1alpha2"
    clusterScoped: true
    protoPackage: "sigs.k8s.io/gateway-api/apis/v1beta1"
    proto: "k8s.io.gateway_api.api.v1alpha1.GatewayClassSpec"
    statusProto: "k8s.io.gateway_api.api.v1alpha1.GatewayClassStatus"
    statusProtoPackage: "sigs.k8s.io/gateway-api/apis/v1beta1"

  - kind: "Gateway"
    plural: "gateways"
    group: "gateway.networking.k8s.io"
    version: "v1beta1"
    versionAliases:
    - "v1alpha2"
    protoPackage: "sigs.k8s.io/gateway-api/apis/v1beta1"
    proto: "k8s.io.gateway_api.api.v1alpha1.GatewaySpec"
    validate: "EmptyValidate"
    statusProto: "k8s.io.gateway_api.api.v1alpha1.GatewayStatus"
    statusProtoPackage: "sigs.k8s.io/gateway-api/apis/v1beta1"

  - kind: "HTTPRoute"
    plural: "httproutes"
    group: "gateway.networking.k8s.io"
    version: "v1beta1"
    versionAliases:
    - "v1alpha2"
    protoPackage: "sigs.k8s.io/gateway-api/apis/v1beta1"
    proto: "k8s.io.gateway_api.api.v1alpha1.HTTPRouteSpec"
    statusProto: "k8s.io.gateway_api.api.v1alpha1.HTTPRouteStatus"
    statusProtoPackage: "sigs.k8s.io/gateway-api/apis/v1beta1"

  - kind: "TCPRoute"
    plural: "tcproutes"
    group: "gateway.networking.k8s.io"
    version: "v1alpha2"
    protoPackage: "sigs.k8s.io/gateway-api/apis/v1alpha2"
    proto: "k8s.io.gateway_api.api.v1alpha1.TCPRouteSpec"
    statusProto: "k8s.io.gateway_api.api.v1alpha1.TCPRouteStatus"
    statusProtoPackage: "sigs.k8s.io/gateway-api/apis/v1alpha2"

  - kind: "TLSRoute"
    plural: "tlsroutes"
    group: "gateway.networking.k8s.io"
    version: "v1alpha2"
    protoPackage: "sigs.k8s.io/gateway-api/apis/v1alpha2"
    proto: "k8s.io.gateway_api.api.v1alpha1.TLSRouteSpec"
    statusProtoPackage: "sigs.k8s.io/gateway-api/apis/v1alpha2"
    statusProto: "k8s.io.gateway_api.api.v1alpha1.TLSRouteStatus"

  - kind: "ReferencePolicy"
    plural: "referencepolicies"
    group: "gateway.networking.k8s.io"
    version: "v1alpha2"
    protoPackage: "sigs.k8s.io/gateway-api/apis/v1alpha2"
    proto: "k8s.io.gateway_api.api.v1alpha1.ReferenceGrantSpec"

  - kind: "ReferenceGrant"
    plural: "referencegrants"
    group: "gateway.networking.k8s.io"
    version: "v1alpha2"
    protoPackage: "sigs.k8s.io/gateway-api/apis/v1alpha2"
    proto: "k8s.io.gateway_api.api.v1alpha1.ReferenceGrantSpec"

  ## Istio resources
  - kind: "VirtualService"
    plural: "virtualservices"
    group: "networking.istio.io"
    version: "v1alpha3"
    versionAliases:
      - "v1beta1"
    proto: "istio.networking.v1alpha3.VirtualService"
    protoPackage: "istio.io/api/networking/v1alpha3"
    description: "describes v1alpha3 route rules"
    statusProto: "istio.meta.v1alpha1.IstioStatus"
    statusProtoPackage: "istio.io/api/meta/v1alpha1"

  - kind: "Gateway"
    plural: "gateways"
    group: "networking.istio.io"
    version: "v1alpha3"
    versionAliases:
      - "v1beta1"
    proto: "istio.networking.v1alpha3.Gateway"
    protoPackage: "istio.io/api/networking/v1alpha3"
    description: "describes a gateway (how a proxy is exposed on the network)"
    statusProto: "istio.meta.v1alpha1.IstioStatus"
    statusProtoPackage: "istio.io/api/meta/v1alpha1"

  - kind: "ServiceEntry"
    plural: "serviceentries"
    group: "networking.istio.io"
    version: "v1alpha3"
    versionAliases:
      - "v1beta1"
    proto: "istio.networking.v1alpha3.ServiceEntry"
    protoPackage: "istio.io/api/networking/v1alpha3"
    description: "describes service entries"
    statusProto: "istio.meta.v1alpha1.IstioStatus"
    statusProtoPackage: "istio.io/api/meta/v1alpha1"

  - kind: "WorkloadEntry"
    plural: "workloadentries"
    group: "networking.istio.io"
    version: "v1alpha3"
    versionAliases:
      - "v1beta1"
    proto: "istio.networking.v1alpha3.WorkloadEntry"
    protoPackage: "istio.io/api/networking/v1alpha3"
    description: "describes workload entries"
    statusProto: "istio.meta.v1alpha1.IstioStatus"
    statusProtoPackage: "istio.io/api/meta/v1alpha1"

  - kind: "WorkloadGroup"
    plural: "workloadgroups"
    group: "networking.istio.io"
    version: "v1alpha3"
    versionAliases:
      - "v1beta1"
    proto: "istio.networking.v1alpha3.WorkloadGroup"
    protoPackage: "istio.io/api/networking/v1alpha3"
    description: "describes workload groups"
    statusProto: "istio.meta.v1alpha1.IstioStatus"
    statusProtoPackage: "istio.io/api/meta/v1alpha1"

  - kind: DestinationRule
    plural: "destinationrules"
    group: "networking.istio.io"
    version: "v1alpha3"
    versionAliases:
      - "v1beta1"
    proto: "istio.networking.v1alpha3.DestinationRule"
    protoPackage: "istio.io/api/networking/v1alpha3"
    description: "describes destination rules"
    statusProto: "istio.meta.v1alpha1.IstioStatus"
    statusProtoPackage: "istio.io/api/meta/v1alpha1"

  - kind: "EnvoyFilter"
    plural: "envoyfilters"
    group: "networking.istio.io"
    version: "v1alpha3"
    versionAliases:
      - "v1beta1"
    proto: "istio.networking.v1alpha3.EnvoyFilter"
    protoPackage: "istio.io/api/networking/v1alpha3"
    description: "describes additional envoy filters to be inserted by Pilot"
    statusProto: "istio.meta.v1alpha1.IstioStatus"
    statusProtoPackage: "istio.io/api/meta/v1alpha1"

  - kind: "Sidecar"
    plural: "sidecars"
    group: "networking.istio.io"
    version: "v1alpha3"
    versionAliases:
      - "v1beta1"
    proto: "istio.networking.v1alpha3.Sidecar"
    protoPackage: "istio.io/api/networking/v1alpha3"
    description: "describes the listeners associated with sidecars in a namespace"
    statusProto: "istio.meta.v1alpha1.IstioStatus"
    statusProtoPackage: "istio.io/api/meta/v1alpha1"

  - kind: "ProxyConfig"
    plural: "proxyconfigs"
    group: "networking.istio.io"
    version: "v1beta1"
    proto: "istio.networking.v1beta1.ProxyConfig"
    protoPackage: "istio.io/api/networking/v1beta1"
    description: "defines configuration for individual workloads"
    statusProto: "istio.meta.v1alpha1.IstioStatus"
    statusProtoPackage: "istio.io/api/meta/v1alpha1"

  - kind: "MeshConfig"
    plural: "meshconfigs"
    group: ""
    version: "v1alpha1"
    proto: "istio.mesh.v1alpha1.MeshConfig"
    protoPackage: "istio.io/api/mesh/v1alpha1"
    description: "describes the configuration for the Istio mesh."

  - kind: "MeshNetworks"
    plural: "meshnetworks"
    group: ""
    version: "v1alpha1"
    proto: "istio.mesh.v1alpha1.MeshNetworks"
    protoPackage: "istio.io/api/mesh/v1alpha1"
    description: "describes the networks for the Istio mesh."

  - kind: AuthorizationPolicy
    plural: "authorizationpolicies"
    group: "security.istio.io"
    version: "v1beta1"
    proto: "istio.security.v1beta1.AuthorizationPolicy"
    protoPackage: "istio.io/api/security/v1beta1"
    description: "describes the authorization policy."
    statusProto: "istio.meta.v1alpha1.IstioStatus"
    statusProtoPackage: "istio.io/api/meta/v1alpha1"

  - kind: RequestAuthentication
    plural: "requestauthentications"
    group: "security.istio.io"
    version: "v1beta1"
    proto: "istio.security.v1beta1.RequestAuthentication"
    protoPackage: "istio.io/api/security/v1beta1"
    description: "describes the request authentication."
    statusProto: "istio.meta.v1alpha1.IstioStatus"
    statusProtoPackage: "istio.io/api/meta/v1alpha1"

  - kind: PeerAuthentication
    plural: "peerauthentications"
    group: "security.istio.io"
    version: "v1beta1"
    proto: "istio.security.v1beta1.PeerAuthentication"
    protoPackage: "istio.io/api/security/v1beta1"
    validate: "ValidatePeerAuthentication"
    description: "describes the peer authentication."
    statusProto: "istio.meta.v1alpha1.IstioStatus"
    statusProtoPackage: "istio.io/api/meta/v1alpha1"

  - kind: "Telemetry"
    plural: "telemetries"
    group: "telemetry.istio.io"
    version: "v1alpha1"
    proto: "istio.telemetry.v1alpha1.Telemetry"
    protoPackage: "istio.io/api/telemetry/v1alpha1"
    description: "describes telemetry configuration for workloads"
    statusProto: "istio.meta.v1alpha1.IstioStatus"
    statusProtoPackage: "istio.io/api/meta/v1alpha1"

  - kind: "WasmPlugin"
    plural: "wasmplugins"
    group: "extensions.istio.io"
    version: "v1alpha1"
    proto: "istio.extensions.v1alpha1.WasmPlugin"
    protoPackage: "istio.io/api/extensions/v1alpha1"
    description: ""
    statusProto: "istio.meta.v1alpha1.IstioStatus"
    statusProtoPackage: "istio.io/api/meta/v1alpha1"
