Skip to content

Commit 38c0626

Browse files
author
Clayton Pence
committed
Add analysis protos to make system
1 parent 4cfcb2f commit 38c0626

File tree

6 files changed

+2533
-0
lines changed

6 files changed

+2533
-0
lines changed

Makefile.core.mk

+26
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ gen: \
9595
generate-rbac \
9696
generate-authn \
9797
generate-security \
98+
generate-analysis \
9899
generate-envoy \
99100
generate-policy \
100101
generate-annotations \
@@ -366,6 +367,28 @@ generate-security: $(security_v1beta1_pb_gos) $(security_v1beta1_pb_docs) $(secu
366367
clean-security:
367368
@rm -fr $(security_v1beta1_pb_gos) $(security_v1beta1_pb_docs) $(security_v1beta1_pb_pythons) $(security_v1beta1_k8s_gos)
368369

370+
#####################
371+
# analysis/...
372+
#####################
373+
374+
analysis_v1alpha1_path := analysis/v1alpha1
375+
analysis_v1alpha1_protos := $(wildcard $(analysis_v1alpha1_path)/*.proto)
376+
analysis_v1alpha1_pb_gos := $(analysis_v1alpha1_protos:.proto=.pb.go)
377+
analysis_v1alpha1_pb_pythons := $(patsubst $(analysis_v1alpha1_path)/%.proto,$(python_output_path)/$(analysis_v1alpha1_path)/%_pb2.py,$(analysis_v1alpha1_protos))
378+
analysis_v1alpha1_pb_docs := $(analysis_v1alpha1_protos:.proto=.pb.html)
379+
analysis_v1alpha1_openapi := $(analysis_v1alpha1_protos:.proto=.gen.json)
380+
381+
382+
$(analysis_v1alpha1_pb_gos) $(analysis_v1alpha1_pb_docs) $(analysis_v1alpha1_pb_pythons): $(analysis_v1alpha1_protos)
383+
@$(protolock) status
384+
@$(protoc) $(gogofast_plugin) $(protoc_gen_docs_plugin_per_file)$(analysis_v1alpha1_path) $(protoc_gen_python_plugin) $^
385+
@cp -r /tmp/istio.io/api/analysis/* analysis
386+
387+
generate-analysis: $(analysis_v1alpha1_pb_gos) $(analysis_v1alpha1_pb_docs) $(analysis_v1alpha1_pb_pythons)
388+
389+
clean-analysis:
390+
@rm -fr $(analysis_v1alpha1_pb_gos) $(analysis_v1alpha1_pb_docs) $(analysis_v1alpha1_pb_pythons)
391+
369392
#####################
370393
# envoy/...
371394
#####################
@@ -440,6 +463,7 @@ all_protos := \
440463
$(rbac_v1alpha1_protos) \
441464
$(authn_v1alpha1_protos) \
442465
$(security_v1beta1_protos) \
466+
$(analysis_v1alpha1_protos) \
443467
$(type_v1beta1_protos)
444468

445469
all_openapi := \
@@ -454,6 +478,7 @@ all_openapi := \
454478
$(rbac_v1alpha1_openapi) \
455479
$(authn_v1alpha1_openapi) \
456480
$(security_v1beta1_openapi) \
481+
$(analysis_v1alpha1_openapi) \
457482
$(type_v1beta1_openapi)
458483

459484
all_openapi_crd := kubernetes/customresourcedefinitions.gen.yaml
@@ -492,6 +517,7 @@ clean: \
492517
clean-annotations \
493518
clean-openapi-schema \
494519
clean-security \
520+
generate-analysis \
495521
clean-type \
496522
clean-openapi-crd
497523

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
{
2+
"openapi": "3.0.0",
3+
"info": {
4+
"title": "Describes the structure of messages generated by Istio analyzers.",
5+
"version": "v1alpha1"
6+
},
7+
"components": {
8+
"schemas": {
9+
"istio.analysis.v1alpha1.AnalysisMessageBase": {
10+
"description": "AnalysisMessageBase describes some common information that is needed for all messages. All information should be static with respect to the error code.",
11+
"type": "object",
12+
"properties": {
13+
"name": {
14+
"description": "A human-readable name for the message type. e.g. \"InternalError\", \"PodMissingProxy\". This should be the same for all messages of the same type. Required.",
15+
"type": "string",
16+
"format": "string"
17+
},
18+
"code": {
19+
"description": "A 7 character code matching `^IST[0-9]{4}$` intended to uniquely identify the message type. (e.g. \"IST0001\" is mapped to the \"InternalError\" message type.) 0000-0100 are reserved. Required.",
20+
"type": "string",
21+
"format": "string"
22+
},
23+
"level": {
24+
"$ref": "#/components/schemas/istio.analysis.v1alpha1.AnalysisMessageBase.Level"
25+
},
26+
"documentationUrl": {
27+
"description": "A url pointing to the Istio documentation for this specific error type. Should be of the form `^http(s)?://(preliminary\\.)?istio.io/docs/reference/config/analysis/` Required.",
28+
"type": "string",
29+
"format": "string"
30+
}
31+
}
32+
},
33+
"istio.analysis.v1alpha1.AnalysisMessageBase.Level": {
34+
"description": "The values here are chosen so that more severe messages get sorted higher, as well as leaving space in between to add more later",
35+
"type": "string",
36+
"enum": [
37+
"UNKNOWN",
38+
"ERROR",
39+
"WARNING",
40+
"INFO"
41+
]
42+
},
43+
"istio.analysis.v1alpha1.AnalysisMessageWeakSchema": {
44+
"description": "AnalysisMessageWeakSchema is the set of information that's needed to define a weakly-typed schema. The purpose of this proto is to provide a mechanism for validating istio/istio/galley/pkg/config/analysis/msg/messages.yaml to make sure that we don't allow committing underspecified types.",
45+
"type": "object",
46+
"properties": {
47+
"messageBase": {
48+
"$ref": "#/components/schemas/istio.analysis.v1alpha1.AnalysisMessageBase"
49+
},
50+
"description": {
51+
"description": "A human readable description of what the error means. Required.",
52+
"type": "string",
53+
"format": "string"
54+
},
55+
"template": {
56+
"description": "A go-style template string defining how to combine the args for a particular message into a log line. Required.",
57+
"type": "string",
58+
"format": "string"
59+
},
60+
"args": {
61+
"description": "A description of the arguments for a particular message type",
62+
"type": "array",
63+
"items": {
64+
"$ref": "#/components/schemas/istio.analysis.v1alpha1.AnalysisMessageWeakSchema.ArgType"
65+
}
66+
}
67+
}
68+
},
69+
"istio.analysis.v1alpha1.AnalysisMessageWeakSchema.ArgType": {
70+
"type": "object",
71+
"properties": {
72+
"name": {
73+
"description": "Required",
74+
"type": "string",
75+
"format": "string"
76+
},
77+
"goType": {
78+
"description": "Required. Should be a golang type, used in code generation",
79+
"type": "string",
80+
"format": "string"
81+
}
82+
}
83+
},
84+
"istio.analysis.v1alpha1.GenericAnalysisMessage": {
85+
"description": "GenericAnalysisMessage is an instance of an AnalysisMessage defined by a schema, whose metaschema is AnalysisMessageWeakSchema. (Names are hard.) Code should be able to perform validation of arguments as needed by using the message type information to look at the AnalysisMessageWeakSchema and examine the list of args at runtime. Developers can also create stronger-typed versions of GenericAnalysisMessage for well-known and stable message types.",
86+
"type": "object",
87+
"properties": {
88+
"messageBase": {
89+
"$ref": "#/components/schemas/istio.analysis.v1alpha1.AnalysisMessageBase"
90+
},
91+
"args": {
92+
"description": "Any message-type specific arguments that need to get codified. Optional.",
93+
"type": "object"
94+
},
95+
"resourcePaths": {
96+
"description": "A list of strings specifying the path for resources which were the cause of message generation. At least one is required.",
97+
"type": "array",
98+
"items": {
99+
"type": "string",
100+
"format": "string"
101+
}
102+
}
103+
}
104+
},
105+
"istio.analysis.v1alpha1.InternalErrorAnalysisMessage": {
106+
"description": "InternalErrorAnalysisMessage is a strongly-typed message representing some error in Istio code that prevented us from performing analysis at all.",
107+
"type": "object",
108+
"properties": {
109+
"messageBase": {
110+
"$ref": "#/components/schemas/istio.analysis.v1alpha1.AnalysisMessageBase"
111+
},
112+
"detail": {
113+
"description": "Any detail regarding specifics of the error. Should be human-readable.",
114+
"type": "string",
115+
"format": "string"
116+
}
117+
}
118+
}
119+
}
120+
}
121+
}

0 commit comments

Comments
 (0)