This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instructions for OC Web example in Kubernetes (#37)
- Loading branch information
1 parent
5cb6119
commit b89b7e7
Showing
7 changed files
with
256 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,3 +43,6 @@ dist/ | |
|
||
#istanbul files | ||
coverage/ | ||
|
||
#static JS files in examples | ||
static/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2019, OpenCensus Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http:#www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# First build the server binary | ||
FROM golang:alpine AS build | ||
RUN apk update && apk add --no-cache git && apk add --no-cache ca-certificates | ||
WORKDIR /root | ||
ADD go.mod . | ||
ADD go.sum . | ||
ADD server.go . | ||
RUN GO111MODULE=on go get -d -v | ||
RUN GO111MODULE=on CGO_ENABLED=0 go build -o example_server | ||
|
||
# Then put the server binary and needed files into an empty container | ||
FROM scratch | ||
COPY index.html / | ||
COPY ./static/*.js /static/ | ||
COPY --from=build ./root/example_server / | ||
ENTRYPOINT ["/example_server"] | ||
EXPOSE 8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
examples/initial_load/kubernetes/initial-load-demo.template.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Copyright 2019, OpenCensus Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http:#www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: oc-web-initial-load-deployment | ||
spec: | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: oc-web-initial-load | ||
spec: | ||
containers: | ||
- name: oc-web-initial-load-container | ||
image: gcr.io/{{PROJECT-ID}}/oc-web-initial-load:latest | ||
args: [ | ||
"--listen=:8000", | ||
"--agent={{AGENT-IP}}:80", | ||
"--ocw_script_prefix=/static", | ||
] | ||
ports: | ||
- containerPort: 8000 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: oc-web-initial-load-service | ||
spec: | ||
type: LoadBalancer | ||
selector: | ||
app: oc-web-initial-load | ||
ports: | ||
- protocol: TCP | ||
port: 80 | ||
targetPort: 8000 |
74 changes: 74 additions & 0 deletions
74
examples/initial_load/kubernetes/oc-agent-cors.template.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Copyright 2019, OpenCensus Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http:#www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: oc-agent-conf | ||
namespace: default | ||
data: | ||
oc-agent-config: | | ||
receivers: | ||
opencensus: | ||
address: ":55678" | ||
cors_allowed_origins: | ||
- "*" | ||
exporters: | ||
stackdriver: | ||
project: {{PROJECT-ID}} | ||
enable_tracing: true | ||
enable_metrics: false | ||
--- | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: oc-agent-deployment | ||
spec: | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: oc-agent-deployment | ||
spec: | ||
containers: | ||
- name: oc-agent-container | ||
image: omnition/opencensus-agent:latest | ||
volumeMounts: | ||
- name: oc-agent-config-vol | ||
readOnly: true | ||
mountPath: /conf | ||
args: ["--config=/conf/oc-agent-config.yaml"] | ||
ports: | ||
- containerPort: 55678 | ||
volumes: | ||
- name: oc-agent-config-vol | ||
configMap: | ||
name: oc-agent-conf | ||
items: | ||
- key: oc-agent-config | ||
path: oc-agent-config.yaml | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: oc-agent-service | ||
spec: | ||
type: LoadBalancer | ||
selector: | ||
app: oc-agent-deployment | ||
ports: | ||
- protocol: TCP | ||
port: 80 | ||
targetPort: 55678 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters