Browse Source

Update common files. (#16989)

Martin Taillefer 1 month ago
parent
commit
03387cfe48
No account linked to committer's email address
100 changed files with 14874 additions and 793 deletions
  1. 1
    1
      .commonfiles.sha
  2. 3
    0
      .gitattributes
  3. 61
    773
      Makefile
  4. 800
    0
      Makefile.core.mk
  5. 22
    0
      Makefile.overrides.mk
  6. 1
    1
      SUPPORT.md
  7. 4
    4
      bin/codecov.sh
  8. 1
    1
      bin/counterfeiter.sh
  9. 4
    13
      bin/protoc.sh
  10. 1
    0
      common-protos/.commonfiles.sha
  11. 101
    0
      common-protos/github.com/census-instrumentation/opencensus-proto/src/opencensus/proto/agent/common/v1/common.proto
  12. 58
    0
      common-protos/github.com/census-instrumentation/opencensus-proto/src/opencensus/proto/agent/metrics/v1/metrics_service.proto
  13. 87
    0
      common-protos/github.com/census-instrumentation/opencensus-proto/src/opencensus/proto/agent/trace/v1/trace_service.proto
  14. 303
    0
      common-protos/github.com/census-instrumentation/opencensus-proto/src/opencensus/proto/metrics/v1/metrics.proto
  15. 35
    0
      common-protos/github.com/census-instrumentation/opencensus-proto/src/opencensus/proto/resource/v1/resource.proto
  16. 138
    0
      common-protos/github.com/census-instrumentation/opencensus-proto/src/opencensus/proto/stats/v1/stats.proto
  17. 422
    0
      common-protos/github.com/census-instrumentation/opencensus-proto/src/opencensus/proto/trace/v1/trace.proto
  18. 81
    0
      common-protos/github.com/census-instrumentation/opencensus-proto/src/opencensus/proto/trace/v1/trace_config.proto
  19. 131
    0
      common-protos/github.com/envoyproxy/protoc-gen-validate/gogoproto/gogo.proto
  20. 772
    0
      common-protos/github.com/envoyproxy/protoc-gen-validate/validate/validate.proto
  21. 155
    0
      common-protos/github.com/gogo/protobuf/protobuf/google/protobuf/any.proto
  22. 210
    0
      common-protos/github.com/gogo/protobuf/protobuf/google/protobuf/api.proto
  23. 167
    0
      common-protos/github.com/gogo/protobuf/protobuf/google/protobuf/compiler/plugin.proto
  24. 883
    0
      common-protos/github.com/gogo/protobuf/protobuf/google/protobuf/descriptor.proto
  25. 117
    0
      common-protos/github.com/gogo/protobuf/protobuf/google/protobuf/duration.proto
  26. 52
    0
      common-protos/github.com/gogo/protobuf/protobuf/google/protobuf/empty.proto
  27. 245
    0
      common-protos/github.com/gogo/protobuf/protobuf/google/protobuf/field_mask.proto
  28. 48
    0
      common-protos/github.com/gogo/protobuf/protobuf/google/protobuf/source_context.proto
  29. 96
    0
      common-protos/github.com/gogo/protobuf/protobuf/google/protobuf/struct.proto
  30. 137
    0
      common-protos/github.com/gogo/protobuf/protobuf/google/protobuf/timestamp.proto
  31. 187
    0
      common-protos/github.com/gogo/protobuf/protobuf/google/protobuf/type.proto
  32. 123
    0
      common-protos/github.com/gogo/protobuf/protobuf/google/protobuf/wrappers.proto
  33. 82
    0
      common-protos/github.com/prometheus/client_model/metrics.proto
  34. 144
    0
      common-protos/gogoproto/gogo.proto
  35. 31
    0
      common-protos/google/api/annotations.proto
  36. 184
    0
      common-protos/google/api/auth.proto
  37. 127
    0
      common-protos/google/api/backend.proto
  38. 67
    0
      common-protos/google/api/billing.proto
  39. 100
    0
      common-protos/google/api/client.proto
  40. 85
    0
      common-protos/google/api/config_change.proto
  41. 82
    0
      common-protos/google/api/consumer.proto
  42. 90
    0
      common-protos/google/api/context.proto
  43. 33
    0
      common-protos/google/api/control.proto
  44. 212
    0
      common-protos/google/api/distribution.proto
  45. 157
    0
      common-protos/google/api/documentation.proto
  46. 70
    0
      common-protos/google/api/endpoint.proto
  47. 44
    0
      common-protos/google/api/expr/v1alpha1/cel_service.proto
  48. 336
    0
      common-protos/google/api/expr/v1alpha1/checked.proto
  49. 165
    0
      common-protos/google/api/expr/v1alpha1/conformance_service.proto
  50. 119
    0
      common-protos/google/api/expr/v1alpha1/eval.proto
  51. 54
    0
      common-protos/google/api/expr/v1alpha1/explain.proto
  52. 322
    0
      common-protos/google/api/expr/v1alpha1/syntax.proto
  53. 116
    0
      common-protos/google/api/expr/v1alpha1/value.proto
  54. 84
    0
      common-protos/google/api/expr/v1beta1/decl.proto
  55. 125
    0
      common-protos/google/api/expr/v1beta1/eval.proto
  56. 269
    0
      common-protos/google/api/expr/v1beta1/expr.proto
  57. 62
    0
      common-protos/google/api/expr/v1beta1/source.proto
  58. 114
    0
      common-protos/google/api/expr/v1beta1/value.proto
  59. 79
    0
      common-protos/google/api/field_behavior.proto
  60. 376
    0
      common-protos/google/api/http.proto
  61. 78
    0
      common-protos/google/api/httpbody.proto
  62. 49
    0
      common-protos/google/api/label.proto
  63. 67
    0
      common-protos/google/api/launch_stage.proto
  64. 55
    0
      common-protos/google/api/log.proto
  65. 81
    0
      common-protos/google/api/logging.proto
  66. 219
    0
      common-protos/google/api/metric.proto
  67. 119
    0
      common-protos/google/api/monitored_resource.proto
  68. 91
    0
      common-protos/google/api/monitoring.proto
  69. 187
    0
      common-protos/google/api/quota.proto
  70. 175
    0
      common-protos/google/api/resource.proto
  71. 176
    0
      common-protos/google/api/service.proto
  72. 98
    0
      common-protos/google/api/servicecontrol/v1/check_error.proto
  73. 158
    0
      common-protos/google/api/servicecontrol/v1/distribution.proto
  74. 66
    0
      common-protos/google/api/servicecontrol/v1/log_entry.proto
  75. 78
    0
      common-protos/google/api/servicecontrol/v1/metric_value.proto
  76. 113
    0
      common-protos/google/api/servicecontrol/v1/operation.proto
  77. 206
    0
      common-protos/google/api/servicecontrol/v1/quota_controller.proto
  78. 204
    0
      common-protos/google/api/servicecontrol/v1/service_controller.proto
  79. 299
    0
      common-protos/google/api/servicemanagement/v1/resources.proto
  80. 503
    0
      common-protos/google/api/servicemanagement/v1/servicemanager.proto
  81. 32
    0
      common-protos/google/api/source_info.proto
  82. 96
    0
      common-protos/google/api/system_parameter.proto
  83. 90
    0
      common-protos/google/api/usage.proto
  84. 155
    0
      common-protos/google/protobuf/any.proto
  85. 210
    0
      common-protos/google/protobuf/api.proto
  86. 168
    0
      common-protos/google/protobuf/compiler/plugin.proto
  87. 67
    0
      common-protos/google/protobuf/compiler/ruby/ruby_generated_code.proto
  88. 68
    0
      common-protos/google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto
  89. 9
    0
      common-protos/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto
  90. 9
    0
      common-protos/google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy.proto
  91. 7
    0
      common-protos/google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto
  92. 885
    0
      common-protos/google/protobuf/descriptor.proto
  93. 116
    0
      common-protos/google/protobuf/duration.proto
  94. 52
    0
      common-protos/google/protobuf/empty.proto
  95. 245
    0
      common-protos/google/protobuf/field_mask.proto
  96. 48
    0
      common-protos/google/protobuf/source_context.proto
  97. 95
    0
      common-protos/google/protobuf/struct.proto
  98. 138
    0
      common-protos/google/protobuf/timestamp.proto
  99. 187
    0
      common-protos/google/protobuf/type.proto
  100. 0
    0
      common-protos/google/protobuf/util/json_format.proto

+ 1
- 1
.commonfiles.sha View File

@@ -1 +1 @@
1
-2b1ae235161579701e9fb933dce3e3ccba367030
1
+e7512685241115f42cbb3ed7856a4a2a12057536

+ 3
- 0
.gitattributes View File

@@ -4,3 +4,6 @@
4 4
 *.descriptor_set  -diff -merge
5 5
 *.pb.html linguist-generated=true
6 6
 *.pb.go linguist-generated=true
7
+*.gen.go linguist-generated=true
8
+*.gen.yaml linguist-generated=true
9
+*_pb2.py linguist-generated=true

+ 61
- 773
Makefile View File

@@ -1,68 +1,39 @@
1
-## Copyright 2017 Istio Authors
2
-##
3
-## Licensed under the Apache License, Version 2.0 (the "License");
4
-## you may not use this file except in compliance with the License.
5
-## You may obtain a copy of the License at
6
-##
7
-##     http://www.apache.org/licenses/LICENSE-2.0
8
-##
9
-## Unless required by applicable law or agreed to in writing, software
10
-## distributed under the License is distributed on an "AS IS" BASIS,
11
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
-## See the License for the specific language governing permissions and
13
-## limitations under the License.
14
-
15
-#-----------------------------------------------------------------------------
16
-# Global Variables
17
-#-----------------------------------------------------------------------------
18
-ISTIO_GO := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
19
-export ISTIO_GO
20
-SHELL := /bin/bash -o pipefail
21
-
22
-VERSION ?= 1.4-dev
23
-
24
-# Base version of Istio image to use
25
-BASE_VERSION ?= 1.4
26
-
27
-export GO111MODULE ?= on
28
-export GOPROXY ?= https://proxy.golang.org
29
-export GOSUMDB ?= sum.golang.org
30
-
31
-# locations where artifacts are stored
32
-ISTIO_DOCKER_HUB ?= docker.io/istio
33
-export ISTIO_DOCKER_HUB
34
-ISTIO_GCS ?= istio-release/releases/$(VERSION)
35
-ISTIO_URL ?= https://storage.googleapis.com/$(ISTIO_GCS)
36
-ISTIO_CNI_HUB ?= gcr.io/istio-release
37
-export ISTIO_CNI_HUB
38
-ISTIO_CNI_TAG ?= master-latest-daily
39
-export ISTIO_CNI_TAG
40
-
41
-# cumulatively track the directories/files to delete after a clean
42
-DIRS_TO_CLEAN:=
43
-FILES_TO_CLEAN:=
44
-
45
-# If GOPATH is not set by the env, set it to a sane value
46
-GOPATH ?= $(shell cd ${ISTIO_GO}/../../..; pwd)
47
-export GOPATH
48
-
49
-# If GOPATH is made up of several paths, use the first one for our targets in this Makefile
50
-GO_TOP := $(shell echo ${GOPATH} | cut -d ':' -f1)
51
-export GO_TOP
52
-
53
-# Note that disabling cgo here adversely affects go get.  Instead we'll rely on this
54
-# to be handled in bin/gobuild.sh
55
-# export CGO_ENABLED=0
1
+# WARNING: DO NOT EDIT, THIS FILE IS PROBABLY A COPY
2
+#
3
+# The original version of this file is located in the https://github.com/istio/common-files repo.
4
+# If you're looking at this file in a different repo and want to make a change, please go to the
5
+# common-files repo, make the change there and check it in. Then come back to this repo and run
6
+# "make update-common".
56 7
 
57
-# It's more concise to use GO?=$(shell which go)
58
-# but the following approach uses a more efficient "simply expanded" :=
59
-# variable instead of a "recursively expanded" =
60
-ifeq ($(origin GO), undefined)
61
-  GO:=$(shell which go)
62
-endif
63
-ifeq ($(GO),)
64
-  $(error Could not find 'go' in path.  Please install go, or if already installed either add it to your path or set GO to point to its directory)
65
-endif
8
+# Copyright Istio Authors
9
+#
10
+# Licensed under the Apache License, Version 2.0 (the "License");
11
+# you may not use this file except in compliance with the License.
12
+# You may obtain a copy of the License at
13
+#
14
+#    http://www.apache.org/licenses/LICENSE-2.0
15
+#
16
+# Unless required by applicable law or agreed to in writing, software
17
+# distributed under the License is distributed on an "AS IS" BASIS,
18
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+# See the License for the specific language governing permissions and
20
+# limitations under the License.
21
+
22
+# allow optional per-repo overrides
23
+-include Makefile.overrides.mk
24
+
25
+# Set the environment variable BUILD_WITH_CONTAINER to use a container
26
+# to build the repo. The only dependencies in this mode are to have make and
27
+# docker. If you'd rather build with a local tool chain instead, you'll need to
28
+# figure out all the tools you need in your environment to make that work.
29
+export BUILD_WITH_CONTAINER ?= 0
30
+
31
+ifeq ($(BUILD_WITH_CONTAINER),1)
32
+IMG = gcr.io/istio-testing/build-tools:2019-09-11T09-52-48
33
+UID = $(shell id -u)
34
+PWD = $(shell pwd)
35
+GOBIN_SOURCE ?= $(GOPATH)/bin
36
+GOBIN ?= /work/out/bin
66 37
 
67 38
 LOCAL_ARCH := $(shell uname -m)
68 39
 ifeq ($(LOCAL_ARCH),x86_64)
@@ -74,727 +45,44 @@ GOARCH_LOCAL := arm
74 45
 else
75 46
 GOARCH_LOCAL := $(LOCAL_ARCH)
76 47
 endif
77
-export GOARCH ?= $(GOARCH_LOCAL)
48
+
49
+GOARCH ?= $(GOARCH_LOCAL)
78 50
 
79 51
 LOCAL_OS := $(shell uname)
80 52
 ifeq ($(LOCAL_OS),Linux)
81
-   export GOOS_LOCAL = linux
53
+   GOOS_LOCAL = linux
82 54
 else ifeq ($(LOCAL_OS),Darwin)
83
-   export GOOS_LOCAL = darwin
55
+   GOOS_LOCAL = darwin
84 56
 else
85 57
    $(error "This system's OS $(LOCAL_OS) isn't recognized/supported")
86
-   # export GOOS_LOCAL ?= windows
87 58
 endif
88 59
 
89
-export GOOS ?= $(GOOS_LOCAL)
90
-
91
-export ENABLE_COREDUMP ?= false
92
-
93
-# Enable Istio CNI in helm template commands
94
-export ENABLE_ISTIO_CNI ?= false
95
-
96
-# NOTE: env var EXTRA_HELM_SETTINGS can contain helm chart override settings, example:
97
-# EXTRA_HELM_SETTINGS="--set istio-cni.excludeNamespaces={} --set-string istio-cni.tag=v0.1-dev-foo"
98
-
99
-#-----------------------------------------------------------------------------
100
-# Output control
101
-#-----------------------------------------------------------------------------
102
-# Invoke make VERBOSE=1 to enable echoing of the command being executed
103
-export VERBOSE ?= 0
104
-# Place the variable Q in front of a command to control echoing of the command being executed.
105
-Q = $(if $(filter 1,$VERBOSE),,@)
106
-# Use the variable H to add a header (equivalent to =>) to informational output
107
-H = $(shell printf "\033[34;1m=>\033[0m")
108
-
109
-# To build Pilot, Mixer and CA with debugger information, use DEBUG=1 when invoking make
110
-goVerStr := $(shell $(GO) version | awk '{split($$0,a," ")}; {print a[3]}')
111
-goVerNum := $(shell echo $(goVerStr) | awk '{split($$0,a,"go")}; {print a[2]}')
112
-goVerMajor := $(shell echo $(goVerNum) | awk '{split($$0, a, ".")}; {print a[1]}')
113
-goVerMinor := $(shell echo $(goVerNum) | awk '{split($$0, a, ".")}; {print a[2]}' | sed -e 's/\([0-9]\+\).*/\1/')
114
-gcflagsPattern := $(shell ( [ $(goVerMajor) -ge 1 ] && [ ${goVerMinor} -ge 10 ] ) && echo 'all=' || echo '')
115
-
116
-ifeq ($(origin DEBUG), undefined)
117
-  BUILDTYPE_DIR:=release
118
-else ifeq ($(DEBUG),0)
119
-  BUILDTYPE_DIR:=release
60
+GOOS ?= $(GOOS_LOCAL)
61
+
62
+RUN = docker run -t -i --sig-proxy=true -u $(UID) --rm \
63
+	-e GOOS="$(GOOS)" \
64
+	-e GOARCH="$(GOARCH)" \
65
+	-e GOBIN="$(GOBIN)" \
66
+	-e BUILD_WITH_CONTAINER="$(BUILD_WITH_CONTAINER)" \
67
+	-v /etc/passwd:/etc/passwd:ro \
68
+	-v $(readlink /etc/localtime):/etc/localtime:ro \
69
+	-v /var/run/docker.sock:/var/run/docker.sock \
70
+	$(CONTAINER_OPTIONS) \
71
+	--mount type=bind,source="$(PWD)",destination="/work" \
72
+	--mount type=volume,source=istio-go-mod,destination="/go/pkg/mod" \
73
+	--mount type=volume,source=istio-go-cache,destination="/gocache" \
74
+	--mount type=bind,source="$(GOBIN_SOURCE)",destination="/go/out/bin" \
75
+	-w /work $(IMG)
120 76
 else
121
-  BUILDTYPE_DIR:=debug
122
-  export GCFLAGS:=$(gcflagsPattern)-N -l
123
-  $(info $(H) Build with debugger information)
77
+RUN =
124 78
 endif
125 79
 
126
-# Optional file including user-specific settings (HUB, TAG, etc)
127
--include .istiorc.mk
80
+MAKE = $(RUN) make --no-print-directory -e -f Makefile.core.mk
128 81
 
129
-# @todo allow user to run for a single $PKG only?
130
-PACKAGES_CMD := GOPATH=$(GOPATH) $(GO) list ./...
131
-GO_EXCLUDE := /vendor/|.pb.go|.gen.go
132
-GO_FILES_CMD := find . -name '*.go' | grep -v -E '$(GO_EXCLUDE)'
82
+%:
83
+	@$(MAKE) $@
133 84
 
134
-# Environment for tests, the directory containing istio and deps binaries.
135
-# Typically same as GOPATH/bin, so tests work seemlessly with IDEs.
136
-
137
-export ISTIO_BIN=$(GO_TOP)/bin
138
-# Using same package structure as pkg/
139
-export OUT_DIR=$(GO_TOP)/out
140
-export ISTIO_OUT:=$(OUT_DIR)/$(GOOS)_$(GOARCH)/$(BUILDTYPE_DIR)
141
-export ISTIO_OUT_LINUX:=$(OUT_DIR)/linux_amd64/$(BUILDTYPE_DIR)
142
-export HELM=$(ISTIO_OUT)/helm
143
-export ARTIFACTS ?= $(ISTIO_OUT)
144
-
145
-# scratch dir: this shouldn't be simply 'docker' since that's used for docker.save to store tar.gz files
146
-ISTIO_DOCKER:=${ISTIO_OUT_LINUX}/docker_temp
147
-# Config file used for building istio:proxy container.
148
-DOCKER_PROXY_CFG?=Dockerfile.proxy
149
-
150
-# scratch dir for building isolated images. Please don't remove it again - using
151
-# ISTIO_DOCKER results in slowdown, all files (including multiple copies of envoy) will be
152
-# copied to the docker temp container - even if you add only a tiny file, >1G of data will
153
-# be copied, for each docker image.
154
-DOCKER_BUILD_TOP:=${ISTIO_OUT_LINUX}/docker_build
155
-
156
-# dir where tar.gz files from docker.save are stored
157
-ISTIO_DOCKER_TAR:=${ISTIO_OUT_LINUX}/docker
158
-
159
-# Populate the git version for istio/proxy (i.e. Envoy)
160
-ifeq ($(PROXY_REPO_SHA),)
161
-  export PROXY_REPO_SHA:=$(shell grep PROXY_REPO_SHA istio.deps  -A 4 | grep lastStableSHA | cut -f 4 -d '"')
162
-endif
163
-
164
-# Envoy binary variables Keep the default URLs up-to-date with the latest push from istio/proxy.
165
-
166
-# OS-neutral vars. These currently only work for linux.
167
-export ISTIO_ENVOY_VERSION ?= ${PROXY_REPO_SHA}
168
-export ISTIO_ENVOY_DEBUG_URL ?= https://storage.googleapis.com/istio-build/proxy/envoy-debug-$(ISTIO_ENVOY_VERSION).tar.gz
169
-export ISTIO_ENVOY_RELEASE_URL ?= https://storage.googleapis.com/istio-build/proxy/envoy-alpha-$(ISTIO_ENVOY_VERSION).tar.gz
170
-
171
-# Envoy Linux vars.
172
-export ISTIO_ENVOY_LINUX_VERSION ?= ${ISTIO_ENVOY_VERSION}
173
-export ISTIO_ENVOY_LINUX_DEBUG_URL ?= ${ISTIO_ENVOY_DEBUG_URL}
174
-export ISTIO_ENVOY_LINUX_RELEASE_URL ?= ${ISTIO_ENVOY_RELEASE_URL}
175
-# Variables for the extracted debug/release Envoy artifacts.
176
-export ISTIO_ENVOY_LINUX_DEBUG_DIR ?= ${OUT_DIR}/linux_amd64/debug
177
-export ISTIO_ENVOY_LINUX_DEBUG_NAME ?= envoy-debug-${ISTIO_ENVOY_LINUX_VERSION}
178
-export ISTIO_ENVOY_LINUX_DEBUG_PATH ?= ${ISTIO_ENVOY_LINUX_DEBUG_DIR}/${ISTIO_ENVOY_LINUX_DEBUG_NAME}
179
-export ISTIO_ENVOY_LINUX_RELEASE_DIR ?= ${OUT_DIR}/linux_amd64/release
180
-export ISTIO_ENVOY_LINUX_RELEASE_NAME ?= envoy-${ISTIO_ENVOY_VERSION}
181
-export ISTIO_ENVOY_LINUX_RELEASE_PATH ?= ${ISTIO_ENVOY_LINUX_RELEASE_DIR}/${ISTIO_ENVOY_LINUX_RELEASE_NAME}
182
-
183
-# Envoy macOS vars.
184
-# TODO Change url when official envoy release for macOS is available
185
-export ISTIO_ENVOY_MACOS_VERSION ?= 1.0.2
186
-export ISTIO_ENVOY_MACOS_RELEASE_URL ?= https://github.com/istio/proxy/releases/download/${ISTIO_ENVOY_MACOS_VERSION}/istio-proxy-${ISTIO_ENVOY_MACOS_VERSION}-macos.tar.gz
187
-# Variables for the extracted debug/release Envoy artifacts.
188
-export ISTIO_ENVOY_MACOS_RELEASE_DIR ?= ${OUT_DIR}/darwin_amd64/release
189
-export ISTIO_ENVOY_MACOS_RELEASE_NAME ?= envoy-${ISTIO_ENVOY_MACOS_VERSION}
190
-export ISTIO_ENVOY_MACOS_RELEASE_PATH ?= ${ISTIO_ENVOY_MACOS_RELEASE_DIR}/${ISTIO_ENVOY_MACOS_RELEASE_NAME}
191
-
192
-# Allow user-override for a local Envoy build.
193
-export USE_LOCAL_PROXY ?= 0
194
-ifeq ($(USE_LOCAL_PROXY),1)
195
-  export ISTIO_ENVOY_LOCAL ?= $(realpath ${ISTIO_GO}/../proxy/bazel-bin/src/envoy/envoy)
196
-  # Point the native paths to the local envoy build.
197
-  ifeq ($(GOOS_LOCAL), Darwin)
198
-    export ISTIO_ENVOY_MACOS_RELEASE_DIR = $(dir ${ISTIO_ENVOY_LOCAL})
199
-    export ISTIO_ENVOY_MACOS_RELEASE_PATH = ${ISTIO_ENVOY_LOCAL}
200
-  else
201
-    export ISTIO_ENVOY_LINUX_DEBUG_DIR = $(dir ${ISTIO_ENVOY_LOCAL})
202
-    export ISTIO_ENVOY_LINUX_RELEASE_DIR = $(dir ${ISTIO_ENVOY_LOCAL})
203
-    export ISTIO_ENVOY_LINUX_DEBUG_PATH = ${ISTIO_ENVOY_LOCAL}
204
-    export ISTIO_ENVOY_LINUX_RELEASE_PATH = ${ISTIO_ENVOY_LOCAL}
205
-  endif
206
-endif
207
-
208
-GO_VERSION_REQUIRED:=1.10
209
-
210
-HUB?=istio
211
-ifeq ($(HUB),)
212
-  $(error "HUB cannot be empty")
213
-endif
214
-
215
-# If tag not explicitly set in users' .istiorc.mk or command line, default to the git sha.
216
-TAG ?= $(shell git rev-parse --verify HEAD)
217
-ifeq ($(TAG),)
218
-  $(error "TAG cannot be empty")
219
-endif
220
-
221
-VARIANT :=
222
-ifeq ($(VARIANT),)
223
-  TAG_VARIANT:=${TAG}
224
-else
225
-  TAG_VARIANT:=${TAG}-${VARIANT}
226
-endif
227
-
228
-PULL_POLICY ?= IfNotPresent
229
-ifeq ($(TAG),latest)
230
-  PULL_POLICY = Always
231
-endif
232
-ifeq ($(PULL_POLICY),)
233
-  $(error "PULL_POLICY cannot be empty")
234
-endif
235
-
236
-GEN_CERT := ${ISTIO_BIN}/generate_cert
237
-
238
-# Set Google Storage bucket if not set
239
-GS_BUCKET ?= istio-artifacts
85
+default:
86
+	@$(MAKE)
240 87
 
241 88
 .PHONY: default
242
-default: depend build test
243
-
244
-# The point of these is to allow scripts to query where artifacts
245
-# are stored so that tests and other consumers of the build don't
246
-# need to be updated to follow the changes in the Makefiles.
247
-# Note that the query needs to pass the same types of parameters
248
-# (e.g., DEBUG=0, GOOS=linux) as the actual build for the query
249
-# to provide an accurate result.
250
-.PHONY: where-is-out where-is-docker-temp where-is-docker-tar
251
-where-is-out:
252
-	@echo ${ISTIO_OUT}
253
-where-is-docker-temp:
254
-	@echo ${ISTIO_DOCKER}
255
-where-is-docker-tar:
256
-	@echo ${ISTIO_DOCKER_TAR}
257
-
258
-#-----------------------------------------------------------------------------
259
-# Target: depend
260
-#-----------------------------------------------------------------------------
261
-.PHONY: depend init
262
-
263
-# Parse out the x.y or x.y.z version and output a single value x*10000+y*100+z (e.g., 1.9 is 10900)
264
-# that allows the three components to be checked in a single comparison.
265
-VER_TO_INT:=awk '{split(substr($$0, match ($$0, /[0-9\.]+/)), a, "."); print a[1]*10000+a[2]*100+a[3]}'
266
-
267
-# using a sentinel file so this check is only performed once per version.  Performance is
268
-# being favored over the unlikely situation that go gets downgraded to an older version
269
-check-go-version: | $(ISTIO_BIN) ${ISTIO_BIN}/have_go_$(GO_VERSION_REQUIRED)
270
-${ISTIO_BIN}/have_go_$(GO_VERSION_REQUIRED):
271
-	@if test $(shell $(GO) version | $(VER_TO_INT) ) -lt \
272
-                 $(shell echo "$(GO_VERSION_REQUIRED)" | $(VER_TO_INT) ); \
273
-                 then printf "go version $(GO_VERSION_REQUIRED)+ required, found: "; $(GO) version; exit 1; fi
274
-	@touch ${ISTIO_BIN}/have_go_$(GO_VERSION_REQUIRED)
275
-
276
-
277
-# Downloads envoy, based on the SHA defined in the base pilot Dockerfile
278
-init: check-go-version $(ISTIO_OUT)/istio_is_init
279
-	mkdir -p ${OUT_DIR}/logs
280
-
281
-# Sync is the same as init in release branch. In master this pulls from master.
282
-sync: init
283
-
284
-# I tried to make this dependent on what I thought was the appropriate
285
-# lock file, but it caused the rule for that file to get run (which
286
-# seems to be about obtaining a new version of the 3rd party libraries).
287
-$(ISTIO_OUT)/istio_is_init: bin/init.sh istio.deps | $(ISTIO_OUT)
288
-	ISTIO_OUT=$(ISTIO_OUT) bin/init.sh
289
-	touch $(ISTIO_OUT)/istio_is_init
290
-
291
-# init.sh downloads envoy
292
-${ISTIO_OUT}/envoy: init
293
-${ISTIO_ENVOY_LINUX_DEBUG_PATH}: init
294
-${ISTIO_ENVOY_LINUX_RELEASE_PATH}: init
295
-${ISTIO_ENVOY_MACOS_RELEASE_PATH}: init
296
-
297
-# Pull dependencies, based on the checked in Gopkg.lock file.
298
-# Developers must manually run `dep ensure` if adding new deps
299
-depend: init | $(ISTIO_OUT)
300
-
301
-OUTPUT_DIRS = $(ISTIO_OUT) $(ISTIO_BIN)
302
-DIRS_TO_CLEAN+=${ISTIO_OUT}
303
-ifneq ($(ISTIO_OUT),$(ISTIO_OUT_LINUX))
304
-  OUTPUT_DIRS += $(ISTIO_OUT_LINUX)
305
-  DIRS_TO_CLEAN += $(ISTIO_OUT_LINUX)
306
-endif
307
-
308
-$(OUTPUT_DIRS):
309
-	@mkdir -p $@
310
-
311
-.PHONY: ${GEN_CERT}
312
-${GEN_CERT}:
313
-	GOOS=$(GOOS_LOCAL) && GOARCH=$(GOARCH_LOCAL) && CGO_ENABLED=1 bin/gobuild.sh $@ ./security/tools/generate_cert
314
-
315
-#-----------------------------------------------------------------------------
316
-# Target: precommit
317
-#-----------------------------------------------------------------------------
318
-.PHONY: precommit format format.gofmt format.goimports lint buildcache
319
-
320
-# Target run by the pre-commit script, to automate formatting and lint
321
-# If pre-commit script is not used, please run this manually.
322
-precommit: format lint
323
-
324
-format:
325
-	scripts/run_gofmt.sh
326
-	go mod tidy
327
-
328
-fmt:
329
-	scripts/run_gofmt.sh
330
-	go mod tidy
331
-
332
-# Build with -i to store the build caches into $GOPATH/pkg
333
-buildcache:
334
-	GOBUILDFLAGS=-i $(MAKE) build
335
-
336
-# Existence of build cache .a files actually affects the results of
337
-# some linters; they need to exist.
338
-lint: buildcache
339
-	SKIP_INIT=1 bin/linters.sh
340
-
341
-shellcheck:
342
-	bin/check_shell_scripts.sh
343
-
344
-#-----------------------------------------------------------------------------
345
-# Target: go build
346
-#-----------------------------------------------------------------------------
347
-
348
-# gobuild script uses custom linker flag to set the variables.
349
-# Params: OUT VERSION_PKG SRC
350
-
351
-RELEASE_LDFLAGS='-extldflags -static -s -w'
352
-DEBUG_LDFLAGS='-extldflags "-static"'
353
-
354
-# Generates build both native and linux (needed by Docker) targets for an application
355
-# Params:
356
-# $(1): The base name for the generated target. If the name specified is "app", then targets will be generated for:
357
-#   app, $(ISTIO_OUT)/app and additionally $(ISTIO_OUT_LINUX)/app if GOOS != linux.
358
-# $(2): The path to the source directory for the application
359
-# $(3): The value for LDFLAGS
360
-define genTargetsForNativeAndDocker
361
-$(ISTIO_OUT)/$(1):
362
-	STATIC=0 GOOS=$(GOOS) GOARCH=$(GOARCH) LDFLAGS=$(3) bin/gobuild.sh $(ISTIO_OUT)/$(1) $(2)
363
-
364
-.PHONY: $(1)
365
-$(1):
366
-	STATIC=0 GOOS=$(GOOS) GOARCH=$(GOARCH) LDFLAGS=$(3) bin/gobuild.sh $(ISTIO_OUT)/$(1) $(2)
367
-
368
-ifneq ($(ISTIO_OUT),$(ISTIO_OUT_LINUX))
369
-$(ISTIO_OUT_LINUX)/$(1):
370
-	STATIC=0 GOOS=linux GOARCH=amd64 LDFLAGS=$(3) bin/gobuild.sh $(ISTIO_OUT_LINUX)/$(1) $(2)
371
-endif
372
-
373
-endef
374
-
375
-# Build targets for istioctl
376
-ISTIOCTL_BINS:=istioctl
377
-$(foreach ITEM,$(ISTIOCTL_BINS),$(eval $(call genTargetsForNativeAndDocker,$(ITEM),./istioctl/cmd/$(ITEM),$(RELEASE_LDFLAGS))))
378
-
379
-# Non-static istioctl targets. These are typically a build artifact.
380
-${ISTIO_OUT}/istioctl-linux: depend
381
-	STATIC=0 GOOS=linux LDFLAGS=$(RELEASE_LDFLAGS) bin/gobuild.sh $@ ./istioctl/cmd/istioctl
382
-${ISTIO_OUT}/istioctl-osx: depend
383
-	STATIC=0 GOOS=darwin LDFLAGS=$(RELEASE_LDFLAGS) bin/gobuild.sh $@ ./istioctl/cmd/istioctl
384
-${ISTIO_OUT}/istioctl-win.exe: depend
385
-	STATIC=0 GOOS=windows LDFLAGS=$(RELEASE_LDFLAGS) bin/gobuild.sh $@ ./istioctl/cmd/istioctl
386
-
387
-# generate the istioctl completion files
388
-${ISTIO_OUT}/istioctl.bash: istioctl
389
-	${ISTIO_OUT}/istioctl collateral --bash && \
390
-	mv istioctl.bash ${ISTIO_OUT}/istioctl.bash
391
-
392
-${ISTIO_OUT}/_istioctl: istioctl
393
-	${ISTIO_OUT}/istioctl collateral --zsh && \
394
-	mv _istioctl ${ISTIO_OUT}/_istioctl
395
-
396
-# Build targets for apps under ./pilot/cmd
397
-PILOT_BINS:=pilot-discovery pilot-agent
398
-$(foreach ITEM,$(PILOT_BINS),$(eval $(call genTargetsForNativeAndDocker,$(ITEM),./pilot/cmd/$(ITEM),$(RELEASE_LDFLAGS))))
399
-
400
-# Build targets for apps under ./sidecar-injector/cmd
401
-INJECTOR_BINS:=sidecar-injector
402
-$(foreach ITEM,$(INJECTOR_BINS),$(eval $(call genTargetsForNativeAndDocker,$(ITEM),./sidecar-injector/cmd/$(ITEM),$(RELEASE_LDFLAGS))))
403
-
404
-# Build targets for apps under ./mixer/cmd
405
-MIXER_BINS:=mixs mixc
406
-$(foreach ITEM,$(MIXER_BINS),$(eval $(call genTargetsForNativeAndDocker,$(ITEM),./mixer/cmd/$(ITEM),$(RELEASE_LDFLAGS))))
407
-
408
-# Build targets for apps under ./mixer/tools
409
-MIXER_TOOLS_BINS:=mixgen
410
-$(foreach ITEM,$(MIXER_TOOLS_BINS),$(eval $(call genTargetsForNativeAndDocker,$(ITEM),./mixer/tools/$(ITEM),$(RELEASE_LDFLAGS))))
411
-
412
-# Build targets for apps under ./galley/cmd
413
-GALLEY_BINS:=galley
414
-$(foreach ITEM,$(GALLEY_BINS),$(eval $(call genTargetsForNativeAndDocker,$(ITEM),./galley/cmd/$(ITEM),$(RELEASE_LDFLAGS))))
415
-
416
-# Build targets for apps under ./security/cmd
417
-SECURITY_BINS:=node_agent node_agent_k8s istio_ca
418
-$(foreach ITEM,$(SECURITY_BINS),$(eval $(call genTargetsForNativeAndDocker,$(ITEM),./security/cmd/$(ITEM),$(RELEASE_LDFLAGS))))
419
-
420
-# Build targets for apps under ./security/tools
421
-SECURITY_TOOLS_BINS:=sdsclient
422
-$(foreach ITEM,$(SECURITY_TOOLS_BINS),$(eval $(call genTargetsForNativeAndDocker,$(ITEM),./security/tools/$(ITEM),$(RELEASE_LDFLAGS))))
423
-
424
-# Build targets for apps under ./tools
425
-ISTIO_TOOLS_BINS:=hyperistio istio-iptables
426
-$(foreach ITEM,$(ISTIO_TOOLS_BINS),$(eval $(call genTargetsForNativeAndDocker,$(ITEM),./tools/$(ITEM),$(DEBUG_LDFLAGS))))
427
-
428
-BUILD_BINS:=$(PILOT_BINS) sidecar-injector mixc mixs mixgen node_agent node_agent_k8s istio_ca istioctl galley sdsclient
429
-LINUX_BUILD_BINS:=$(foreach buildBin,$(BUILD_BINS),$(ISTIO_OUT_LINUX)/$(buildBin))
430
-
431
-.PHONY: build
432
-# Build will rebuild the go binaries.
433
-build: depend $(BUILD_BINS)
434
-
435
-.PHONY: build-linux
436
-build-linux: depend $(LINUX_BUILD_BINS)
437
-
438
-.PHONY: binaries-test
439
-binaries-test:
440
-	go test ./tests/binary/... -v --base-dir ${ISTIO_OUT} --binaries="$(BUILD_BINS)"
441
-
442
-# The following are convenience aliases for most of the go targets
443
-# The first block is for aliases that are the same as the actual binary,
444
-# while the ones that follow need slight adjustments to their names.
445
-#
446
-# This is intended for developer use - will rebuild the package.
447
-
448
-.PHONY: citadel
449
-citadel: istio_ca
450
-
451
-.PHONY: pilot
452
-pilot: pilot-discovery
453
-
454
-# istioctl-all makes all of the non-static istioctl executables for each supported OS
455
-.PHONY: istioctl-all
456
-istioctl-all: ${ISTIO_OUT}/istioctl-linux ${ISTIO_OUT}/istioctl-osx ${ISTIO_OUT}/istioctl-win.exe
457
-
458
-.PHONY: istioctl.completion
459
-istioctl.completion: ${ISTIO_OUT}/istioctl.bash ${ISTIO_OUT}/_istioctl
460
-
461
-.PHONY: istio-archive
462
-
463
-istio-archive: ${ISTIO_OUT}/archive
464
-
465
-# TBD: how to capture VERSION, ISTIO_DOCKER_HUB, ISTIO_URL as dependencies
466
-${ISTIO_OUT}/archive: istioctl-all istioctl.completion LICENSE README.md install/updateVersion.sh release/create_release_archives.sh
467
-	rm -rf ${ISTIO_OUT}/archive
468
-	mkdir -p ${ISTIO_OUT}/archive/istioctl
469
-	cp ${ISTIO_OUT}/istioctl-* ${ISTIO_OUT}/archive/istioctl/
470
-	cp LICENSE ${ISTIO_OUT}/archive
471
-	cp README.md ${ISTIO_OUT}/archive
472
-	cp -r tools ${ISTIO_OUT}/archive
473
-	cp ${ISTIO_OUT}/istioctl.bash ${ISTIO_OUT}/archive/tools/
474
-	cp ${ISTIO_OUT}/_istioctl ${ISTIO_OUT}/archive/tools/
475
-	ISTIO_RELEASE=1 install/updateVersion.sh -a "$(ISTIO_DOCKER_HUB),$(VERSION)" \
476
-		-P "$(ISTIO_URL)/deb" \
477
-		-d "${ISTIO_OUT}/archive"
478
-	release/create_release_archives.sh -v "$(VERSION)" -o "${ISTIO_OUT}/archive"
479
-
480
-# istioctl-install builds then installs istioctl into $GOPATH/BIN
481
-# Used for debugging istioctl during dev work
482
-.PHONY: istioctl-install
483
-istioctl-install:
484
-	go install istio.io/istio/istioctl/cmd/istioctl
485
-
486
-#-----------------------------------------------------------------------------
487
-# Target: test
488
-#-----------------------------------------------------------------------------
489
-
490
-.PHONY: test localTestEnv test-bins
491
-
492
-JUNIT_REPORT := $(shell which go-junit-report 2> /dev/null || echo "${ISTIO_BIN}/go-junit-report")
493
-
494
-${ISTIO_BIN}/go-junit-report:
495
-	@echo "go-junit-report not found. Installing it now..."
496
-	unset GOOS && unset GOARCH && CGO_ENABLED=1 go get -u github.com/jstemmer/go-junit-report
497
-
498
-# Run coverage tests
499
-JUNIT_UNIT_TEST_XML ?= $(ARTIFACTS)/junit_unit-tests.xml
500
-ifeq ($(WHAT),)
501
-       TEST_OBJ = common-test pilot-test mixer-test security-test galley-test istioctl-test
502
-else
503
-       TEST_OBJ = selected-pkg-test
504
-endif
505
-test: | $(JUNIT_REPORT)
506
-	mkdir -p $(dir $(JUNIT_UNIT_TEST_XML))
507
-	KUBECONFIG="$${KUBECONFIG:-$${GO_TOP}/src/istio.io/istio/tests/util/kubeconfig}" \
508
-	$(MAKE) --keep-going $(TEST_OBJ) \
509
-	2>&1 | tee >($(JUNIT_REPORT) > $(JUNIT_UNIT_TEST_XML))
510
-
511
-GOTEST_PARALLEL ?= '-test.parallel=1'
512
-
513
-TEST_APP_BINS:=server client
514
-$(foreach ITEM,$(TEST_APP_BINS),$(eval $(call genTargetsForNativeAndDocker,pkg-test-echo-cmd-$(ITEM),./pkg/test/echo/cmd/$(ITEM),$(DEBUG_LDFLAGS))))
515
-
516
-MIXER_TEST_BINS:=policybackend
517
-$(foreach ITEM,$(MIXER_TEST_BINS),$(eval $(call genTargetsForNativeAndDocker,mixer-test-$(ITEM),./mixer/test/$(ITEM),$(DEBUG_LDFLAGS))))
518
-
519
-TEST_BINS:=$(foreach ITEM,$(TEST_APP_BINS),$(ISTIO_OUT)/pkg-test-echo-cmd-$(ITEM)) $(foreach ITEM,$(MIXER_TEST_BINS),$(ISTIO_OUT)/mixer-test-$(ITEM))
520
-LINUX_TEST_BINS:=$(foreach ITEM,$(TEST_APP_BINS),$(ISTIO_OUT_LINUX)/pkg-test-echo-cmd-$(ITEM)) $(foreach ITEM,$(MIXER_TEST_BINS),$(ISTIO_OUT_LINUX)/mixer-test-$(ITEM))
521
-
522
-test-bins: $(TEST_BINS)
523
-
524
-test-bins-linux: $(LINUX_TEST_BINS)
525
-
526
-localTestEnv: test-bins
527
-	bin/testEnvLocalK8S.sh ensure
528
-
529
-localTestEnvCleanup: test-bins
530
-	bin/testEnvLocalK8S.sh stop
531
-
532
-# Temp. disable parallel test - flaky consul test.
533
-# https://github.com/istio/istio/issues/2318
534
-.PHONY: pilot-test
535
-pilot-test: pilot-agent
536
-	go test ${T} ./pilot/...
537
-
538
-.PHONY: istioctl-test
539
-istioctl-test: istioctl
540
-	go test ${T} ./istioctl/...
541
-
542
-.PHONY: mixer-test
543
-MIXER_TEST_T ?= ${T} ${GOTEST_PARALLEL}
544
-mixer-test: mixs
545
-	# Some tests use relative path "testdata", must be run from mixer dir
546
-	(cd mixer; go test ${MIXER_TEST_T} ./...)
547
-
548
-.PHONY: galley-test
549
-galley-test: depend
550
-	go test ${T} ./galley/...
551
-
552
-.PHONY: security-test
553
-security-test:
554
-	go test ${T} ./security/pkg/...
555
-	go test ${T} ./security/cmd/...
556
-
557
-.PHONY: common-test
558
-common-test: istio-iptables
559
-	go test ${T} ./pkg/...
560
-	go test ${T} ./tests/common/...
561
-	# Execute bash shell unit tests scripts
562
-	./tests/scripts/scripts_test.sh
563
-	./tests/scripts/istio-iptables-test.sh
564
-
565
-.PHONY: selected-pkg-test
566
-selected-pkg-test:
567
-	find ${WHAT} -name "*_test.go" | xargs -I {} dirname {} | uniq | xargs -I {} go test ${T} ./{}
568
-
569
-#-----------------------------------------------------------------------------
570
-# Target: coverage
571
-#-----------------------------------------------------------------------------
572
-
573
-.PHONY: coverage
574
-
575
-# Run coverage tests
576
-coverage: pilot-coverage mixer-coverage security-coverage galley-coverage common-coverage istioctl-coverage
577
-
578
-coverage-diff:
579
-	./bin/codecov_diff.sh
580
-
581
-.PHONY: pilot-coverage
582
-pilot-coverage:
583
-	bin/codecov.sh pilot
584
-
585
-.PHONY: istioctl-coverage
586
-istioctl-coverage:
587
-	bin/codecov.sh istioctl
588
-
589
-.PHONY: mixer-coverage
590
-mixer-coverage:
591
-	bin/codecov.sh mixer
592
-
593
-.PHONY: galley-coverage
594
-galley-coverage:
595
-	bin/codecov.sh galley
596
-
597
-.PHONY: security-coverage
598
-security-coverage:
599
-	bin/codecov.sh security/pkg
600
-	bin/codecov.sh security/cmd
601
-
602
-.PHONY: common-coverage
603
-common-coverage:
604
-	bin/codecov.sh pkg
605
-
606
-#-----------------------------------------------------------------------------
607
-# Target: go test -race
608
-#-----------------------------------------------------------------------------
609
-
610
-.PHONY: racetest
611
-
612
-RACE_TESTS ?= pilot-racetest mixer-racetest security-racetest galley-test common-racetest istioctl-racetest
613
-racetest: $(JUNIT_REPORT)
614
-	mkdir -p $(dir $(JUNIT_UNIT_TEST_XML))
615
-	$(MAKE) --keep-going $(RACE_TESTS) \
616
-	2>&1 | tee >($(JUNIT_REPORT) > $(JUNIT_UNIT_TEST_XML))
617
-
618
-.PHONY: pilot-racetest
619
-pilot-racetest: pilot-agent
620
-	RACE_TEST=true go test ${T} -race ./pilot/...
621
-
622
-.PHONY: istioctl-racetest
623
-istioctl-racetest: istioctl
624
-	RACE_TEST=true go test ${T} -race ./istioctl/...
625
-
626
-.PHONY: mixer-racetest
627
-mixer-racetest: mixs
628
-	# Some tests use relative path "testdata", must be run from mixer dir
629
-	(cd mixer; RACE_TEST=true go test ${T} -race ./...)
630
-
631
-.PHONY: galley-racetest
632
-galley-racetest: depend
633
-	RACE_TEST=true go test ${T} -race ./galley/...
634
-
635
-.PHONY: security-racetest
636
-security-racetest:
637
-	RACE_TEST=true go test ${T} -race ./security/pkg/... ./security/cmd/...
638
-
639
-.PHONY: common-racetest
640
-common-racetest:
641
-	RACE_TEST=true go test ${T} -race ./pkg/...
642
-
643
-#-----------------------------------------------------------------------------
644
-# Target: clean
645
-#-----------------------------------------------------------------------------
646
-.PHONY: clean clean.go
647
-
648
-clean: clean.go
649
-	rm -rf $(DIRS_TO_CLEAN)
650
-	rm -f $(FILES_TO_CLEAN)
651
-
652
-clean.go: ; $(info $(H) cleaning...)
653
-	$(eval GO_CLEAN_FLAGS := -i -r)
654
-	$(Q) $(GO) clean $(GO_CLEAN_FLAGS)
655
-
656
-#-----------------------------------------------------------------------------
657
-# Target: docker
658
-#-----------------------------------------------------------------------------
659
-.PHONY: push gcs.push gcs.push.istioctl-all gcs.push.deb artifacts installgen
660
-
661
-# for now docker is limited to Linux compiles - why ?
662
-include tools/istio-docker.mk
663
-
664
-push: docker.push installgen
665
-
666
-gcs.push: push gcs.push.istioctl-all gcs.push.deb
667
-
668
-gcs.push.istioctl-all: istioctl-all
669
-	gsutil -m cp -r "${ISTIO_OUT}"/istioctl-* "gs://${GS_BUCKET}/pilot/${TAG}/artifacts/istioctl"
670
-
671
-gcs.push.deb: deb
672
-	gsutil -m cp -r "${ISTIO_OUT}"/*.deb "gs://${GS_BUCKET}/pilot/${TAG}/artifacts/debs/"
673
-
674
-artifacts: docker
675
-	@echo 'To be added'
676
-
677
-# generate_yaml in tests/istio.mk can build without specifying a hub & tag
678
-installgen:
679
-	install/updateVersion.sh -a ${HUB},${TAG}
680
-	$(MAKE) istio.yaml
681
-
682
-$(HELM): $(ISTIO_OUT)
683
-	bin/init_helm.sh
684
-
685
-$(HOME)/.helm:
686
-	$(HELM) init --client-only
687
-
688
-# create istio-init.yaml
689
-istio-init.yaml: $(HELM) $(HOME)/.helm
690
-	cat install/kubernetes/namespace.yaml > install/kubernetes/$@
691
-	cat install/kubernetes/helm/istio-init/files/crd-* >> install/kubernetes/$@
692
-	$(HELM) template --name=istio --namespace=istio-system \
693
-		--set-string global.tag=${TAG_VARIANT} \
694
-		--set-string global.hub=${HUB} \
695
-		install/kubernetes/helm/istio-init >> install/kubernetes/$@
696
-
697
-
698
-# This is used to @include values-istio-demo-common.yaml file
699
-istio-demo.yaml istio-demo-auth.yaml: export EXTRA_HELM_SETTINGS+=--values install/kubernetes/helm/istio/values-istio-demo-common.yaml
700
-
701
-# creates istio-demo.yaml istio-demo-auth.yaml istio-remote.yaml
702
-# Ensure that values-$filename is present in install/kubernetes/helm/istio
703
-istio-demo.yaml istio-demo-auth.yaml istio-remote.yaml istio-minimal.yaml: $(HELM) $(HOME)/.helm
704
-	cat install/kubernetes/namespace.yaml > install/kubernetes/$@
705
-	cat install/kubernetes/helm/istio-init/files/crd-* >> install/kubernetes/$@
706
-	$(HELM) template \
707
-		--name=istio \
708
-		--namespace=istio-system \
709
-		--set-string global.tag=${TAG_VARIANT} \
710
-		--set-string global.hub=${HUB} \
711
-		--set-string global.imagePullPolicy=$(PULL_POLICY) \
712
-		--set global.proxy.enableCoreDump=${ENABLE_COREDUMP} \
713
-		--set istio_cni.enabled=${ENABLE_ISTIO_CNI} \
714
-		${EXTRA_HELM_SETTINGS} \
715
-		--values install/kubernetes/helm/istio/values-$@ \
716
-		install/kubernetes/helm/istio >> install/kubernetes/$@
717
-
718
-e2e_files = istio-auth-non-mcp.yaml \
719
-			istio-auth-sds.yaml \
720
-			istio-non-mcp.yaml \
721
-			istio.yaml \
722
-			istio-auth.yaml \
723
-			istio-auth-mcp.yaml \
724
-			istio-auth-multicluster.yaml \
725
-			istio-mcp.yaml \
726
-			istio-one-namespace.yaml \
727
-			istio-one-namespace-auth.yaml \
728
-			istio-one-namespace-trust-domain.yaml \
729
-			istio-multicluster.yaml \
730
-			istio-multicluster-split-horizon.yaml \
731
-
732
-.PHONY: generate_e2e_yaml generate_e2e_yaml_coredump
733
-generate_e2e_yaml: $(e2e_files)
734
-
735
-generate_e2e_yaml_coredump: export ENABLE_COREDUMP=true
736
-generate_e2e_yaml_coredump:
737
-	$(MAKE) generate_e2e_yaml
738
-
739
-# Create yaml files for e2e tests. Applies values-e2e.yaml, then values-$filename.yaml
740
-$(e2e_files): $(HELM) $(HOME)/.helm istio-init.yaml
741
-	cat install/kubernetes/namespace.yaml > install/kubernetes/$@
742
-	cat install/kubernetes/helm/istio-init/files/crd-* >> install/kubernetes/$@
743
-	$(HELM) template \
744
-		--name=istio \
745
-		--namespace=istio-system \
746
-		--set-string global.tag=${TAG_VARIANT} \
747
-		--set-string global.hub=${HUB} \
748
-		--set-string global.imagePullPolicy=$(PULL_POLICY) \
749
-		--set global.proxy.enableCoreDump=${ENABLE_COREDUMP} \
750
-		--set istio_cni.enabled=${ENABLE_ISTIO_CNI} \
751
-		${EXTRA_HELM_SETTINGS} \
752
-		--values install/kubernetes/helm/istio/test-values/values-e2e.yaml \
753
-		--values install/kubernetes/helm/istio/test-values/values-$@ \
754
-		install/kubernetes/helm/istio >> install/kubernetes/$@
755
-
756
-# files generated by the default invocation of updateVersion.sh
757
-FILES_TO_CLEAN+=install/consul/istio.yaml \
758
-                install/kubernetes/istio-auth.yaml \
759
-                install/kubernetes/istio-citadel-plugin-certs.yaml \
760
-                install/kubernetes/istio-citadel-with-health-check.yaml \
761
-                install/kubernetes/istio-one-namespace-auth.yaml \
762
-                install/kubernetes/istio-one-namespace-trust-domain.yaml \
763
-                install/kubernetes/istio-one-namespace.yaml \
764
-                install/kubernetes/istio.yaml \
765
-                samples/bookinfo/platform/consul/bookinfo.sidecars.yaml \
766
-
767
-#-----------------------------------------------------------------------------
768
-# Target: environment and tools
769
-#-----------------------------------------------------------------------------
770
-.PHONY: show.env show.goenv
771
-
772
-show.env: ; $(info $(H) environment variables...)
773
-	$(Q) printenv
774
-
775
-show.goenv: ; $(info $(H) go environment...)
776
-	$(Q) $(GO) version
777
-	$(Q) $(GO) env
778
-
779
-# tickle
780
-# show makefile variables. Usage: make show.<variable-name>
781
-show.%: ; $(info $* $(H) $($*))
782
-	$(Q) true
783
-
784
-#-----------------------------------------------------------------------------
785
-# Target: artifacts and distribution
786
-#-----------------------------------------------------------------------------
787
-# deb, rpm, etc packages
788
-include tools/packaging/packaging.mk
789
-
790
-#-----------------------------------------------------------------------------
791
-# Target: e2e tests
792
-#-----------------------------------------------------------------------------
793
-include tests/istio.mk
794
-
795
-#-----------------------------------------------------------------------------
796
-# Target: integration tests
797
-#-----------------------------------------------------------------------------
798
-include tests/integration/tests.mk
799
-
800
-include Makefile.common.mk

+ 800
- 0
Makefile.core.mk View File

@@ -0,0 +1,800 @@
1
+## Copyright 2017 Istio Authors
2
+##
3
+## Licensed under the Apache License, Version 2.0 (the "License");
4
+## you may not use this file except in compliance with the License.
5
+## You may obtain a copy of the License at
6
+##
7
+##     http://www.apache.org/licenses/LICENSE-2.0
8
+##
9
+## Unless required by applicable law or agreed to in writing, software
10
+## distributed under the License is distributed on an "AS IS" BASIS,
11
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+## See the License for the specific language governing permissions and
13
+## limitations under the License.
14
+
15
+#-----------------------------------------------------------------------------
16
+# Global Variables
17
+#-----------------------------------------------------------------------------
18
+ISTIO_GO := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
19
+export ISTIO_GO
20
+SHELL := /bin/bash -o pipefail
21
+
22
+VERSION ?= 1.4-dev
23
+
24
+# Base version of Istio image to use
25
+BASE_VERSION ?= 1.4
26
+
27
+export GO111MODULE ?= on
28
+export GOPROXY ?= https://proxy.golang.org
29
+export GOSUMDB ?= sum.golang.org
30
+
31
+# locations where artifacts are stored
32
+ISTIO_DOCKER_HUB ?= docker.io/istio
33
+export ISTIO_DOCKER_HUB
34
+ISTIO_GCS ?= istio-release/releases/$(VERSION)
35
+ISTIO_URL ?= https://storage.googleapis.com/$(ISTIO_GCS)
36
+ISTIO_CNI_HUB ?= gcr.io/istio-release
37
+export ISTIO_CNI_HUB
38
+ISTIO_CNI_TAG ?= master-latest-daily
39
+export ISTIO_CNI_TAG
40
+
41
+# cumulatively track the directories/files to delete after a clean
42
+DIRS_TO_CLEAN:=
43
+FILES_TO_CLEAN:=
44
+
45
+# If GOPATH is not set by the env, set it to a sane value
46
+GOPATH ?= $(shell cd ${ISTIO_GO}/../../..; pwd)
47
+export GOPATH
48
+
49
+# If GOPATH is made up of several paths, use the first one for our targets in this Makefile
50
+GO_TOP := $(shell echo ${GOPATH} | cut -d ':' -f1)
51
+export GO_TOP
52
+
53
+# Note that disabling cgo here adversely affects go get.  Instead we'll rely on this
54
+# to be handled in bin/gobuild.sh
55
+# export CGO_ENABLED=0
56
+
57
+# It's more concise to use GO?=$(shell which go)
58
+# but the following approach uses a more efficient "simply expanded" :=
59
+# variable instead of a "recursively expanded" =
60
+ifeq ($(origin GO), undefined)
61
+  GO:=$(shell which go)
62
+endif
63
+ifeq ($(GO),)
64
+  $(error Could not find 'go' in path.  Please install go, or if already installed either add it to your path or set GO to point to its directory)
65
+endif
66
+
67
+LOCAL_ARCH := $(shell uname -m)
68
+ifeq ($(LOCAL_ARCH),x86_64)
69
+GOARCH_LOCAL := amd64
70
+else ifeq ($(shell echo $(LOCAL_ARCH) | head -c 5),armv8)
71
+GOARCH_LOCAL := arm64
72
+else ifeq ($(shell echo $(LOCAL_ARCH) | head -c 4),armv)
73
+GOARCH_LOCAL := arm
74
+else
75
+GOARCH_LOCAL := $(LOCAL_ARCH)
76
+endif
77
+export GOARCH ?= $(GOARCH_LOCAL)
78
+
79
+LOCAL_OS := $(shell uname)
80
+ifeq ($(LOCAL_OS),Linux)
81
+   export GOOS_LOCAL = linux
82
+else ifeq ($(LOCAL_OS),Darwin)
83
+   export GOOS_LOCAL = darwin
84
+else
85
+   $(error "This system's OS $(LOCAL_OS) isn't recognized/supported")
86
+   # export GOOS_LOCAL ?= windows
87
+endif
88
+
89
+export GOOS ?= $(GOOS_LOCAL)
90
+
91
+export ENABLE_COREDUMP ?= false
92
+
93
+# Enable Istio CNI in helm template commands
94
+export ENABLE_ISTIO_CNI ?= false
95
+
96
+# NOTE: env var EXTRA_HELM_SETTINGS can contain helm chart override settings, example:
97
+# EXTRA_HELM_SETTINGS="--set istio-cni.excludeNamespaces={} --set-string istio-cni.tag=v0.1-dev-foo"
98
+
99
+#-----------------------------------------------------------------------------
100
+# Output control
101
+#-----------------------------------------------------------------------------
102
+# Invoke make VERBOSE=1 to enable echoing of the command being executed
103
+export VERBOSE ?= 0
104
+# Place the variable Q in front of a command to control echoing of the command being executed.
105
+Q = $(if $(filter 1,$VERBOSE),,@)
106
+# Use the variable H to add a header (equivalent to =>) to informational output
107
+H = $(shell printf "\033[34;1m=>\033[0m")
108
+
109
+# To build Pilot, Mixer and CA with debugger information, use DEBUG=1 when invoking make
110
+goVerStr := $(shell $(GO) version | awk '{split($$0,a," ")}; {print a[3]}')
111
+goVerNum := $(shell echo $(goVerStr) | awk '{split($$0,a,"go")}; {print a[2]}')
112
+goVerMajor := $(shell echo $(goVerNum) | awk '{split($$0, a, ".")}; {print a[1]}')
113
+goVerMinor := $(shell echo $(goVerNum) | awk '{split($$0, a, ".")}; {print a[2]}' | sed -e 's/\([0-9]\+\).*/\1/')
114
+gcflagsPattern := $(shell ( [ $(goVerMajor) -ge 1 ] && [ ${goVerMinor} -ge 10 ] ) && echo 'all=' || echo '')
115
+
116
+ifeq ($(origin DEBUG), undefined)
117
+  BUILDTYPE_DIR:=release
118
+else ifeq ($(DEBUG),0)
119
+  BUILDTYPE_DIR:=release
120
+else
121
+  BUILDTYPE_DIR:=debug
122
+  export GCFLAGS:=$(gcflagsPattern)-N -l
123
+  $(info $(H) Build with debugger information)
124
+endif
125
+
126
+# Optional file including user-specific settings (HUB, TAG, etc)
127
+-include .istiorc.mk
128
+
129
+# @todo allow user to run for a single $PKG only?
130
+PACKAGES_CMD := GOPATH=$(GOPATH) $(GO) list ./...
131
+GO_EXCLUDE := /vendor/|.pb.go|.gen.go
132
+GO_FILES_CMD := find . -name '*.go' | grep -v -E '$(GO_EXCLUDE)'
133
+
134
+# Environment for tests, the directory containing istio and deps binaries.
135
+# Typically same as GOPATH/bin, so tests work seemlessly with IDEs.
136
+
137
+export ISTIO_BIN=$(GO_TOP)/bin
138
+# Using same package structure as pkg/
139
+export OUT_DIR=$(GO_TOP)/out
140
+export ISTIO_OUT:=$(OUT_DIR)/$(GOOS)_$(GOARCH)/$(BUILDTYPE_DIR)
141
+export ISTIO_OUT_LINUX:=$(OUT_DIR)/linux_amd64/$(BUILDTYPE_DIR)
142
+export HELM=$(ISTIO_OUT)/helm
143
+export ARTIFACTS ?= $(ISTIO_OUT)
144
+
145
+# scratch dir: this shouldn't be simply 'docker' since that's used for docker.save to store tar.gz files
146
+ISTIO_DOCKER:=${ISTIO_OUT_LINUX}/docker_temp
147
+# Config file used for building istio:proxy container.
148
+DOCKER_PROXY_CFG?=Dockerfile.proxy
149
+
150
+# scratch dir for building isolated images. Please don't remove it again - using
151
+# ISTIO_DOCKER results in slowdown, all files (including multiple copies of envoy) will be
152
+# copied to the docker temp container - even if you add only a tiny file, >1G of data will
153
+# be copied, for each docker image.
154
+DOCKER_BUILD_TOP:=${ISTIO_OUT_LINUX}/docker_build
155
+
156
+# dir where tar.gz files from docker.save are stored
157
+ISTIO_DOCKER_TAR:=${ISTIO_OUT_LINUX}/docker
158
+
159
+# Populate the git version for istio/proxy (i.e. Envoy)
160
+ifeq ($(PROXY_REPO_SHA),)
161
+  export PROXY_REPO_SHA:=$(shell grep PROXY_REPO_SHA istio.deps  -A 4 | grep lastStableSHA | cut -f 4 -d '"')
162
+endif
163
+
164
+# Envoy binary variables Keep the default URLs up-to-date with the latest push from istio/proxy.
165
+
166
+# OS-neutral vars. These currently only work for linux.
167
+export ISTIO_ENVOY_VERSION ?= ${PROXY_REPO_SHA}
168
+export ISTIO_ENVOY_DEBUG_URL ?= https://storage.googleapis.com/istio-build/proxy/envoy-debug-$(ISTIO_ENVOY_VERSION).tar.gz
169
+export ISTIO_ENVOY_RELEASE_URL ?= https://storage.googleapis.com/istio-build/proxy/envoy-alpha-$(ISTIO_ENVOY_VERSION).tar.gz
170
+
171
+# Envoy Linux vars.
172
+export ISTIO_ENVOY_LINUX_VERSION ?= ${ISTIO_ENVOY_VERSION}
173
+export ISTIO_ENVOY_LINUX_DEBUG_URL ?= ${ISTIO_ENVOY_DEBUG_URL}
174
+export ISTIO_ENVOY_LINUX_RELEASE_URL ?= ${ISTIO_ENVOY_RELEASE_URL}
175
+# Variables for the extracted debug/release Envoy artifacts.
176
+export ISTIO_ENVOY_LINUX_DEBUG_DIR ?= ${OUT_DIR}/linux_amd64/debug
177
+export ISTIO_ENVOY_LINUX_DEBUG_NAME ?= envoy-debug-${ISTIO_ENVOY_LINUX_VERSION}
178
+export ISTIO_ENVOY_LINUX_DEBUG_PATH ?= ${ISTIO_ENVOY_LINUX_DEBUG_DIR}/${ISTIO_ENVOY_LINUX_DEBUG_NAME}
179
+export ISTIO_ENVOY_LINUX_RELEASE_DIR ?= ${OUT_DIR}/linux_amd64/release
180
+export ISTIO_ENVOY_LINUX_RELEASE_NAME ?= envoy-${ISTIO_ENVOY_VERSION}
181
+export ISTIO_ENVOY_LINUX_RELEASE_PATH ?= ${ISTIO_ENVOY_LINUX_RELEASE_DIR}/${ISTIO_ENVOY_LINUX_RELEASE_NAME}
182
+
183
+# Envoy macOS vars.
184
+# TODO Change url when official envoy release for macOS is available
185
+export ISTIO_ENVOY_MACOS_VERSION ?= 1.0.2
186
+export ISTIO_ENVOY_MACOS_RELEASE_URL ?= https://github.com/istio/proxy/releases/download/${ISTIO_ENVOY_MACOS_VERSION}/istio-proxy-${ISTIO_ENVOY_MACOS_VERSION}-macos.tar.gz
187
+# Variables for the extracted debug/release Envoy artifacts.
188
+export ISTIO_ENVOY_MACOS_RELEASE_DIR ?= ${OUT_DIR}/darwin_amd64/release
189
+export ISTIO_ENVOY_MACOS_RELEASE_NAME ?= envoy-${ISTIO_ENVOY_MACOS_VERSION}
190
+export ISTIO_ENVOY_MACOS_RELEASE_PATH ?= ${ISTIO_ENVOY_MACOS_RELEASE_DIR}/${ISTIO_ENVOY_MACOS_RELEASE_NAME}
191
+
192
+# Allow user-override for a local Envoy build.
193
+export USE_LOCAL_PROXY ?= 0
194
+ifeq ($(USE_LOCAL_PROXY),1)
195
+  export ISTIO_ENVOY_LOCAL ?= $(realpath ${ISTIO_GO}/../proxy/bazel-bin/src/envoy/envoy)
196
+  # Point the native paths to the local envoy build.
197
+  ifeq ($(GOOS_LOCAL), Darwin)
198
+    export ISTIO_ENVOY_MACOS_RELEASE_DIR = $(dir ${ISTIO_ENVOY_LOCAL})
199
+    export ISTIO_ENVOY_MACOS_RELEASE_PATH = ${ISTIO_ENVOY_LOCAL}
200
+  else
201
+    export ISTIO_ENVOY_LINUX_DEBUG_DIR = $(dir ${ISTIO_ENVOY_LOCAL})
202
+    export ISTIO_ENVOY_LINUX_RELEASE_DIR = $(dir ${ISTIO_ENVOY_LOCAL})
203
+    export ISTIO_ENVOY_LINUX_DEBUG_PATH = ${ISTIO_ENVOY_LOCAL}
204
+    export ISTIO_ENVOY_LINUX_RELEASE_PATH = ${ISTIO_ENVOY_LOCAL}
205
+  endif
206
+endif
207
+
208
+GO_VERSION_REQUIRED:=1.10
209
+
210
+HUB?=istio
211
+ifeq ($(HUB),)
212
+  $(error "HUB cannot be empty")
213
+endif
214
+
215
+# If tag not explicitly set in users' .istiorc.mk or command line, default to the git sha.
216
+TAG ?= $(shell git rev-parse --verify HEAD)
217
+ifeq ($(TAG),)
218
+  $(error "TAG cannot be empty")
219
+endif
220
+
221
+VARIANT :=
222
+ifeq ($(VARIANT),)
223
+  TAG_VARIANT:=${TAG}
224
+else
225
+  TAG_VARIANT:=${TAG}-${VARIANT}
226
+endif
227
+
228
+PULL_POLICY ?= IfNotPresent
229
+ifeq ($(TAG),latest)
230
+  PULL_POLICY = Always
231
+endif
232
+ifeq ($(PULL_POLICY),)
233
+  $(error "PULL_POLICY cannot be empty")
234
+endif
235
+
236
+GEN_CERT := ${ISTIO_BIN}/generate_cert
237
+
238
+# Set Google Storage bucket if not set
239
+GS_BUCKET ?= istio-artifacts
240
+
241
+.PHONY: default
242
+default: depend build test
243
+
244
+# The point of these is to allow scripts to query where artifacts
245
+# are stored so that tests and other consumers of the build don't
246
+# need to be updated to follow the changes in the Makefiles.
247
+# Note that the query needs to pass the same types of parameters
248
+# (e.g., DEBUG=0, GOOS=linux) as the actual build for the query
249
+# to provide an accurate result.
250
+.PHONY: where-is-out where-is-docker-temp where-is-docker-tar
251
+where-is-out:
252
+	@echo ${ISTIO_OUT}
253
+where-is-docker-temp:
254
+	@echo ${ISTIO_DOCKER}
255
+where-is-docker-tar:
256
+	@echo ${ISTIO_DOCKER_TAR}
257
+
258
+#-----------------------------------------------------------------------------
259
+# Target: depend
260
+#-----------------------------------------------------------------------------
261
+.PHONY: depend init
262
+
263
+# Parse out the x.y or x.y.z version and output a single value x*10000+y*100+z (e.g., 1.9 is 10900)
264
+# that allows the three components to be checked in a single comparison.
265
+VER_TO_INT:=awk '{split(substr($$0, match ($$0, /[0-9\.]+/)), a, "."); print a[1]*10000+a[2]*100+a[3]}'
266
+
267
+# using a sentinel file so this check is only performed once per version.  Performance is
268
+# being favored over the unlikely situation that go gets downgraded to an older version
269
+check-go-version: | $(ISTIO_BIN) ${ISTIO_BIN}/have_go_$(GO_VERSION_REQUIRED)
270
+${ISTIO_BIN}/have_go_$(GO_VERSION_REQUIRED):
271
+	@if test $(shell $(GO) version | $(VER_TO_INT) ) -lt \
272
+                 $(shell echo "$(GO_VERSION_REQUIRED)" | $(VER_TO_INT) ); \
273
+                 then printf "go version $(GO_VERSION_REQUIRED)+ required, found: "; $(GO) version; exit 1; fi
274
+	@touch ${ISTIO_BIN}/have_go_$(GO_VERSION_REQUIRED)
275
+
276
+
277
+# Downloads envoy, based on the SHA defined in the base pilot Dockerfile
278
+init: check-go-version $(ISTIO_OUT)/istio_is_init
279
+	mkdir -p ${OUT_DIR}/logs
280
+
281
+# Sync is the same as init in release branch. In master this pulls from master.
282
+sync: init
283
+
284
+# I tried to make this dependent on what I thought was the appropriate
285
+# lock file, but it caused the rule for that file to get run (which
286
+# seems to be about obtaining a new version of the 3rd party libraries).
287
+$(ISTIO_OUT)/istio_is_init: bin/init.sh istio.deps | $(ISTIO_OUT)
288
+	ISTIO_OUT=$(ISTIO_OUT) bin/init.sh
289
+	touch $(ISTIO_OUT)/istio_is_init
290
+
291
+# init.sh downloads envoy
292
+${ISTIO_OUT}/envoy: init
293
+${ISTIO_ENVOY_LINUX_DEBUG_PATH}: init
294
+${ISTIO_ENVOY_LINUX_RELEASE_PATH}: init
295
+${ISTIO_ENVOY_MACOS_RELEASE_PATH}: init
296
+
297
+# Pull dependencies, based on the checked in Gopkg.lock file.
298
+# Developers must manually run `dep ensure` if adding new deps
299
+depend: init | $(ISTIO_OUT)
300
+
301
+OUTPUT_DIRS = $(ISTIO_OUT) $(ISTIO_BIN)
302
+DIRS_TO_CLEAN+=${ISTIO_OUT}
303
+ifneq ($(ISTIO_OUT),$(ISTIO_OUT_LINUX))
304
+  OUTPUT_DIRS += $(ISTIO_OUT_LINUX)
305
+  DIRS_TO_CLEAN += $(ISTIO_OUT_LINUX)
306
+endif
307
+
308
+$(OUTPUT_DIRS):
309
+	@mkdir -p $@
310
+
311
+.PHONY: ${GEN_CERT}
312
+${GEN_CERT}:
313
+	GOOS=$(GOOS_LOCAL) && GOARCH=$(GOARCH_LOCAL) && CGO_ENABLED=1 bin/gobuild.sh $@ ./security/tools/generate_cert
314
+
315
+#-----------------------------------------------------------------------------
316
+# Target: precommit
317
+#-----------------------------------------------------------------------------
318
+.PHONY: precommit format format.gofmt format.goimports lint buildcache
319
+
320
+# Target run by the pre-commit script, to automate formatting and lint
321
+# If pre-commit script is not used, please run this manually.
322
+precommit: format lint
323
+
324
+format:
325
+	scripts/run_gofmt.sh
326
+	go mod tidy
327
+
328
+fmt:
329
+	scripts/run_gofmt.sh
330
+	go mod tidy
331
+
332
+# Build with -i to store the build caches into $GOPATH/pkg
333
+buildcache:
334
+	GOBUILDFLAGS=-i $(MAKE) build
335
+
336
+# Existence of build cache .a files actually affects the results of
337
+# some linters; they need to exist.
338
+lint: buildcache
339
+	SKIP_INIT=1 bin/linters.sh
340
+
341
+shellcheck:
342
+	bin/check_shell_scripts.sh
343
+
344
+#-----------------------------------------------------------------------------
345
+# Target: go build
346
+#-----------------------------------------------------------------------------
347
+
348
+# gobuild script uses custom linker flag to set the variables.
349
+# Params: OUT VERSION_PKG SRC
350
+
351
+RELEASE_LDFLAGS='-extldflags -static -s -w'
352
+DEBUG_LDFLAGS='-extldflags "-static"'
353
+
354
+# Generates build both native and linux (needed by Docker) targets for an application
355
+# Params:
356
+# $(1): The base name for the generated target. If the name specified is "app", then targets will be generated for:
357
+#   app, $(ISTIO_OUT)/app and additionally $(ISTIO_OUT_LINUX)/app if GOOS != linux.
358
+# $(2): The path to the source directory for the application
359
+# $(3): The value for LDFLAGS
360
+define genTargetsForNativeAndDocker
361
+$(ISTIO_OUT)/$(1):
362
+	STATIC=0 GOOS=$(GOOS) GOARCH=$(GOARCH) LDFLAGS=$(3) bin/gobuild.sh $(ISTIO_OUT)/$(1) $(2)
363
+
364
+.PHONY: $(1)
365
+$(1):
366
+	STATIC=0 GOOS=$(GOOS) GOARCH=$(GOARCH) LDFLAGS=$(3) bin/gobuild.sh $(ISTIO_OUT)/$(1) $(2)
367
+
368
+ifneq ($(ISTIO_OUT),$(ISTIO_OUT_LINUX))
369
+$(ISTIO_OUT_LINUX)/$(1):
370
+	STATIC=0 GOOS=linux GOARCH=amd64 LDFLAGS=$(3) bin/gobuild.sh $(ISTIO_OUT_LINUX)/$(1) $(2)
371
+endif
372
+
373
+endef
374
+
375
+# Build targets for istioctl
376
+ISTIOCTL_BINS:=istioctl
377
+$(foreach ITEM,$(ISTIOCTL_BINS),$(eval $(call genTargetsForNativeAndDocker,$(ITEM),./istioctl/cmd/$(ITEM),$(RELEASE_LDFLAGS))))
378
+
379
+# Non-static istioctl targets. These are typically a build artifact.
380
+${ISTIO_OUT}/istioctl-linux: depend
381
+	STATIC=0 GOOS=linux LDFLAGS=$(RELEASE_LDFLAGS) bin/gobuild.sh $@ ./istioctl/cmd/istioctl
382
+${ISTIO_OUT}/istioctl-osx: depend
383
+	STATIC=0 GOOS=darwin LDFLAGS=$(RELEASE_LDFLAGS) bin/gobuild.sh $@ ./istioctl/cmd/istioctl
384
+${ISTIO_OUT}/istioctl-win.exe: depend
385
+	STATIC=0 GOOS=windows LDFLAGS=$(RELEASE_LDFLAGS) bin/gobuild.sh $@ ./istioctl/cmd/istioctl
386
+
387
+# generate the istioctl completion files
388
+${ISTIO_OUT}/istioctl.bash: istioctl
389
+	${ISTIO_OUT}/istioctl collateral --bash && \
390
+	mv istioctl.bash ${ISTIO_OUT}/istioctl.bash
391
+
392
+${ISTIO_OUT}/_istioctl: istioctl
393
+	${ISTIO_OUT}/istioctl collateral --zsh && \
394
+	mv _istioctl ${ISTIO_OUT}/_istioctl
395
+
396
+# Build targets for apps under ./pilot/cmd
397
+PILOT_BINS:=pilot-discovery pilot-agent
398
+$(foreach ITEM,$(PILOT_BINS),$(eval $(call genTargetsForNativeAndDocker,$(ITEM),./pilot/cmd/$(ITEM),$(RELEASE_LDFLAGS))))
399
+
400
+# Build targets for apps under ./sidecar-injector/cmd
401
+INJECTOR_BINS:=sidecar-injector
402
+$(foreach ITEM,$(INJECTOR_BINS),$(eval $(call genTargetsForNativeAndDocker,$(ITEM),./sidecar-injector/cmd/$(ITEM),$(RELEASE_LDFLAGS))))
403
+
404
+# Build targets for apps under ./mixer/cmd
405
+MIXER_BINS:=mixs mixc
406
+$(foreach ITEM,$(MIXER_BINS),$(eval $(call genTargetsForNativeAndDocker,$(ITEM),./mixer/cmd/$(ITEM),$(RELEASE_LDFLAGS))))
407
+
408
+# Build targets for apps under ./mixer/tools
409
+MIXER_TOOLS_BINS:=mixgen
410
+$(foreach ITEM,$(MIXER_TOOLS_BINS),$(eval $(call genTargetsForNativeAndDocker,$(ITEM),./mixer/tools/$(ITEM),$(RELEASE_LDFLAGS))))
411
+
412
+# Build targets for apps under ./galley/cmd
413
+GALLEY_BINS:=galley
414
+$(foreach ITEM,$(GALLEY_BINS),$(eval $(call genTargetsForNativeAndDocker,$(ITEM),./galley/cmd/$(ITEM),$(RELEASE_LDFLAGS))))
415
+
416
+# Build targets for apps under ./security/cmd
417
+SECURITY_BINS:=node_agent node_agent_k8s istio_ca
418
+$(foreach ITEM,$(SECURITY_BINS),$(eval $(call genTargetsForNativeAndDocker,$(ITEM),./security/cmd/$(ITEM),$(RELEASE_LDFLAGS))))
419
+
420
+# Build targets for apps under ./security/tools
421
+SECURITY_TOOLS_BINS:=sdsclient
422
+$(foreach ITEM,$(SECURITY_TOOLS_BINS),$(eval $(call genTargetsForNativeAndDocker,$(ITEM),./security/tools/$(ITEM),$(RELEASE_LDFLAGS))))
423
+
424
+# Build targets for apps under ./tools
425
+ISTIO_TOOLS_BINS:=hyperistio istio-iptables
426
+$(foreach ITEM,$(ISTIO_TOOLS_BINS),$(eval $(call genTargetsForNativeAndDocker,$(ITEM),./tools/$(ITEM),$(DEBUG_LDFLAGS))))
427
+
428
+BUILD_BINS:=$(PILOT_BINS) sidecar-injector mixc mixs mixgen node_agent node_agent_k8s istio_ca istioctl galley sdsclient
429
+LINUX_BUILD_BINS:=$(foreach buildBin,$(BUILD_BINS),$(ISTIO_OUT_LINUX)/$(buildBin))
430
+
431
+.PHONY: build
432
+# Build will rebuild the go binaries.
433
+build: depend $(BUILD_BINS)
434
+
435
+.PHONY: build-linux
436
+build-linux: depend $(LINUX_BUILD_BINS)
437
+
438
+.PHONY: binaries-test
439
+binaries-test:
440
+	go test ./tests/binary/... -v --base-dir ${ISTIO_OUT} --binaries="$(BUILD_BINS)"
441
+
442
+# The following are convenience aliases for most of the go targets
443
+# The first block is for aliases that are the same as the actual binary,
444
+# while the ones that follow need slight adjustments to their names.
445
+#
446
+# This is intended for developer use - will rebuild the package.
447
+
448
+.PHONY: citadel
449
+citadel: istio_ca
450
+
451
+.PHONY: pilot
452
+pilot: pilot-discovery
453
+
454
+# istioctl-all makes all of the non-static istioctl executables for each supported OS
455
+.PHONY: istioctl-all
456
+istioctl-all: ${ISTIO_OUT}/istioctl-linux ${ISTIO_OUT}/istioctl-osx ${ISTIO_OUT}/istioctl-win.exe
457
+
458
+.PHONY: istioctl.completion
459
+istioctl.completion: ${ISTIO_OUT}/istioctl.bash ${ISTIO_OUT}/_istioctl
460
+
461
+.PHONY: istio-archive
462
+
463
+istio-archive: ${ISTIO_OUT}/archive
464
+
465
+# TBD: how to capture VERSION, ISTIO_DOCKER_HUB, ISTIO_URL as dependencies
466
+${ISTIO_OUT}/archive: istioctl-all istioctl.completion LICENSE README.md install/updateVersion.sh release/create_release_archives.sh
467
+	rm -rf ${ISTIO_OUT}/archive
468
+	mkdir -p ${ISTIO_OUT}/archive/istioctl
469
+	cp ${ISTIO_OUT}/istioctl-* ${ISTIO_OUT}/archive/istioctl/
470
+	cp LICENSE ${ISTIO_OUT}/archive
471
+	cp README.md ${ISTIO_OUT}/archive
472
+	cp -r tools ${ISTIO_OUT}/archive
473
+	cp ${ISTIO_OUT}/istioctl.bash ${ISTIO_OUT}/archive/tools/
474
+	cp ${ISTIO_OUT}/_istioctl ${ISTIO_OUT}/archive/tools/
475
+	ISTIO_RELEASE=1 install/updateVersion.sh -a "$(ISTIO_DOCKER_HUB),$(VERSION)" \
476
+		-P "$(ISTIO_URL)/deb" \
477
+		-d "${ISTIO_OUT}/archive"
478
+	release/create_release_archives.sh -v "$(VERSION)" -o "${ISTIO_OUT}/archive"
479
+
480
+# istioctl-install builds then installs istioctl into $GOPATH/BIN
481
+# Used for debugging istioctl during dev work
482
+.PHONY: istioctl-install
483
+istioctl-install:
484
+	go install istio.io/istio/istioctl/cmd/istioctl
485
+
486
+#-----------------------------------------------------------------------------
487
+# Target: test
488
+#-----------------------------------------------------------------------------
489
+
490
+.PHONY: test localTestEnv test-bins
491
+
492
+JUNIT_REPORT := $(shell which go-junit-report 2> /dev/null || echo "${ISTIO_BIN}/go-junit-report")
493
+
494
+${ISTIO_BIN}/go-junit-report:
495
+	@echo "go-junit-report not found. Installing it now..."
496
+	unset GOOS && unset GOARCH && CGO_ENABLED=1 go get -u github.com/jstemmer/go-junit-report
497
+
498
+# Run coverage tests
499
+JUNIT_UNIT_TEST_XML ?= $(ARTIFACTS)/junit_unit-tests.xml
500
+ifeq ($(WHAT),)
501
+       TEST_OBJ = common-test pilot-test mixer-test security-test galley-test istioctl-test
502
+else
503
+       TEST_OBJ = selected-pkg-test
504
+endif
505
+test: | $(JUNIT_REPORT)
506
+	mkdir -p $(dir $(JUNIT_UNIT_TEST_XML))
507
+	KUBECONFIG="$${KUBECONFIG:-$${GO_TOP}/src/istio.io/istio/tests/util/kubeconfig}" \
508
+	$(MAKE) --keep-going $(TEST_OBJ) \
509
+	2>&1 | tee >($(JUNIT_REPORT) > $(JUNIT_UNIT_TEST_XML))
510
+
511
+GOTEST_PARALLEL ?= '-test.parallel=1'
512
+
513
+TEST_APP_BINS:=server client
514
+$(foreach ITEM,$(TEST_APP_BINS),$(eval $(call genTargetsForNativeAndDocker,pkg-test-echo-cmd-$(ITEM),./pkg/test/echo/cmd/$(ITEM),$(DEBUG_LDFLAGS))))
515
+
516
+MIXER_TEST_BINS:=policybackend
517
+$(foreach ITEM,$(MIXER_TEST_BINS),$(eval $(call genTargetsForNativeAndDocker,mixer-test-$(ITEM),./mixer/test/$(ITEM),$(DEBUG_LDFLAGS))))
518
+
519
+TEST_BINS:=$(foreach ITEM,$(TEST_APP_BINS),$(ISTIO_OUT)/pkg-test-echo-cmd-$(ITEM)) $(foreach ITEM,$(MIXER_TEST_BINS),$(ISTIO_OUT)/mixer-test-$(ITEM))
520
+LINUX_TEST_BINS:=$(foreach ITEM,$(TEST_APP_BINS),$(ISTIO_OUT_LINUX)/pkg-test-echo-cmd-$(ITEM)) $(foreach ITEM,$(MIXER_TEST_BINS),$(ISTIO_OUT_LINUX)/mixer-test-$(ITEM))
521
+
522
+test-bins: $(TEST_BINS)
523
+
524
+test-bins-linux: $(LINUX_TEST_BINS)
525
+
526
+localTestEnv: test-bins
527
+	bin/testEnvLocalK8S.sh ensure
528
+
529
+localTestEnvCleanup: test-bins
530
+	bin/testEnvLocalK8S.sh stop
531
+
532
+# Temp. disable parallel test - flaky consul test.
533
+# https://github.com/istio/istio/issues/2318
534
+.PHONY: pilot-test
535
+pilot-test: pilot-agent
536
+	go test ${T} ./pilot/...
537
+
538
+.PHONY: istioctl-test
539
+istioctl-test: istioctl
540
+	go test ${T} ./istioctl/...
541
+
542
+.PHONY: mixer-test
543
+MIXER_TEST_T ?= ${T} ${GOTEST_PARALLEL}
544
+mixer-test: mixs
545
+	# Some tests use relative path "testdata", must be run from mixer dir
546
+	(cd mixer; go test ${MIXER_TEST_T} ./...)
547
+
548
+.PHONY: galley-test
549
+galley-test: depend
550
+	go test ${T} ./galley/...
551
+
552
+.PHONY: security-test
553
+security-test:
554
+	go test ${T} ./security/pkg/...
555
+	go test ${T} ./security/cmd/...
556
+
557
+.PHONY: common-test
558
+common-test: istio-iptables
559
+	go test ${T} ./pkg/...
560
+	go test ${T} ./tests/common/...
561
+	# Execute bash shell unit tests scripts
562
+	./tests/scripts/scripts_test.sh
563
+	./tests/scripts/istio-iptables-test.sh
564
+
565
+.PHONY: selected-pkg-test
566
+selected-pkg-test:
567
+	find ${WHAT} -name "*_test.go" | xargs -I {} dirname {} | uniq | xargs -I {} go test ${T} ./{}
568
+
569
+#-----------------------------------------------------------------------------
570
+# Target: coverage
571
+#-----------------------------------------------------------------------------
572
+
573
+.PHONY: coverage
574
+
575
+# Run coverage tests
576
+coverage: pilot-coverage mixer-coverage security-coverage galley-coverage common-coverage istioctl-coverage
577
+
578
+coverage-diff:
579
+	./bin/codecov_diff.sh
580
+
581
+.PHONY: pilot-coverage
582
+pilot-coverage:
583
+	bin/codecov.sh pilot
584
+
585
+.PHONY: istioctl-coverage
586
+istioctl-coverage:
587
+	bin/codecov.sh istioctl
588
+
589
+.PHONY: mixer-coverage
590
+mixer-coverage:
591
+	bin/codecov.sh mixer
592
+
593
+.PHONY: galley-coverage
594
+galley-coverage:
595
+	bin/codecov.sh galley
596
+
597
+.PHONY: security-coverage
598
+security-coverage:
599
+	bin/codecov.sh security/pkg
600
+	bin/codecov.sh security/cmd
601
+
602
+.PHONY: common-coverage
603
+common-coverage:
604
+	bin/codecov.sh pkg
605
+
606
+#-----------------------------------------------------------------------------
607
+# Target: go test -race
608
+#-----------------------------------------------------------------------------
609
+
610
+.PHONY: racetest
611
+
612
+RACE_TESTS ?= pilot-racetest mixer-racetest security-racetest galley-test common-racetest istioctl-racetest
613
+racetest: $(JUNIT_REPORT)
614
+	mkdir -p $(dir $(JUNIT_UNIT_TEST_XML))
615
+	$(MAKE) --keep-going $(RACE_TESTS) \
616
+	2>&1 | tee >($(JUNIT_REPORT) > $(JUNIT_UNIT_TEST_XML))
617
+
618
+.PHONY: pilot-racetest
619
+pilot-racetest: pilot-agent
620
+	RACE_TEST=true go test ${T} -race ./pilot/...
621
+
622
+.PHONY: istioctl-racetest
623
+istioctl-racetest: istioctl
624
+	RACE_TEST=true go test ${T} -race ./istioctl/...
625
+
626
+.PHONY: mixer-racetest
627
+mixer-racetest: mixs
628
+	# Some tests use relative path "testdata", must be run from mixer dir
629
+	(cd mixer; RACE_TEST=true go test ${T} -race ./...)
630
+
631
+.PHONY: galley-racetest
632
+galley-racetest: depend
633
+	RACE_TEST=true go test ${T} -race ./galley/...
634
+
635
+.PHONY: security-racetest
636
+security-racetest:
637
+	RACE_TEST=true go test ${T} -race ./security/pkg/... ./security/cmd/...
638
+
639
+.PHONY: common-racetest
640
+common-racetest:
641
+	RACE_TEST=true go test ${T} -race ./pkg/...
642
+
643
+#-----------------------------------------------------------------------------
644
+# Target: clean
645
+#-----------------------------------------------------------------------------
646
+.PHONY: clean clean.go
647
+
648
+clean: clean.go
649
+	rm -rf $(DIRS_TO_CLEAN)
650
+	rm -f $(FILES_TO_CLEAN)
651
+
652
+clean.go: ; $(info $(H) cleaning...)
653
+	$(eval GO_CLEAN_FLAGS := -i -r)
654
+	$(Q) $(GO) clean $(GO_CLEAN_FLAGS)
655
+
656
+#-----------------------------------------------------------------------------
657
+# Target: docker
658
+#-----------------------------------------------------------------------------
659
+.PHONY: push gcs.push gcs.push.istioctl-all gcs.push.deb artifacts installgen
660
+
661
+# for now docker is limited to Linux compiles - why ?
662
+include tools/istio-docker.mk
663
+
664
+push: docker.push installgen
665
+
666
+gcs.push: push gcs.push.istioctl-all gcs.push.deb
667
+
668
+gcs.push.istioctl-all: istioctl-all
669
+	gsutil -m cp -r "${ISTIO_OUT}"/istioctl-* "gs://${GS_BUCKET}/pilot/${TAG}/artifacts/istioctl"
670
+
671
+gcs.push.deb: deb
672
+	gsutil -m cp -r "${ISTIO_OUT}"/*.deb "gs://${GS_BUCKET}/pilot/${TAG}/artifacts/debs/"
673
+
674
+artifacts: docker
675
+	@echo 'To be added'
676
+
677
+# generate_yaml in tests/istio.mk can build without specifying a hub & tag
678
+installgen:
679
+	install/updateVersion.sh -a ${HUB},${TAG}
680
+	$(MAKE) istio.yaml
681
+
682
+$(HELM): $(ISTIO_OUT)
683
+	bin/init_helm.sh
684
+
685
+$(HOME)/.helm:
686
+	$(HELM) init --client-only
687
+
688
+# create istio-init.yaml
689
+istio-init.yaml: $(HELM) $(HOME)/.helm
690
+	cat install/kubernetes/namespace.yaml > install/kubernetes/$@
691
+	cat install/kubernetes/helm/istio-init/files/crd-* >> install/kubernetes/$@
692
+	$(HELM) template --name=istio --namespace=istio-system \
693
+		--set-string global.tag=${TAG_VARIANT} \
694
+		--set-string global.hub=${HUB} \
695
+		install/kubernetes/helm/istio-init >> install/kubernetes/$@
696
+
697
+
698
+# This is used to @include values-istio-demo-common.yaml file
699
+istio-demo.yaml istio-demo-auth.yaml: export EXTRA_HELM_SETTINGS+=--values install/kubernetes/helm/istio/values-istio-demo-common.yaml
700
+
701
+# creates istio-demo.yaml istio-demo-auth.yaml istio-remote.yaml
702
+# Ensure that values-$filename is present in install/kubernetes/helm/istio
703
+istio-demo.yaml istio-demo-auth.yaml istio-remote.yaml istio-minimal.yaml: $(HELM) $(HOME)/.helm
704
+	cat install/kubernetes/namespace.yaml > install/kubernetes/$@
705
+	cat install/kubernetes/helm/istio-init/files/crd-* >> install/kubernetes/$@
706
+	$(HELM) template \
707
+		--name=istio \
708
+		--namespace=istio-system \
709
+		--set-string global.tag=${TAG_VARIANT} \
710
+		--set-string global.hub=${HUB} \
711
+		--set-string global.imagePullPolicy=$(PULL_POLICY) \
712
+		--set global.proxy.enableCoreDump=${ENABLE_COREDUMP} \
713
+		--set istio_cni.enabled=${ENABLE_ISTIO_CNI} \
714
+		${EXTRA_HELM_SETTINGS} \
715
+		--values install/kubernetes/helm/istio/values-$@ \
716
+		install/kubernetes/helm/istio >> install/kubernetes/$@
717
+
718
+e2e_files = istio-auth-non-mcp.yaml \
719
+			istio-auth-sds.yaml \
720
+			istio-non-mcp.yaml \
721
+			istio.yaml \
722
+			istio-auth.yaml \
723
+			istio-auth-mcp.yaml \
724
+			istio-auth-multicluster.yaml \
725
+			istio-mcp.yaml \
726
+			istio-one-namespace.yaml \
727
+			istio-one-namespace-auth.yaml \
728
+			istio-one-namespace-trust-domain.yaml \
729
+			istio-multicluster.yaml \
730
+			istio-multicluster-split-horizon.yaml \
731
+
732
+.PHONY: generate_e2e_yaml generate_e2e_yaml_coredump
733
+generate_e2e_yaml: $(e2e_files)
734
+
735
+generate_e2e_yaml_coredump: export ENABLE_COREDUMP=true
736
+generate_e2e_yaml_coredump:
737
+	$(MAKE) generate_e2e_yaml
738
+
739
+# Create yaml files for e2e tests. Applies values-e2e.yaml, then values-$filename.yaml
740
+$(e2e_files): $(HELM) $(HOME)/.helm istio-init.yaml
741
+	cat install/kubernetes/namespace.yaml > install/kubernetes/$@
742
+	cat install/kubernetes/helm/istio-init/files/crd-* >> install/kubernetes/$@
743
+	$(HELM) template \
744
+		--name=istio \
745
+		--namespace=istio-system \
746
+		--set-string global.tag=${TAG_VARIANT} \
747
+		--set-string global.hub=${HUB} \
748
+		--set-string global.imagePullPolicy=$(PULL_POLICY) \
749
+		--set global.proxy.enableCoreDump=${ENABLE_COREDUMP} \
750
+		--set istio_cni.enabled=${ENABLE_ISTIO_CNI} \
751
+		${EXTRA_HELM_SETTINGS} \
752
+		--values install/kubernetes/helm/istio/test-values/values-e2e.yaml \
753
+		--values install/kubernetes/helm/istio/test-values/values-$@ \
754
+		install/kubernetes/helm/istio >> install/kubernetes/$@
755
+
756
+# files generated by the default invocation of updateVersion.sh
757
+FILES_TO_CLEAN+=install/consul/istio.yaml \
758
+                install/kubernetes/istio-auth.yaml \
759
+                install/kubernetes/istio-citadel-plugin-certs.yaml \
760
+                install/kubernetes/istio-citadel-with-health-check.yaml \
761
+                install/kubernetes/istio-one-namespace-auth.yaml \
762
+                install/kubernetes/istio-one-namespace-trust-domain.yaml \
763
+                install/kubernetes/istio-one-namespace.yaml \
764
+                install/kubernetes/istio.yaml \
765
+                samples/bookinfo/platform/consul/bookinfo.sidecars.yaml \
766
+
767
+#-----------------------------------------------------------------------------
768
+# Target: environment and tools
769
+#-----------------------------------------------------------------------------
770
+.PHONY: show.env show.goenv
771
+
772
+show.env: ; $(info $(H) environment variables...)
773
+	$(Q) printenv
774
+
775
+show.goenv: ; $(info $(H) go environment...)
776
+	$(Q) $(GO) version
777
+	$(Q) $(GO) env
778
+
779
+# tickle
780
+# show makefile variables. Usage: make show.<variable-name>
781
+show.%: ; $(info $* $(H) $($*))
782
+	$(Q) true
783
+
784
+#-----------------------------------------------------------------------------
785
+# Target: artifacts and distribution
786
+#-----------------------------------------------------------------------------
787
+# deb, rpm, etc packages
788
+include tools/packaging/packaging.mk
789
+
790
+#-----------------------------------------------------------------------------
791
+# Target: e2e tests
792
+#-----------------------------------------------------------------------------
793
+include tests/istio.mk
794
+
795
+#-----------------------------------------------------------------------------
796
+# Target: integration tests
797
+#-----------------------------------------------------------------------------
798
+include tests/integration/tests.mk
799
+
800
+include common/Makefile.common.mk

+ 22
- 0
Makefile.overrides.mk View File

@@ -0,0 +1,22 @@
1
+# Copyright 2019 Istio Authors
2
+#
3
+# Licensed under the Apache License, Version 2.0 (the "License");
4
+# you may not use this file except in compliance with the License.
5
+# You may obtain a copy of the License at
6
+#
7
+#    http://www.apache.org/licenses/LICENSE-2.0
8
+#
9
+# Unless required by applicable law or agreed to in writing, software
10
+# distributed under the License is distributed on an "AS IS" BASIS,
11
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+# See the License for the specific language governing permissions and
13
+# limitations under the License.
14
+
15
+# this repo is not yet on the container plan by default
16
+BUILD_WITH_CONTAINER ?= 0
17
+
18
+# create phony targets for the top-level items in the repo
19
+PHONYS := $(shell ls | grep -v Makefile)
20
+.PHONY: $(PHONYS)
21
+$(PHONYS):
22
+	@$(MAKE) $@

+ 1
- 1
SUPPORT.md View File

@@ -2,6 +2,6 @@
2 2
 
3 3
 Here are some resources to help you understand and use Istio:
4 4
 
5
-- For in-depth information about how to use Istio, visit [istio.io](https://istio.io)                                   
5
+- For in-depth information about how to use Istio, visit [istio.io](https://istio.io)
6 6
 - To ask questions and get assistance from our community, visit [discuss.istio.io](https://discuss.istio.io)
7 7
 - To learn how to participate in our overall community, visit [our community page](https://istio.io/about/community)

+ 4
- 4
bin/codecov.sh View File

@@ -41,14 +41,14 @@ COVERAGEDIR="$(mktemp -d /tmp/istio_coverage.XXXXXXXXXX)"
41 41
 mkdir -p "$COVERAGEDIR"
42 42
 
43 43
 function cleanup() {
44
-  make localTestEnvCleanup
44
+  make -f Makefile.core.mk localTestEnvCleanup
45 45
 }
46 46
 
47 47
 trap cleanup EXIT
48 48
 
49 49
 # Setup environment needed by some tests.
50
-make sync
51
-make localTestEnv
50
+make -f Makefile.core.mk sync
51
+make -f Makefile.core.mk localTestEnv
52 52
 
53 53
 # coverage test needs to run one package per command.
54 54
 # This script runs nproc/2 in parallel.
@@ -149,7 +149,7 @@ echo "Final reports are stored in ${OUT_DIR}"
149 149
 
150 150
 if ls "${COVERAGEDIR}"/*.err 1> /dev/null 2>&1; then
151 151
   echo "The following tests had failed:"
152
-  cat "${COVERAGEDIR}"/*.err 
152
+  cat "${COVERAGEDIR}"/*.err
153 153
   exit 1
154 154
 fi
155 155
 

+ 1
- 1
bin/counterfeiter.sh View File

@@ -22,7 +22,7 @@ if [ "$ROOTDIR" != "${GOPATH-$HOME/go}/src/istio.io/istio" ]; then
22 22
   die "Istio not found in GOPATH/src/istio.io/"
23 23
 fi
24 24
 
25
-gen_img=gcr.io/istio-testing/build-tools:2019-08-16
25
+gen_img=gcr.io/istio-testing/build-tools:2019-09-04T21-28-42
26 26
 
27 27
 docker run  -i --volume /var/run/docker.sock:/var/run/docker.sock \
28 28
   -e "GOPATH=/go:$GOPATH" --rm --entrypoint counterfeiter -v "$ROOTDIR:$ROOTDIR" -w "$(pwd)" $gen_img "$@"

+ 4
- 13
bin/protoc.sh View File

@@ -22,28 +22,19 @@ fi
22 22
 SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
23 23
 ROOTDIR="$(dirname "$SCRIPTPATH")"
24 24
 
25
-# Ensure expected GOPATH setup
26
-if [ "$ROOTDIR" != "${GOPATH-$HOME/go}/src/istio.io/istio" ]; then
27
-  die "Istio not found in GOPATH/src/istio.io/"
28
-fi
29
-
30 25
 api=$(go list -m -f "{{.Dir}}" istio.io/api)
31
-protobuf=$(go list -m -f "{{.Dir}}" github.com/gogo/protobuf)
32
-gogo_genproto=$(go list -m -f "{{.Dir}}" istio.io/gogo-genproto)
33 26
 
34
-gen_img=gcr.io/istio-testing/build-tools:2019-08-16
27
+gen_img=gcr.io/istio-testing/build-tools:2019-09-04T21-28-42
35 28
 
36 29
 docker run \
37 30
   -i \
38 31
   --rm \
39 32
   -v "$ROOTDIR:$ROOTDIR" \
40 33
   -v "${api}:/protos/istio.io/api" \
41
-  -v "${protobuf}:/protos/github.com/gogo/protobuf" \
42
-  -v "${gogo_genproto}:/protos/istio.io/gogo-genproto" \
34
+  -v "$ROOTDIR"/common-protos:/protos \
43 35
   -w "$(pwd)" \
44
-  --entrypoint /usr/bin/protoc \
45 36
   $gen_img \
37
+  /usr/bin/protoc \
38
+  -I/protos \
46 39
   -I/protos/istio.io/api \
47
-  -I/protos/github.com/gogo/protobuf \
48
-  -I/protos/istio.io/gogo-genproto/googleapis \
49 40
   "$@"

+ 1
- 0
common-protos/.commonfiles.sha View File

@@ -0,0 +1 @@
1
+26f9010dc0dd119451e2e32fb7f704121af55104

+ 101
- 0
common-protos/github.com/census-instrumentation/opencensus-proto/src/opencensus/proto/agent/common/v1/common.proto View File

@@ -0,0 +1,101 @@
1
+// Copyright 2018, OpenCensus Authors
2
+//
3
+// Licensed under the Apache License, Version 2.0 (the "License");
4
+// you may not use this file except in compliance with the License.
5
+// You may obtain a copy of the License at
6
+//
7
+//     http://www.apache.org/licenses/LICENSE-2.0
8
+//
9
+// Unless required by applicable law or agreed to in writing, software
10
+// distributed under the License is distributed on an "AS IS" BASIS,
11
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+// See the License for the specific language governing permissions and
13
+// limitations under the License.
14
+
15
+syntax = "proto3";
16
+
17
+// NOTE: This proto is experimental and is subject to change at this point.
18
+// Please do not use it at the moment.
19
+
20
+package opencensus.proto.agent.common.v1;
21
+
22
+import "google/protobuf/timestamp.proto";
23
+
24
+option java_multiple_files = true;
25
+option java_package = "io.opencensus.proto.agent.common.v1";
26
+option java_outer_classname = "CommonProto";
27
+
28
+option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1";
29
+
30
+option ruby_package = "OpenCensus.Proto.Agent.Common.V1";
31
+
32
+// Identifier metadata of the Node that produces the span or tracing data.
33
+// Note, this is not the metadata about the Node or service that is described by associated spans.
34
+// In the future we plan to extend the identifier proto definition to support
35
+// additional information (e.g cloud id, etc.)
36
+message Node {
37
+  // Identifier that uniquely identifies a process within a VM/container.
38
+  ProcessIdentifier identifier = 1;
39
+
40
+  // Information on the OpenCensus Library that initiates the stream.
41
+  LibraryInfo library_info = 2;
42
+
43
+  // Additional information on service.
44
+  ServiceInfo service_info = 3;
45
+
46
+  // Additional attributes.
47
+  map<string, string> attributes = 4;
48
+
49
+  // TODO(songya): Add more identifiers in the future as needed, like cloud
50
+  // identifiers.
51
+}
52
+
53
+// Identifier that uniquely identifies a process within a VM/container.
54
+message ProcessIdentifier {
55
+
56
+  // The host name. Usually refers to the machine/container name.
57
+  // For example: os.Hostname() in Go, socket.gethostname() in Python.
58
+  string host_name = 1;
59
+
60
+  // Process id.
61
+  uint32 pid = 2;
62
+
63
+  // Start time of this ProcessIdentifier. Represented in epoch time.
64
+  google.protobuf.Timestamp start_timestamp = 3;
65
+}
66
+
67
+// Information on OpenCensus Library.
68
+message LibraryInfo {
69
+
70
+  enum Language {
71
+    LANGUAGE_UNSPECIFIED = 0;
72
+    CPP = 1;
73
+    C_SHARP = 2;
74
+    ERLANG = 3;
75
+    GO_LANG = 4;
76
+    JAVA = 5;
77
+    NODE_JS = 6;
78
+    PHP = 7;
79
+    PYTHON = 8;
80
+    RUBY = 9;
81
+    WEB_JS = 10;
82
+  }
83
+
84
+  // Language of OpenCensus Library.
85
+  Language language = 1;
86
+
87
+  // Version of Agent exporter of Library.
88
+  string exporter_version = 2;
89
+
90
+  // Version of OpenCensus Library.
91
+  string core_library_version = 3;
92
+}
93
+
94
+// Additional service information.
95
+message ServiceInfo {
96
+
97
+  // Name of the service.
98
+  string name = 1;
99
+
100
+  // TODO(songya): add more fields as needed.
101
+}

+ 58
- 0
common-protos/github.com/census-instrumentation/opencensus-proto/src/opencensus/proto/agent/metrics/v1/metrics_service.proto View File

@@ -0,0 +1,58 @@
1
+// Copyright 2018, OpenCensus Authors
2
+//
3
+// Licensed under the Apache License, Version 2.0 (the "License");
4
+// you may not use this file except in compliance with the License.
5
+// You may obtain a copy of the License at
6
+//
7
+//     http://www.apache.org/licenses/LICENSE-2.0
8
+//
9
+// Unless required by applicable law or agreed to in writing, software
10
+// distributed under the License is distributed on an "AS IS" BASIS,
11
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+// See the License for the specific language governing permissions and
13
+// limitations under the License.
14
+
15
+syntax = "proto3";
16
+
17
+package opencensus.proto.agent.metrics.v1;
18
+
19
+import "opencensus/proto/agent/common/v1/common.proto";
20
+import "opencensus/proto/metrics/v1/metrics.proto";
21
+import "opencensus/proto/resource/v1/resource.proto";
22
+
23
+option java_multiple_files = true;
24
+option java_package = "io.opencensus.proto.agent.metrics.v1";
25
+option java_outer_classname = "MetricsServiceProto";
26
+
27
+option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/agent/metrics/v1";
28
+
29
+option ruby_package = "OpenCensus.Proto.Agent.Metrics.V1";
30
+
31
+// Service that can be used to push metrics between one Application
32
+// instrumented with OpenCensus and an agent, or between an agent and a
33
+// central collector.
34
+service MetricsService {
35
+  // For performance reasons, it is recommended to keep this RPC
36
+  // alive for the entire life of the application.
37
+  rpc Export(stream ExportMetricsServiceRequest) returns (stream ExportMetricsServiceResponse) {}
38
+}
39
+
40
+message ExportMetricsServiceRequest {
41
+  // This is required only in the first message on the stream or if the
42
+  // previous sent ExportMetricsServiceRequest message has a different Node (e.g.
43
+  // when the same RPC is used to send Metrics from multiple Applications).
44
+  opencensus.proto.agent.common.v1.Node node = 1;
45
+
46
+  // A list of metrics that belong to the last received Node.
47
+  repeated opencensus.proto.metrics.v1.Metric metrics = 2;
48
+
49
+  // The resource for the metrics in this message that do not have an explicit
50
+  // resource set.
51
+  // If unset, the most recently set resource in the RPC stream applies. It is
52
+  // valid to never be set within a stream, e.g. when no resource info is known
53
+  // at all or when all sent metrics have an explicit resource set.
54
+  opencensus.proto.resource.v1.Resource resource = 3;
55
+}
56
+
57
+message ExportMetricsServiceResponse {
58
+}

+ 87
- 0
common-protos/github.com/census-instrumentation/opencensus-proto/src/opencensus/proto/agent/trace/v1/trace_service.proto View File

@@ -0,0 +1,87 @@
1
+// Copyright 2018, OpenCensus Authors
2
+//
3
+// Licensed under the Apache License, Version 2.0 (the "License");
4
+// you may not use this file except in compliance with the License.
5
+// You may obtain a copy of the License at
6
+//
7
+//     http://www.apache.org/licenses/LICENSE-2.0
8
+//
9
+// Unless required by applicable law or agreed to in writing, software
10
+// distributed under the License is distributed on an "AS IS" BASIS,
11
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+// See the License for the specific language governing permissions and
13
+// limitations under the License.
14
+
15
+syntax = "proto3";
16
+
17
+// NOTE: This proto is experimental and is subject to change at this point.
18
+// Please do not use it at the moment.
19
+
20
+package opencensus.proto.agent.trace.v1;
21
+
22
+import "opencensus/proto/agent/common/v1/common.proto";
23
+import "opencensus/proto/resource/v1/resource.proto";
24
+import "opencensus/proto/trace/v1/trace.proto";
25
+import "opencensus/proto/trace/v1/trace_config.proto";
26
+
27
+option java_multiple_files = true;
28
+option java_package = "io.opencensus.proto.agent.trace.v1";
29
+option java_outer_classname = "TraceServiceProto";
30
+
31
+option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1";
32
+
33
+option ruby_package = "OpenCensus.Proto.Agent.Trace.V1";
34
+
35
+// Service that can be used to push spans and configs between one Application
36
+// instrumented with OpenCensus and an agent, or between an agent and a
37
+// central collector or config service (in this case spans and configs are
38
+// sent/received to/from multiple Applications).
39
+service TraceService {
40
+  // After initialization, this RPC must be kept alive for the entire life of
41
+  // the application. The agent pushes configs down to applications via a
42
+  // stream.
43
+  rpc Config(stream CurrentLibraryConfig) returns (stream UpdatedLibraryConfig) {}
44
+
45
+  // For performance reasons, it is recommended to keep this RPC
46
+  // alive for the entire life of the application.
47
+  rpc Export(stream ExportTraceServiceRequest) returns (stream ExportTraceServiceResponse) {}
48
+}
49
+
50
+message CurrentLibraryConfig {
51
+  // This is required only in the first message on the stream or if the
52
+  // previous sent CurrentLibraryConfig message has a different Node (e.g.
53
+  // when the same RPC is used to configure multiple Applications).
54
+  opencensus.proto.agent.common.v1.Node node = 1;
55
+
56
+  // Current configuration.
57
+  opencensus.proto.trace.v1.TraceConfig config = 2;
58
+}
59
+
60
+message UpdatedLibraryConfig {
61
+  // This field is ignored when the RPC is used to configure only one Application.
62
+  // This is required only in the first message on the stream or if the
63
+  // previous sent UpdatedLibraryConfig message has a different Node.
64
+  opencensus.proto.agent.common.v1.Node node = 1;
65
+
66
+  // Requested updated configuration.
67
+  opencensus.proto.trace.v1.TraceConfig config = 2;
68
+}
69
+
70
+message ExportTraceServiceRequest {
71
+  // This is required only in the first message on the stream or if the
72
+  // previous sent ExportTraceServiceRequest message has a different Node (e.g.
73
+  // when the same RPC is used to send Spans from multiple Applications).
74
+  opencensus.proto.agent.common.v1.Node node = 1;
75
+
76
+  // A list of Spans that belong to the last received Node.
77
+  repeated opencensus.proto.trace.v1.Span spans = 2;
78
+
79
+  // The resource for the spans in this message that do not have an explicit
80
+  // resource set.
81
+  // If unset, the most recently set resource in the RPC stream applies. It is
82
+  // valid to never be set within a stream, e.g. when no resource info is known.
83
+  opencensus.proto.resource.v1.Resource resource = 3;
84
+}
85
+
86
+message ExportTraceServiceResponse {
87
+}

+ 303
- 0
common-protos/github.com/census-instrumentation/opencensus-proto/src/opencensus/proto/metrics/v1/metrics.proto View File

@@ -0,0 +1,303 @@
1
+// Copyright 2018, OpenCensus Authors
2
+//
3
+// Licensed under the Apache License, Version 2.0 (the "License");
4
+// you may not use this file except in compliance with the License.
5
+// You may obtain a copy of the License at
6
+//
7
+//     http://www.apache.org/licenses/LICENSE-2.0
8
+//
9
+// Unless required by applicable law or agreed to in writing, software
10
+// distributed under the License is distributed on an "AS IS" BASIS,
11
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+// See the License for the specific language governing permissions and
13
+// limitations under the License.
14
+
15
+// This package describes the Metrics data model. It is currently experimental
16
+// but may eventually become the wire format for metrics. Please see
17
+// https://github.com/census-instrumentation/opencensus-specs/blob/master/stats/Metrics.md
18
+// for more details.
19
+
20
+syntax = "proto3";
21
+
22
+package opencensus.proto.metrics.v1;
23
+
24
+import "google/protobuf/timestamp.proto";
25
+import "google/protobuf/wrappers.proto";
26
+import "opencensus/proto/resource/v1/resource.proto";
27
+
28
+option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1";
29
+
30
+option java_multiple_files = true;
31
+option java_package = "io.opencensus.proto.metrics.v1";
32
+option java_outer_classname = "MetricsProto";
33
+
34
+option ruby_package = "OpenCensus.Proto.Metrics.V1";
35
+
36
+// Defines a Metric which has one or more timeseries.
37
+message Metric {
38
+  // The descriptor of the Metric.
39
+  // TODO(issue #152): consider only sending the name of descriptor for
40
+  // optimization.
41
+  MetricDescriptor metric_descriptor = 1;
42
+
43
+  // One or more timeseries for a single metric, where each timeseries has
44
+  // one or more points.
45
+  repeated TimeSeries timeseries = 2;
46
+
47
+  // The resource for the metric. If unset, it may be set to a default value
48
+  // provided for a sequence of messages in an RPC stream.
49
+  opencensus.proto.resource.v1.Resource resource = 3;
50
+}
51
+
52
+// Defines a metric type and its schema.
53
+message MetricDescriptor {
54
+  // The metric type, including its DNS name prefix. It must be unique.
55
+  string name = 1;
56
+
57
+  // A detailed description of the metric, which can be used in documentation.
58
+  string description = 2;
59
+
60
+  // The unit in which the metric value is reported. Follows the format
61
+  // described by http://unitsofmeasure.org/ucum.html.
62
+  string unit = 3;
63
+
64
+  // The kind of metric. It describes how the data is reported.
65
+  //
66
+  // A gauge is an instantaneous measurement of a value.
67
+  //
68
+  // A cumulative measurement is a value accumulated over a time interval. In
69
+  // a time series, cumulative measurements should have the same start time,
70
+  // increasing values and increasing end times, until an event resets the
71
+  // cumulative value to zero and sets a new start time for the following
72
+  // points.
73
+  enum Type {
74
+    // Do not use this default value.
75
+    UNSPECIFIED = 0;
76
+
77
+    // Integer gauge. The value can go both up and down.
78
+    GAUGE_INT64 = 1;
79
+
80
+    // Floating point gauge. The value can go both up and down.
81
+    GAUGE_DOUBLE = 2;
82
+
83
+    // Distribution gauge measurement. The count and sum can go both up and
84
+    // down. Recorded values are always >= 0.
85
+    // Used in scenarios like a snapshot of time the current items in a queue
86
+    // have spent there.
87
+    GAUGE_DISTRIBUTION = 3;
88
+
89
+    // Integer cumulative measurement. The value cannot decrease, if resets
90
+    // then the start_time should also be reset.
91
+    CUMULATIVE_INT64 = 4;
92
+
93
+    // Floating point cumulative measurement. The value cannot decrease, if
94
+    // resets then the start_time should also be reset. Recorded values are
95
+    // always >= 0.
96
+    CUMULATIVE_DOUBLE = 5;
97
+
98
+    // Distribution cumulative measurement. The count and sum cannot decrease,
99
+    // if resets then the start_time should also be reset.
100
+    CUMULATIVE_DISTRIBUTION = 6;
101
+
102
+    // Some frameworks implemented Histograms as a summary of observations
103
+    // (usually things like request durations and response sizes). While it
104
+    // also provides a total count of observations and a sum of all observed
105
+    // values, it calculates configurable percentiles over a sliding time
106
+    // window. This is not recommended, since it cannot be aggregated.
107
+    SUMMARY = 7;
108
+  }
109
+  Type type = 4;
110
+
111
+  // The label keys associated with the metric descriptor.
112
+  repeated LabelKey label_keys = 5;
113
+}
114
+
115
+// Defines a label key associated with a metric descriptor.
116
+message LabelKey {
117
+  // The key for the label.
118
+  string key = 1;
119
+
120
+  // A human-readable description of what this label key represents.
121
+  string description = 2;
122
+}
123
+
124
+// A collection of data points that describes the time-varying values
125
+// of a metric.
126
+message TimeSeries {
127
+  // Must be present for cumulative metrics. The time when the cumulative value
128
+  // was reset to zero. Exclusive. The cumulative value is over the time interval
129
+  // (start_timestamp, timestamp]. If not specified, the backend can use the
130
+  // previous recorded value.
131
+  google.protobuf.Timestamp start_timestamp = 1;
132
+
133
+  // The set of label values that uniquely identify this timeseries. Applies to
134
+  // all points. The order of label values must match that of label keys in the
135
+  // metric descriptor.
136
+  repeated LabelValue label_values = 2;
137
+
138
+  // The data points of this timeseries. Point.value type MUST match the
139
+  // MetricDescriptor.type.
140
+  repeated Point points = 3;
141
+}
142
+
143
+message LabelValue {
144
+  // The value for the label.
145
+  string value = 1;
146
+  // If false the value field is ignored and considered not set.
147
+  // This is used to differentiate a missing label from an empty string.
148
+  bool has_value = 2;
149
+}
150
+
151
+// A timestamped measurement.
152
+message Point {
153
+  // The moment when this point was recorded. Inclusive.
154
+  // If not specified, the timestamp will be decided by the backend.
155
+  google.protobuf.Timestamp timestamp = 1;
156
+
157
+  // The actual point value.
158
+  oneof value {
159
+    // A 64-bit integer.
160
+    int64 int64_value = 2;
161
+
162
+    // A 64-bit double-precision floating-point number.
163
+    double double_value = 3;
164
+
165
+    // A distribution value.
166
+    DistributionValue distribution_value = 4;
167
+
168
+    // A summary value. This is not recommended, since it cannot be aggregated.
169
+    SummaryValue summary_value = 5;
170
+  }
171
+}
172
+
173
+// Distribution contains summary statistics for a population of values. It
174
+// optionally contains a histogram representing the distribution of those
175
+// values across a set of buckets.
176
+message DistributionValue {
177
+  // The number of values in the population. Must be non-negative. This value
178
+  // must equal the sum of the values in bucket_counts if a histogram is
179
+  // provided.
180
+  int64 count = 1;
181
+
182
+  // The sum of the values in the population. If count is zero then this field
183
+  // must be zero.
184
+  double sum = 2;
185
+
186
+  // The sum of squared deviations from the mean of the values in the
187
+  // population. For values x_i this is:
188
+  //
189
+  //     Sum[i=1..n]((x_i - mean)^2)
190
+  //
191
+  // Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition
192
+  // describes Welford's method for accumulating this sum in one pass.
193
+  //
194
+  // If count is zero then this field must be zero.
195
+  double sum_of_squared_deviation = 3;
196
+
197
+  // A Distribution may optionally contain a histogram of the values in the
198
+  // population. The bucket boundaries for that histogram are described by
199
+  // BucketOptions.
200
+  //
201
+  // If bucket_options has no type, then there is no histogram associated with
202
+  // the Distribution.
203
+  message BucketOptions {
204
+    oneof type {
205
+      // Bucket with explicit bounds.
206
+      Explicit explicit = 1;
207
+    }
208
+
209
+    // Specifies a set of buckets with arbitrary upper-bounds.
210
+    // This defines size(bounds) + 1 (= N) buckets. The boundaries for bucket
211
+    // index i are:
212
+    //
213
+    // [0, bucket_bounds[i]) for i == 0
214
+    // [bucket_bounds[i-1], bucket_bounds[i]) for 0 < i < N-1
215
+    // [bucket_bounds[i], +infinity) for i == N-1
216
+    message Explicit {
217
+      // The values must be strictly increasing and > 0.
218
+      repeated double bounds = 1;
219
+    }
220
+
221
+    // TODO: If OpenMetrics decides to support (a, b] intervals we should add
222
+    // support for these by defining a boolean value here which decides what
223
+    // type of intervals to use.
224
+  }
225
+
226
+  // Don't change bucket boundaries within a TimeSeries if your backend doesn't
227
+  // support this.
228
+  // TODO(issue #152): consider not required to send bucket options for
229
+  // optimization.
230
+  BucketOptions bucket_options = 4;
231
+
232
+  message Bucket {
233
+    // The number of values in each bucket of the histogram, as described in
234
+    // bucket_bounds.
235
+    int64 count = 1;
236
+
237
+    // If the distribution does not have a histogram, then omit this field.
238
+    Exemplar exemplar = 2;
239
+  }
240
+
241
+  // If the distribution does not have a histogram, then omit this field.
242
+  // If there is a histogram, then the sum of the values in the Bucket counts
243
+  // must equal the value in the count field of the distribution.
244
+  repeated Bucket buckets = 5;
245
+
246
+  // Exemplars are example points that may be used to annotate aggregated
247
+  // Distribution values. They are metadata that gives information about a
248
+  // particular value added to a Distribution bucket.
249
+  message Exemplar {
250
+    // Value of the exemplar point. It determines which bucket the exemplar
251
+    // belongs to.
252
+    double value = 1;
253
+
254
+    // The observation (sampling) time of the above value.
255
+    google.protobuf.Timestamp timestamp = 2;
256
+
257
+    // Contextual information about the example value.
258
+    map<string, string> attachments = 3;
259
+  }
260
+}
261
+
262
+// The start_timestamp only applies to the count and sum in the SummaryValue.
263
+message SummaryValue {
264
+  // The total number of recorded values since start_time. Optional since
265
+  // some systems don't expose this.
266
+  google.protobuf.Int64Value count = 1;
267
+
268
+  // The total sum of recorded values since start_time. Optional since some
269
+  // systems don't expose this. If count is zero then this field must be zero.
270
+  // This field must be unset if the sum is not available.
271
+  google.protobuf.DoubleValue sum = 2;
272
+
273
+  // The values in this message can be reset at arbitrary unknown times, with
274
+  // the requirement that all of them are reset at the same time.
275
+  message Snapshot {
276
+    // The number of values in the snapshot. Optional since some systems don't
277
+    // expose this.
278
+    google.protobuf.Int64Value count = 1;
279
+
280
+    // The sum of values in the snapshot. Optional since some systems don't
281
+    // expose this. If count is zero then this field must be zero or not set
282
+    // (if not supported).
283
+    google.protobuf.DoubleValue sum = 2;
284
+
285
+    // Represents the value at a given percentile of a distribution.
286
+    message ValueAtPercentile {
287
+      // The percentile of a distribution. Must be in the interval
288
+      // (0.0, 100.0].
289
+      double percentile = 1;
290
+
291
+      // The value at the given percentile of a distribution.
292
+      double value = 2;
293
+    }
294
+
295
+    // A list of values at different percentiles of the distribution calculated
296
+    // from the current snapshot. The percentiles must be strictly increasing.
297
+    repeated ValueAtPercentile percentile_values = 3;
298
+  }
299
+
300
+  // Values calculated over an arbitrary time window.
301
+  Snapshot snapshot = 3;
302
+}
303
+

+ 35
- 0
common-protos/github.com/census-instrumentation/opencensus-proto/src/opencensus/proto/resource/v1/resource.proto View File

@@ -0,0 +1,35 @@
1
+// Copyright 2018, OpenCensus Authors
2
+//
3
+// Licensed under the Apache License, Version 2.0 (the "License");
4
+// you may not use this file except in compliance with the License.
5
+// You may obtain a copy of the License at
6
+//
7
+//     http://www.apache.org/licenses/LICENSE-2.0
8
+//
9
+// Unless required by applicable law or agreed to in writing, software
10
+// distributed under the License is distributed on an "AS IS" BASIS,
11
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+// See the License for the specific language governing permissions and
13
+// limitations under the License.
14
+
15
+syntax = "proto3";
16
+
17
+package opencensus.proto.resource.v1;
18
+
19
+option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1";
20
+
21
+option java_multiple_files = true;
22
+option java_package = "io.opencensus.proto.resource.v1";
23
+option java_outer_classname = "ResourceProto";
24
+
25
+option ruby_package = "OpenCensus.Proto.Resource.V1";
26
+
27
+// Resource information.
28
+message Resource {
29
+
30
+  // Type identifier for the resource.
31
+  string type = 1;
32
+
33
+  // Set of labels that describe the resource.
34
+  map<string,string> labels = 2;
35
+}

+ 138
- 0
common-protos/github.com/census-instrumentation/opencensus-proto/src/opencensus/proto/stats/v1/stats.proto View File

@@ -0,0 +1,138 @@
1
+// Copyright 2016-18, OpenCensus Authors
2
+//
3
+// Licensed under the Apache License, Version 2.0 (the "License");
4
+// you may not use this file except in compliance with the License.
5
+// You may obtain a copy of the License at
6
+//
7
+//     http://www.apache.org/licenses/LICENSE-2.0
8
+//
9
+// Unless required by applicable law or agreed to in writing, software
10
+// distributed under the License is distributed on an "AS IS" BASIS,
11
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+// See the License for the specific language governing permissions and
13
+// limitations under the License.
14
+
15
+syntax = "proto3";
16
+
17
+package opencensus.proto.stats.v1;
18
+
19
+import "google/protobuf/timestamp.proto";
20
+
21
+option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/stats/v1";
22
+
23
+option java_multiple_files = true;
24
+option java_package = "io.opencensus.proto.stats.v1";
25
+option java_outer_classname = "StatsProto";
26
+
27
+option ruby_package = "OpenCensus.Proto.Stats.V1";
28
+
29
+// TODO(bdrutu): Consider if this should be moved to a "tags" directory to match the API structure.
30
+message Tag {
31
+  string key = 1;
32
+  string value = 2;
33
+}
34
+
35
+// Measure .
36
+message Measure {
37
+  // A string by which the measure will be referred to, e.g. "rpc_server_latency". Names MUST be
38
+  // unique within the library.
39
+  string name = 1;
40
+
41
+  // Describes the measure, e.g. "RPC latency in seconds".
42
+  string description = 2;
43
+
44
+  // Describes the unit used for the Measure. Follows the format described by
45
+  // http://unitsofmeasure.org/ucum.html.
46
+  string unit = 3;
47
+
48
+  enum Type {
49
+    // Unknown type.
50
+    TYPE_UNSPECIFIED = 0;
51
+    // Indicates an int64 Measure.
52
+    INT64 = 1;
53
+    // Indicates a double Measure.
54
+    DOUBLE = 2;
55
+  }
56
+
57
+  // The type used for this Measure.
58
+  Type type = 4;
59
+}
60
+
61
+message View {
62
+  // A string by which the View will be referred to, e.g. "rpc_latency". Names MUST be unique
63
+  // within the library.
64
+  string name = 1;
65
+
66