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

make 'strict' failed : Unknown interfaces, Unvisited packages, Unvisited CRDs #75

Closed lianghuiyuan closed 4 years ago

lianghuiyuan commented 4 years ago

Istio Version=1.1.8

[creasy:~/go-workspace/src/istio.io/istio] 145b18a44 15s ± git status
HEAD detached at 1.1.8
nothing to commit, working tree clean

Istio Api Version=release-1.1

[creasy:~/go-workspace/src/istio.io/api] release-1.1 2m45s ± git status
On branch release-1.1

make crd ( I changed oc to kubectl in Makefile ):

[creasy:~/go-workspace … /github.com/snowdrop/istio-java-api] master(+41/-5273) 34m6s 2 ± make crd
kubectl get crd -o=jsonpath="{range .items[*]}{.spec.names.kind}={.metadata.name}| istio={.metadata.labels.istio}| version={.spec.version}{'\n'}{end}" |grep istio.io > /home/creasy/go-workspace/src/github.com/snowdrop/istio-java-api/istio-common/src/main/resources/istio-crd.properties

$ cat /home/creasy/go-workspace/src/github.com/snowdrop/istio-java-api/istio-common/src/main/resources/istio-crd.properties
adapter=adapters.config.istio.io| istio=rbac| version=v1alpha2
apikey=apikeys.config.istio.io| istio=mixer-instance| version=v1alpha2
attributemanifest=attributemanifests.config.istio.io| istio=core| version=v1alpha2
authorization=authorizations.config.istio.io| istio=mixer-instance| version=v1alpha2
bypass=bypasses.config.istio.io| istio=mixer-adapter| version=v1alpha2
checknothing=checknothings.config.istio.io| istio=mixer-instance| version=v1alpha2
circonus=circonuses.config.istio.io| istio=mixer-adapter| version=v1alpha2
cloudwatch=cloudwatches.config.istio.io| istio=mixer-adapter| version=v1alpha2
ClusterRbacConfig=clusterrbacconfigs.rbac.istio.io| istio=rbac| version=v1alpha1
denier=deniers.config.istio.io| istio=mixer-adapter| version=v1alpha2
DestinationRule=destinationrules.networking.istio.io| istio=| version=v1alpha3
dogstatsd=dogstatsds.config.istio.io| istio=mixer-adapter| version=v1alpha2
edge=edges.config.istio.io| istio=mixer-instance| version=v1alpha2
EnvoyFilter=envoyfilters.networking.istio.io| istio=| version=v1alpha3
fluentd=fluentds.config.istio.io| istio=mixer-adapter| version=v1alpha2
Gateway=gateways.networking.istio.io| istio=| version=v1alpha3
handler=handlers.config.istio.io| istio=mixer-handler| version=v1alpha2
HTTPAPISpecBinding=httpapispecbindings.config.istio.io| istio=| version=v1alpha2
HTTPAPISpec=httpapispecs.config.istio.io| istio=| version=v1alpha2
instance=instances.config.istio.io| istio=mixer-instance| version=v1alpha2
kubernetesenv=kubernetesenvs.config.istio.io| istio=mixer-adapter| version=v1alpha2
kubernetes=kuberneteses.config.istio.io| istio=mixer-instance| version=v1alpha2
listchecker=listcheckers.config.istio.io| istio=mixer-adapter| version=v1alpha2
listentry=listentries.config.istio.io| istio=mixer-instance| version=v1alpha2
logentry=logentries.config.istio.io| istio=mixer-instance| version=v1alpha2
memquota=memquotas.config.istio.io| istio=mixer-adapter| version=v1alpha2
MeshPolicy=meshpolicies.authentication.istio.io| istio=| version=v1alpha1
metric=metrics.config.istio.io| istio=mixer-instance| version=v1alpha2
noop=noops.config.istio.io| istio=mixer-adapter| version=v1alpha2
opa=opas.config.istio.io| istio=mixer-adapter| version=v1alpha2
Policy=policies.authentication.istio.io| istio=| version=v1alpha1
prometheus=prometheuses.config.istio.io| istio=mixer-adapter| version=v1alpha2
quota=quotas.config.istio.io| istio=mixer-instance| version=v1alpha2
QuotaSpecBinding=quotaspecbindings.config.istio.io| istio=| version=v1alpha2
QuotaSpec=quotaspecs.config.istio.io| istio=| version=v1alpha2
RbacConfig=rbacconfigs.rbac.istio.io| istio=rbac| version=v1alpha1
rbac=rbacs.config.istio.io| istio=mixer-adapter| version=v1alpha2
redisquota=redisquotas.config.istio.io| istio=mixer-adapter| version=v1alpha2
reportnothing=reportnothings.config.istio.io| istio=mixer-instance| version=v1alpha2
rule=rules.config.istio.io| istio=core| version=v1alpha2
servicecontrolreport=servicecontrolreports.config.istio.io| istio=mixer-instance| version=v1alpha2
servicecontrol=servicecontrols.config.istio.io| istio=mixer-adapter| version=v1alpha2
ServiceEntry=serviceentries.networking.istio.io| istio=| version=v1alpha3
ServiceRoleBinding=servicerolebindings.rbac.istio.io| istio=rbac| version=v1alpha1
ServiceRole=serviceroles.rbac.istio.io| istio=rbac| version=v1alpha1
Sidecar=sidecars.networking.istio.io| istio=| version=v1alpha3
signalfx=signalfxs.config.istio.io| istio=mixer-adapter| version=v1alpha2
solarwinds=solarwindses.config.istio.io| istio=mixer-adapter| version=v1alpha2
stackdriver=stackdrivers.config.istio.io| istio=mixer-adapter| version=v1alpha2
statsd=statsds.config.istio.io| istio=mixer-adapter| version=v1alpha2
stdio=stdios.config.istio.io| istio=mixer-adapter| version=v1alpha2
template=templates.config.istio.io| istio=mixer-template| version=v1alpha2
tracespan=tracespans.config.istio.io| istio=mixer-instance| version=v1alpha2
VirtualService=virtualservices.networking.istio.io| istio=| version=v1alpha3
zipkin=zipkins.config.istio.io| istio=mixer-adapter| version=v1alpha2

make packages:

[creasy:~/go-workspace … /github.com/snowdrop/istio-java-api] master(+41/-5273) 45m21s ± make packages
./scripts/generate_package_info.sh

[creasy:~/go-workspace … /github.com/snowdrop/istio-java-api] master(+41/-5273) 45m49s ± cat istio-common/src/main/resources/packages.csv
github.com/golang/protobuf/ptypes/duration       ,me.snowdrop.istio.api                         ,protobuf_duration_
github.com/gogo/protobuf/types                   ,me.snowdrop.istio.api                         ,protobuf_types_
github.com/golang/protobuf/ptypes/any            ,me.snowdrop.istio.api                         ,protobuf_any_
github.com/gogo/googleapis/google/rpc            ,me.snowdrop.istio.api                         ,google_rpc_
## END MANUAL DEFINITIONS
# api
istio.io/api/authentication/v1alpha1,me.snowdrop.istio.api.authentication.v1alpha1,istio_authentication_v1alpha1_
istio.io/api/mcp/v1alpha1,me.snowdrop.istio.api.mcp.v1alpha1,istio_mcp_v1alpha1_
istio.io/api/mesh/v1alpha1,me.snowdrop.istio.api.mesh.v1alpha1,istio_mesh_v1alpha1_
istio.io/api/mixer/v1,me.snowdrop.istio.api.mixer.v1,istio_mixer_v1_
istio.io/api/networking/v1alpha3,me.snowdrop.istio.api.networking.v1alpha3,istio_networking_v1alpha3_
istio.io/api/policy/v1beta1,me.snowdrop.istio.api.policy.v1beta1,istio_policy_v1beta1_
istio.io/api/rbac/v1alpha1,me.snowdrop.istio.api.rbac.v1alpha1,istio_rbac_v1alpha1_
# adapter
istio.io/istio/mixer/adapter/bypass/config,me.snowdrop.istio.mixer.adapter.bypass,istio_adapter_bypass_
istio.io/istio/mixer/adapter/circonus/config,me.snowdrop.istio.mixer.adapter.circonus,istio_adapter_circonus_
istio.io/istio/mixer/adapter/cloudwatch/config,me.snowdrop.istio.mixer.adapter.cloudwatch,istio_adapter_cloudwatch_
istio.io/istio/mixer/adapter/denier/config,me.snowdrop.istio.mixer.adapter.denier,istio_adapter_denier_
istio.io/istio/mixer/adapter/dogstatsd/config,me.snowdrop.istio.mixer.adapter.dogstatsd,istio_adapter_dogstatsd_
istio.io/istio/mixer/adapter/fluentd/config,me.snowdrop.istio.mixer.adapter.fluentd,istio_adapter_fluentd_
istio.io/istio/mixer/adapter/kubernetesenv/config,me.snowdrop.istio.mixer.adapter.kubernetesenv,istio_adapter_kubernetesenv_
istio.io/istio/mixer/adapter/list/config,me.snowdrop.istio.mixer.adapter.list,istio_adapter_list_
istio.io/istio/mixer/adapter/memquota/config,me.snowdrop.istio.mixer.adapter.memquota,istio_adapter_memquota_
istio.io/istio/mixer/adapter/opa/config,me.snowdrop.istio.mixer.adapter.opa,istio_adapter_opa_
istio.io/istio/mixer/adapter/prometheus/config,me.snowdrop.istio.mixer.adapter.prometheus,istio_adapter_prometheus_
istio.io/istio/mixer/adapter/rbac/config,me.snowdrop.istio.mixer.adapter.rbac,istio_adapter_rbac_
istio.io/istio/mixer/adapter/redisquota/config,me.snowdrop.istio.mixer.adapter.redisquota,istio_adapter_redisquota_
istio.io/istio/mixer/adapter/signalfx/config,me.snowdrop.istio.mixer.adapter.signalfx,istio_adapter_signalfx_
istio.io/istio/mixer/adapter/solarwinds/config,me.snowdrop.istio.mixer.adapter.solarwinds,istio_adapter_solarwinds_
istio.io/istio/mixer/adapter/stackdriver/config,me.snowdrop.istio.mixer.adapter.stackdriver,istio_adapter_stackdriver_
istio.io/istio/mixer/adapter/statsd/config,me.snowdrop.istio.mixer.adapter.statsd,istio_adapter_statsd_
istio.io/istio/mixer/adapter/stdio/config,me.snowdrop.istio.mixer.adapter.stdio,istio_adapter_stdio_
istio.io/istio/mixer/adapter/zipkin/config,me.snowdrop.istio.mixer.adapter.zipkin,istio_adapter_zipkin_
# template
istio.io/istio/mixer/template/apikey,me.snowdrop.istio.mixer.template.apikey,istio_mixer_apikey_
istio.io/istio/mixer/template/authorization,me.snowdrop.istio.mixer.template.authorization,istio_mixer_authorization_
istio.io/istio/mixer/template/checknothing,me.snowdrop.istio.mixer.template.checknothing,istio_mixer_checknothing_
istio.io/istio/mixer/template/edge,me.snowdrop.istio.mixer.template.edge,istio_mixer_edge_
istio.io/istio/mixer/template/listentry,me.snowdrop.istio.mixer.template.listentry,istio_mixer_listentry_
istio.io/istio/mixer/template/logentry,me.snowdrop.istio.mixer.template.logentry,istio_mixer_logentry_
istio.io/istio/mixer/template/metric,me.snowdrop.istio.mixer.template.metric,istio_mixer_metric_
istio.io/istio/mixer/template/quota,me.snowdrop.istio.mixer.template.quota,istio_mixer_quota_
istio.io/istio/mixer/template/reportnothing,me.snowdrop.istio.mixer.template.reportnothing,istio_mixer_reportnothing_
istio.io/istio/mixer/template/sample,me.snowdrop.istio.mixer.template.sample,istio_mixer_sample_
istio.io/istio/mixer/template/tracespan,me.snowdrop.istio.mixer.template.tracespan,istio_mixer_tracespan_

classes-with-interface-fields.yml

[creasy:~/go-workspace … /github.com/snowdrop/istio-java-api] master(+41/-5273) 58m17s ± cat istio-common/src/main/resources/classes-with-interface-fields.yml 
# Currently ignored interfaces (or mapped to TypedValue):
# isAttributes_AttributeValue_Value field value in istio.io/api/mixer/v1/Attributes_AttributeValue
# isValue_Kind field kind in github.com/gogo/protobuf/types/Value
# isValue_Value field value in istio.io/api/policy/v1beta1/Value
classes:
  - class: me.snowdrop.istio.api.networking.v1alpha3.Abort
    fields:
      percent: integer
      grpcStatus: isHTTPFaultInjection_Abort_ErrorType
      httpStatus: isHTTPFaultInjection_Abort_ErrorType
      http2Error: isHTTPFaultInjection_Abort_ErrorType
      percentage: me.snowdrop.istio.api.networking.v1alpha3.Percent
  - class: me.snowdrop.istio.api.networking.v1alpha3.Delay
    fields:
      percent: integer
      exponentialDelay: isHTTPFaultInjection_Delay_HttpDelayType
      fixedDelay: isHTTPFaultInjection_Delay_HttpDelayType
  - class: me.snowdrop.istio.api.networking.v1alpha3.LoadBalancerSettings
    fields:
      simple: isLoadBalancerSettings_LbPolicy
      consitentHash: isLoadBalancerSettings_LbPolicy
  - class: me.snowdrop.istio.api.networking.v1alpha3.PortSelector
    fields:
      name: isPortSelector_Port
      number: isPortSelector_Port
  - class: me.snowdrop.istio.api.authentication.v1alpha1.PortSelector
    fields:
      name: isPortSelector_Port
      number: isPortSelector_Port
  - class: me.snowdrop.istio.api.networking.v1alpha3.StringMatch
    fields:
      exact: isStringMatch_MatchType
      prefix: isStringMatch_MatchType
      regex: isStringMatch_MatchType
  - class: me.snowdrop.istio.api.networking.v1alpha3.ConsistentHashLB
    fields:
      httpHeaderName: isLoadBalancerSettings_ConsistentHashLB_HashKey
      httpCookie: isLoadBalancerSettings_ConsistentHashLB_HashKey
      minimumRingSize: integer
      useSourceIp: isLoadBalancerSettings_ConsistentHashLB_HashKey
  - class: me.snowdrop.istio.api.authentication.v1alpha1.PeerAuthenticationMethod
    fields:
      jwt: isPeerAuthenticationMethod_Params
      mtls: isPeerAuthenticationMethod_Params
  - class: me.snowdrop.istio.mixer.adapter.prometheus.BucketsDefinition
    fields:
      explicitBuckets: isParams_MetricInfo_BucketsDefinition_Definition
      exponentialBuckets: isParams_MetricInfo_BucketsDefinition_Definition
      linearBuckets: isParams_MetricInfo_BucketsDefinition_Definition
  - class: me.snowdrop.istio.mixer.adapter.stackdriver.BucketsDefinition
    fields:
      explicitBuckets: isParams_MetricInfo_BucketsDefinition_Definition
      exponentialBuckets: isParams_MetricInfo_BucketsDefinition_Definition
      linearBuckets: isParams_MetricInfo_BucketsDefinition_Definition
  - class: me.snowdrop.istio.mixer.adapter.stackdriver.Stackdriver
    fields:
      endpoint: string
      projectId: string
      pushInterval: me.snowdrop.istio.api.Duration
      appCredentials: isParams_Creds
      apiKey: isParams_Creds
      serviceAccountPath: isParams_Creds
      metricInfo: map<String,MetricInfo>
      logInfo: map<String,LogInfo>
      trace: me.snowdrop.istio.mixer.adapter.stackdriver.Trace
  - class: me.snowdrop.istio.api.mesh.v1alpha1.Tracing
    fields:
      zipkin: isTracing_Tracer
      lightstep: isTracing_Tracer
      datadog: isTracing_Tracer
  - class: me.snowdrop.istio.api.authentication.v1alpha1.StringMatch
    fields:
      exact: isStringMatch_MatchType
      prefix: isStringMatch_MatchType
      regex: isStringMatch_MatchType
      suffix: isStringMatch_MatchType

make strict:

[creasy:~/go-workspace … /github.com/snowdrop/istio-java-api] master(+41/-5273) 46m47s ± make strict
go run ./cmd/generate/generate.go -strict > /home/creasy/go-workspace/src/github.com/snowdrop/istio-java-api/istio-model/src/main/resources/schema/istio-schema.json

Unknown interfaces:
isAttributes_AttributeValue_Value field value in istio.io/api/mixer/v1/Attributes_AttributeValue
isValue_Kind field kind in github.com/gogo/protobuf/types/Value
isValue_Value field value in istio.io/api/policy/v1beta1/Value

Unvisited packages:
istio.io/api/mcp/v1alpha1

Unvisited CRDs:
adapter: rbac
attributemanifest: core
clusterrbacconfig: rbac
handler: mixer-handler
httpapispec: 
httpapispecbinding: 
instance: mixer-instance
kubernetes: mixer-instance
listchecker: mixer-adapter
meshpolicy: 
noop: mixer-adapter
quotaspec: 
quotaspecbinding: 
servicecontrol: mixer-adapter
servicecontrolreport: mixer-instance
template: mixer-template

exit status 1
Makefile:27: recipe for target 'strict' failed
make: *** [strict] Error 1
metacosm commented 4 years ago

Yes, there are things that are currently not covered as shown by make strict. I visit these once in a while or based on needs (i.e. if someone asks for explicit support for something that is not currently covered). Is there something that is missing for your use case?

lianghuiyuan commented 4 years ago

Thank you! Actually, I used the Maven dependency istio-client, but come out some problems like

I am not sure If it is my unfamiliar of Istio or something... So, I want to build the Maven dependency from my own K8S env. But come out above problems.

metacosm commented 4 years ago

I will take a look ASAP.

metacosm commented 4 years ago

@lianghuiyuan do you still encounter issues?

lianghuiyuan commented 4 years ago

@metacosm Thank you for reminding. Your istio-java-api works fine in my project as maven dependency. This issue should be closed for I get focus on other programs these days. I will reopen it if I encounter issues or have a better understanding of k8s Operator, crds and istio, Thank you so much.