snowdrop / istio-java-api

A Java API to generate Istio descriptors, inspired by Fabric8's kubernetes-model.
Apache License 2.0
112 stars 33 forks source link

I can't find istio-model kind "handler instance" in apiVersion "config.istio.io/v1alpha2" #98

Closed DragonSuper closed 3 years ago

DragonSuper commented 4 years ago
apiVersion: config.istio.io/v1alpha2
kind: instance
metadata:
  name: doublerequestcount
  namespace: istio-system
spec:
  compiledTemplate: metric
  params:
    value: "2" # count each request twice
    dimensions:
      reporter: conditional((context.reporter.kind | "inbound") == "outbound", "client", "server")
      source: source.workload.name | "unknown"
      destination: destination.workload.name | "unknown"
      message: '"twice the fun!"'
    monitored_resource_type: '"UNSPECIFIED"'
apiVersion: config.istio.io/v1alpha2
kind: handler
metadata:
  name: doublehandler
  namespace: istio-system
spec:
  compiledAdapter: prometheus
  params:
    metrics:
    - name: double_request_count # Prometheus metric name
      instance_name: doublerequestcount.instance.istio-system # Mixer instance name (fully-qualified)
      kind: COUNTER
      label_names:
      - reporter
      - source
      - destination
      - message

istio-java-api/istio-model is no classes (instance handler). What should I do to get what resources((instance handler). Thanks!

metacosm commented 4 years ago

Can you please provide which Istio version you're targeting and which version of istio-java-api you're using?

DragonSuper commented 4 years ago

Can you please provide which Istio version you're targeting and which version of istio-java-api you're using?

istio version: 1.4.4 istio-java-api: 1.1.1 or 1.5.5

kubectl api-resources

certificatesigningrequests        csr          certificates.k8s.io            false        CertificateSigningRequest
adapters                                       config.istio.io                true         adapter
attributemanifests                             config.istio.io                true         attributemanifest
handlers                                       config.istio.io                true         handler
httpapispecbindings                            config.istio.io                true         HTTPAPISpecBinding
httpapispecs                                   config.istio.io                true         HTTPAPISpec
instances                                      config.istio.io                true         instance
quotaspecbindings                              config.istio.io                true         QuotaSpecBinding
quotaspecs                                     config.istio.io                true         QuotaSpec
rules                                          config.istio.io                true         rule
templates                                      config.istio.io                true         template
leases                                         coordination.k8s.io            true         Lease

The new version istio has no kinds (prometheus memquota redisquota ...) ,but it has kinds (handler instance )

metacosm commented 4 years ago

Yes, this isn't yet supported but I will take a look at supporting it. I was waiting to see if anyone actually needed it before trying to support it… :)

metacosm commented 4 years ago

I've started working on it in #100. The initial work is currently detyped, using Struct as opposed to using type-safe API, I'm looking into ways to generate the appropriate classes so that a metric instance, you only get the appropriate fields in params instead of having a map-like structure to contend with.

metacosm commented 3 years ago

This is taking longer than expected but things are progressing.