Skip to content

Commit

Permalink
Add Helm support for Theia
Browse files Browse the repository at this point in the history
Signed-off-by: Yanjun Zhou <zhouya@vmware.com>
  • Loading branch information
yanjunz97 committed May 5, 2022
1 parent 66c682b commit f12780d
Show file tree
Hide file tree
Showing 41 changed files with 875 additions and 534 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Go
on:
pull_request:
branches:
- main
- release-*
- feature/*
push:
branches:
- main
- release-*
- feature/*

env:
go-cache-name: go

jobs:
check-changes:
name: Check whether tests need to be run based on diff
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: antrea-io/has-changes@v2
id: check_diff
with:
paths-ignore: docs/* ci/jenkins/* *.md hack/.notableofcontents
outputs:
has_changes: ${{ steps.check_diff.outputs.has_changes }}

verify:
name: Verify docs and spelling
runs-on: [ubuntu-latest]
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Check-out code
uses: actions/checkout@v3
- name: Checking whether autogenerated Helm chart documentation is up-to-date
working-directory: build/charts/
run: |
make helm-docs
DIFF=$(git diff .)
if [ -n "$DIFF" ]; then
echo "The Helm chart documentation is out-of-date; please run 'make helm-docs' in 'build/charts/' and commit the changes"
exit 1
fi
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.7.0-dev
v0.1.0-dev
6 changes: 6 additions & 0 deletions build/charts/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
USERID := $(shell id -u)
GRPID := $(shell id -g)

.PHONY: helm-docs
helm-docs:
docker run --rm --volume "$(CURDIR):/helm-docs" --user=$(USERID):$(GRPID) jnorwood/helm-docs:v1.7.0
23 changes: 23 additions & 0 deletions build/charts/theia/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
19 changes: 19 additions & 0 deletions build/charts/theia/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v2
name: theia
type: application
displayName: Theia
home: https://antrea.io/
version: 0.1.0-dev
appVersion: 0.1.0-dev
kubeVersion: ">= 1.16.0-0"
icon: https://raw.githubusercontent.com/antrea-io/antrea/main/docs/assets/logo/antrea_logo.svg
description: Antrea Network Flow Visibility
keywords:
- Kubernetes
- CNCF
- Networking
- CNI
- Security
- Flow visibility
sources:
- https://github.com/antrea-io/theia
33 changes: 33 additions & 0 deletions build/charts/theia/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# theia

![Version: 0.1.0-dev](https://img.shields.io/badge/Version-0.1.0--dev-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0-dev](https://img.shields.io/badge/AppVersion-0.1.0--dev-informational?style=flat-square)

Antrea Network Flow Visibility

**Homepage:** <https://antrea.io/>

## Source Code

* <https://github.com/antrea-io/theia>

## Requirements

Kubernetes: `>= 1.16.0-0`

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| clickhouse.httpPort | int | `8123` | HTTP port number for the ClickHouse service. |
| clickhouse.monitorImage | object | `{"pullPolicy":"IfNotPresent","repository":"projects.registry.vmware.com/antrea/theia-clickhouse-monitor","tag":"latest"}` | Container image to use for the ClickHouse Monitor. |
| clickhouse.password | string | `"clickhouse_operator_password"` | ClickHouse password. It will be stored in a secret. |
| clickhouse.storageSize | string | `"8Gi"` | ClickHouse storage size. Can be a plain integer or as a fixed-point number using one of these quantity suffixes: E, P, T, G, M, K. Or the power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki. |
| clickhouse.tcpPort | int | `9000` | TCP port number for the ClickHouse service. |
| clickhouse.ttl | int | `3600` | Time to live in seconds for data in the ClickHouse. |
| clickhouse.username | string | `"clickhouse_operator"` | ClickHouse username. It will be stored in a secret. |
| grafana.password | string | `"admin"` | Grafana password. It will be stored in a secret. |
| grafana.tcpPort | int | `3000` | TCP port number for the Grafana service. |
| grafana.username | string | `"admin"` | Grafana username. It will be stored in a secret. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.7.0](https://github.com/norwoodj/helm-docs/releases/v1.7.0)
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ clickhouse client -n -h 127.0.0.1 <<-EOSQL
trusted UInt8 DEFAULT 0
) engine=MergeTree
ORDER BY (timeInserted, flowEndSeconds)
TTL timeInserted + INTERVAL 1 HOUR
SETTINGS merge_with_ttl_timeout = 3600;
TTL timeInserted + INTERVAL {{ .Values.clickhouse.ttl }} SECOND
SETTINGS merge_with_ttl_timeout = {{ .Values.clickhouse.ttl }};
CREATE MATERIALIZED VIEW flows_pod_view
ENGINE = SummingMergeTree
Expand All @@ -86,8 +86,8 @@ clickhouse client -n -h 127.0.0.1 <<-EOSQL
flowType,
sourcePodNamespace,
destinationPodNamespace)
TTL timeInserted + INTERVAL 1 HOUR
SETTINGS merge_with_ttl_timeout = 3600
TTL timeInserted + INTERVAL {{ .Values.clickhouse.ttl }} SECOND
SETTINGS merge_with_ttl_timeout = {{ .Values.clickhouse.ttl }}
POPULATE
AS SELECT
timeInserted,
Expand Down Expand Up @@ -132,8 +132,8 @@ clickhouse client -n -h 127.0.0.1 <<-EOSQL
destinationNodeName,
sourcePodNamespace,
destinationPodNamespace)
TTL timeInserted + INTERVAL 1 HOUR
SETTINGS merge_with_ttl_timeout = 3600
TTL timeInserted + INTERVAL {{ .Values.clickhouse.ttl }} SECOND
SETTINGS merge_with_ttl_timeout = {{ .Values.clickhouse.ttl }}
POPULATE
AS SELECT
timeInserted,
Expand Down Expand Up @@ -176,8 +176,8 @@ clickhouse client -n -h 127.0.0.1 <<-EOSQL
ingressNetworkPolicyRuleAction,
sourcePodNamespace,
destinationPodNamespace)
TTL timeInserted + INTERVAL 1 HOUR
SETTINGS merge_with_ttl_timeout = 3600
TTL timeInserted + INTERVAL {{ .Values.clickhouse.ttl }} SECOND
SETTINGS merge_with_ttl_timeout = {{ .Values.clickhouse.ttl }}
POPULATE
AS SELECT
timeInserted,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ datasources:
- name: ClickHouse
type: grafana-clickhouse-datasource
access: proxy
url: http://clickhouse-clickhouse.flow-visibility.svc:8123
url: http://clickhouse-clickhouse.{{ .Release.Namespace }}.svc:{{ .Values.clickhouse.httpPort }}
editable: true
jsonData:
server: clickhouse-clickhouse.flow-visibility.svc
port: 9000
server: clickhouse-clickhouse.{{ .Release.Namespace }}.svc
port: {{ .Values.clickhouse.tcpPort }}
username: $CLICKHOUSE_USERNAME
secureJsonData:
password: $CLICKHOUSE_PASSWORD
1 change: 1 addition & 0 deletions build/charts/theia/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The Theia has been successfully installed.
Empty file.
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
apiVersion: v1
kind: Secret
metadata:
name: clickhouse-secret
type: Opaque
stringData:
username: clickhouse_operator
password: clickhouse_operator_password
---
apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
name: clickhouse
labels:
app: clickhouse
namespace: {{ .Release.Namespace }}
spec:
configuration:
users:
clickhouse_operator/k8s_secret_password: flow-visibility/clickhouse-secret/password
clickhouse_operator/networks/ip: "::/0"
{{ .Values.clickhouse.username }}/k8s_secret_password: {{ .Release.Namespace }}/clickhouse-secret/password
{{ .Values.clickhouse.username }}/networks/ip: "::/0"
clusters:
- name: "clickhouse"
layout:
Expand All @@ -33,9 +25,9 @@ spec:
spec:
ports:
- name: http
port: 8123
port: {{ .Values.clickhouse.httpPort }}
- name: tcp
port: 9000
port: {{ .Values.clickhouse.tcpPort }}
podTemplates:
- name: pod-template
spec:
Expand All @@ -48,7 +40,7 @@ spec:
- name: clickhouse-storage-volume
mountPath: /var/lib/clickhouse
- name: clickhouse-monitor
image: clickhouse-monitor
image: {{ .Values.clickhouse.monitorImage.repository }}:{{ .Values.clickhouse.monitorImage.tag }}
env:
- name: CLICKHOUSE_USERNAME
valueFrom:
Expand All @@ -66,11 +58,12 @@ spec:
value: "default.flows"
- name: MV_NAMES
value: "default.flows_pod_view default.flows_node_view default.flows_policy_view"
imagePullPolicy: {{ .Values.clickhouse.monitorImage.pullPolicy }}
volumes:
- name: clickhouse-configmap-volume
configMap:
name: $(CLICKHOUSE_CONFIG_MAP_NAME)
name: clickhouse-mounted-configmap
- name: clickhouse-storage-volume
emptyDir:
medium: Memory
sizeLimit: 8Gi
sizeLimit: {{ .Values.clickhouse.storageSize }}
8 changes: 8 additions & 0 deletions build/charts/theia/templates/clickhouse/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: clickhouse-mounted-configmap
namespace: {{ .Release.Namespace }}
data:
create_table.sh: |-
{{ tpl (.Files.Get "provisioning/datasources/create_table.sh") . | indent 4}}
9 changes: 9 additions & 0 deletions build/charts/theia/templates/clickhouse/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
name: clickhouse-secret
namespace: {{ .Release.Namespace }}
type: Opaque
stringData:
username: {{ .Values.clickhouse.username }}
password: {{ .Values.clickhouse.password }}
7 changes: 7 additions & 0 deletions build/charts/theia/templates/grafana/dashboard-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-dashboard-config
namespace: {{ .Release.Namespace }}
data:
{{ (.Files.Glob "provisioning/dashboards/*.json").AsConfig | indent 2}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-dashboard-provider
namespace: {{ .Release.Namespace }}
data:
dashboard_provider.yaml: |-
{{ .Files.Get "provisioning/dashboards/dashboard_provider.yaml" | indent 4}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-datasource-provider
namespace: {{ .Release.Namespace }}
data:
datasource_provider.yaml: |-
{{ tpl (.Files.Get "provisioning/datasources/datasource_provider.yaml") . | indent 4}}
Loading

0 comments on commit f12780d

Please sign in to comment.