-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Helm support for Theia with ClickHouse PV #15
Conversation
build/charts/theia/values.yaml
Outdated
# -- HTTP port number for the ClickHouse service. | ||
httpPort: 8123 | ||
# -- TCP port number for the ClickHouse service. | ||
tcpPort: 9000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it sometimes make sense to disable one of the ports to only use HTTP or TCP?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the Flow Aggregator uses TCP to connect the ClickHouse while Grafana uses HTTP for connection. Thus it might not have a use case to disable one of them.
This PR is converted to draft to add PV supports and some more customizations. |
9e38a79
to
fa14676
Compare
Hi @antoninbas I have added the ClickHouse PV support and some more customizations in this PR. I also have several topics regarding Helm support in Theia to bring up. I would like to hear from your options on these topics.
also cc @salv-orlando @dreamtalen @heanlan @wsquan171 |
|
3829d9c
to
a6bdc16
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seem to be some changes not related to helm charts - can we have distinct PRs for those?
VERSION
Outdated
@@ -1 +1 @@ | |||
v1.7.0-dev | |||
v0.1.0-dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these changes make a lot of sense, but I'd create separate PRs for those
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I remove it from this PR.
|
||
CREATE MATERIALIZED VIEW flows_pod_view | ||
CREATE MATERIALIZED VIEW IF NOT EXISTS flows_pod_view |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also seems a change not related to helm charts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is related to the ClickHouse PV support. PV support is also added into this PR as
- There are only a few customization variables before we add PV support
- PV support contents have been reviewed at Antrea side. Adding PV to this PR mainly requires reviews on the Helm related contents.
b95f5d2
to
4cf09f8
Compare
c27684b
to
abd0628
Compare
Thanks @antoninbas ! This PR is updated and ready for review now. Here is the update on the topic we have discussed above.
|
Thanks @wsquan171 for pointing out this. Yes, by putting it under But I also understand your concern about what if we add our own CRDs. I think these CRDs are under the similar conditions mentioned in the Antrea issue antrea-io/antrea#3665 . These CRDs are kept as Template in Antrea chart now. Basically there are two strategies to treat the ClickHouse Operator:
I'd also like to have @antoninbas option on this. |
docs/network-flow-visibility.md
Outdated
@@ -230,6 +258,8 @@ Collector in production. | |||
|
|||
#### ClickHouse Configuration | |||
|
|||
##### Service Customization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A general comment on all of the original configuration instructions: If we keep all these original configuration instructions for users who don't to use Helm, can we write it explicitly in the doc, with something like: for all of the configurations, option 1 - with Helm, edit values.yaml, option 2 - without Helm, edit flow-visibility.yml directly.
Otherwise it seems a bit confusing to me, if we recommend using Helm to template yaml, and we also recommend making a series of configurations directly on flow-visibility.yml in the meanwhile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I make an update on the document, hope it clearer now.
79d3753
to
3074158
Compare
Hi @antoninbas Could you take another look at this PR? |
build/charts/theia/values.yaml
Outdated
# one of these unit suffixes SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, | ||
# YEAR. | ||
ttl: 1 HOUR | ||
persistentVolume: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this whole section can be a bit confusing, because it conflates some things, like PV type & storage class provisioner, and doesn't clearly distinguish between manual volume provisioning and dynamic volume provisioning.
It seems that there is also no option for users to provide a custom PersistentVolume (if they don't want to use dynamic provisioning).
storage:
size: "8Gi"
createPersistentVolume:
# can be set to "Local" or "NFS"
type: ""
local:
path: "/data"
nfs:
host: ""
path: ""
# ignored if persistentVolume.type is non-empty
persistentVolumeClaimSpec: {}
# storageClassName: ""
# volumeName:
By default, memory storage is used.
To use a local volume created by us, one can set:
storage.createPersistentVolume.type = "Local"
To use a custom PersistentVolume, one can set:
storage.persistentVolumeClaimSpec:
storageClassName: ""
volumeName: "<my-pv>"
To dynamically provision a PersistentVolume, one can set:
storage.persistentVolumeClaimSpec
storageClassName: <"my-storage-class">
Let me know what you think of that solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think PersistentVolumeClaim does not accept PV name as a specification. As introduced in K8S doc, I think it means
- If storageClassName is specified, PVC will look for PV in the cluster with that class
- If storageClassName is set to "", PVC will look for PV with no class
From my experience, if users don't want to use dynamic provisioning, they could set StorageClass to "" or create a StorageClass with kubernetes.io/no-provisioner
as provisioner, and make sure the corresponding PV is created manually.
We can still adopt the solution, with the storage.persistentVolumeClaimSpec
only expecting storageClassName
. Memory storage will be used when storage.createPersistentVolume.type
is "" and storage.persistentVolumeClaimSpec
is empty. But I'm not sure whether this change is still good enough as it might still not clearly distinguish between manual volume provisioning and dynamic volume provisioning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 3 cases for storageClassName: set, omitted and set to empty
I do think it is possible to manually bind to a PV with the volumeName
field: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#reserving-a-persistentvolume
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed this. Thanks! The storage section is refactored now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM.
Due to operations done in this PR on Grafana's clickhouse queries - mostly replacing namespace name with variable, I suggest to merge PR #12 , and then rebase this one.
displayName: Theia | ||
home: https://antrea.io/ | ||
version: 0.1.0-dev | ||
appVersion: 0.1.0-dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to update these before we release?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I think we will need to update these in the release branch.
"rawQuery": "SELECT SUM(octetDeltaCount), (sourcePodName, destinationIP) AS pair\nFROM default.flows_pod_view\nWHERE flowEndSeconds >= toDateTime(1642534343) AND flowEndSeconds <= toDateTime(1642536143)\nAND flowType == 3\nAND sourcePodNamespace NOT IN ('kube-system', 'flow-aggregator', 'flow-visibility')\nGROUP BY pair", | ||
"rawSql": "select SUM(octetDeltaCount) as bytes, sourcePodName as source, destinationIP as destination\nFrom flows_pod_view\nWHERE flowType == 3\nAND sourcePodNamespace NOT IN ('kube-system', 'flow-visibility', 'flow-aggregator')\nAND $__timeFilter(flowEndSeconds)\nGROUP BY source, destination\nHAVING bytes != 0", | ||
"rawQuery": "SELECT SUM(octetDeltaCount), (sourcePodName, destinationIP) AS pair\nFROM default.flows_pod_view\nWHERE flowEndSeconds >= toDateTime(1642534343) AND flowEndSeconds <= toDateTime(1642536143)\nAND flowType == 3\nAND sourcePodNamespace NOT IN ('kube-system', 'flow-aggregator', '{{ .Release.Namespace }}')\nGROUP BY pair", | ||
"rawSql": "select SUM(octetDeltaCount) as bytes, sourcePodName as source, destinationIP as destination\nFrom flows_pod_view\nWHERE flowType == 3\nAND sourcePodNamespace NOT IN ('kube-system', '{{ .Release.Namespace }}', 'flow-aggregator')\nAND $__timeFilter(flowEndSeconds)\nGROUP BY source, destination\nHAVING bytes != 0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As PR #12 is making some changes to query, we might want to merge that one, rebase this PR, and then make sure {{ .Release.Namespace }}
is used in every query in place of flow-visibility
| clickhouse.storage.createPersistentVolume.type | string | `""` | Type of PersistentVolume. Can be set to "Local" or "NFS". Please set this value to use a PersistentVolume created by Theia. | | ||
| clickhouse.storage.persistentVolumeClaimSpec | string | `nil` | Specification for PersistentVolumeClaim. This is ignored if createPersistentVolume.type is non-empty. To use a custom PersistentVolume, please set storageClassName: "" volumeName: "<my-pv>" To dynamically provision a PersistentVolume, please set storageClassName: "<my-storage-class>" Memory storage is used if both createPersistentVolume.type and persistentVolumeClaimSpec are empty. | | ||
| clickhouse.storage.size | 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.ttl | string | `"1 HOUR"` | Time to live for data in the ClickHouse. Can be a plain integer using one of these unit suffixes SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we support small intervals, such as second? Seems it is hard to do anything if the ttl is set at second level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are units supported by ClickHouse. I think keeping it may be useful for users who prefer to use the small units like 3600 SECOND instead of 1 HOUR.
@@ -14,6 +14,16 @@ | |||
# See the License for the specific language governing permissions and | |||
# limitations under the License. | |||
|
|||
{{- $ttl := split " " .Values.clickhouse.ttl }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For DAY, WEEK, MONTH, QUARTER, YEAR, we do not have any mapping here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This map is only used to set merge_with_ttl_timeout
. This value only requires to be set when TTL is under merge_with_ttl_timeout
default value, 14400 (seconds). TTL does not need map as Interval is supported by the ClickHouse.
Thanks @salv-orlando This PR is rebased now. Would you like to take another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some minor comments, otherwise LGTM
hack/generate-manifest.sh
Outdated
$KUSTOMIZE edit set image clickhouse-monitor=projects.registry.vmware.com/antrea/theia-clickhouse-monitor:latest | ||
$KUSTOMIZE edit add patch --path imagePullPolicy.yml --group clickhouse.altinity.com --version v1 --kind ClickHouseInstallation --name clickhouse | ||
fi | ||
HELM_TMP_DIR=$(mktemp -d $THIS_DIR/../build/yamls/chart-values.XXXXXXXX) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't seem to be using this anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed unused tmp dir. Thanks!
build/yamls/base/kustomization.yaml
Outdated
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
namespace: flow-visibility | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: why the empty line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
hack/generate-manifest.sh
Outdated
2> >(grep -v 'This is insecure' >&2)\ | ||
> $MANIFEST | ||
|
||
# Add flow-visibility Namespace resource by Kustomize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Add flow-visibility Namespace resource by Kustomize | |
# Add flow-visibility Namespace resource with Kustomize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
build/charts/theia/values.yaml
Outdated
secret: | ||
# -- ClickHouse username. It will be stored in a secret. | ||
username: "clickhouse_operator" | ||
# -- ClickHouse password. It will be stored in a secret. | ||
password: "clickhouse_operator_password" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume that these 2 fields will be stored in the same secret, and not 2 separate secrets?
I suggest changing this to:
# -- Credentials to connect to ClickHouse. They will be stored in a secret.
connectionSecret:
username : "clickhouse_operator"
password: "clickhouse_operator_password"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. They are in one secret. Updated the value.
build/charts/theia/values.yaml
Outdated
secret: | ||
# -- Grafana username. It will be stored in a secret. | ||
username: "admin" | ||
# -- Grafana password. It will be stored in a secret. | ||
password: "admin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
build/charts/theia/values.yaml
Outdated
repository: "projects.registry.vmware.com/antrea/theia-grafana" | ||
pullPolicy: "IfNotPresent" | ||
tag: "8.3.3" | ||
# -- Credentials to login Grafana. They will be stored in a secret. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
login to Grafana
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. Thanks!
Signed-off-by: Yanjun Zhou <[email protected]>
This PR adds Helm chart for Theia and uses Helm templates instead of Kustomize to generate Theia manifest.
Signed-off-by: Yanjun Zhou [email protected]