diff --git a/charts/vela-core/README.md b/charts/vela-core/README.md index d78a6dd4a..e16f423c1 100644 --- a/charts/vela-core/README.md +++ b/charts/vela-core/README.md @@ -102,23 +102,25 @@ helm install --create-namespace -n vela-system kubevela kubevela/vela-core --wai ### MultiCluster parameters -| Name | Description | Value | -| ----------------------------------------------------------- | ------------------------------------------------------------------------------------------- | -------------------------------- | -| `multicluster.enabled` | Whether to enable multi-cluster | `true` | -| `multicluster.metrics.enabled` | Whether to enable multi-cluster metrics collect | `false` | -| `multicluster.clusterGateway.direct` | controller will connect to ClusterGateway directly instead of going to Kubernetes APIServer | `true` | -| `multicluster.clusterGateway.replicaCount` | ClusterGateway replica count | `1` | -| `multicluster.clusterGateway.port` | ClusterGateway port | `9443` | -| `multicluster.clusterGateway.image.repository` | ClusterGateway image repository | `oamdev/cluster-gateway` | -| `multicluster.clusterGateway.image.tag` | ClusterGateway image tag | `v1.9.0-alpha.2` | -| `multicluster.clusterGateway.image.pullPolicy` | ClusterGateway image pull policy | `IfNotPresent` | -| `multicluster.clusterGateway.resources.requests.cpu` | ClusterGateway cpu request | `50m` | -| `multicluster.clusterGateway.resources.requests.memory` | ClusterGateway memory request | `20Mi` | -| `multicluster.clusterGateway.resources.limits.cpu` | ClusterGateway cpu limit | `500m` | -| `multicluster.clusterGateway.resources.limits.memory` | ClusterGateway memory limit | `200Mi` | -| `multicluster.clusterGateway.secureTLS.enabled` | Whether to enable secure TLS | `true` | -| `multicluster.clusterGateway.secureTLS.certPath` | Path to the certificate file | `/etc/k8s-cluster-gateway-certs` | -| `multicluster.clusterGateway.secureTLS.certManager.enabled` | Whether to enable cert-manager | `false` | +| Name | Description | Value | +| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | -------------------------------- | +| `multicluster.enabled` | Whether to enable multi-cluster | `true` | +| `multicluster.metrics.enabled` | Whether to enable multi-cluster metrics collect | `false` | +| `multicluster.clusterGateway.direct` | controller will connect to ClusterGateway directly instead of going to Kubernetes APIServer | `true` | +| `multicluster.clusterGateway.replicaCount` | ClusterGateway replica count | `1` | +| `multicluster.clusterGateway.port` | ClusterGateway port | `9443` | +| `multicluster.clusterGateway.image.repository` | ClusterGateway image repository | `oamdev/cluster-gateway` | +| `multicluster.clusterGateway.image.tag` | ClusterGateway image tag | `v1.9.0-alpha.2` | +| `multicluster.clusterGateway.image.pullPolicy` | ClusterGateway image pull policy | `IfNotPresent` | +| `multicluster.clusterGateway.resources.requests.cpu` | ClusterGateway cpu request | `50m` | +| `multicluster.clusterGateway.resources.requests.memory` | ClusterGateway memory request | `20Mi` | +| `multicluster.clusterGateway.resources.limits.cpu` | ClusterGateway cpu limit | `500m` | +| `multicluster.clusterGateway.resources.limits.memory` | ClusterGateway memory limit | `200Mi` | +| `multicluster.clusterGateway.secureTLS.enabled` | Whether to enable secure TLS | `true` | +| `multicluster.clusterGateway.secureTLS.certPath` | Path to the certificate file | `/etc/k8s-cluster-gateway-certs` | +| `multicluster.clusterGateway.secureTLS.certManager.enabled` | Whether to enable cert-manager | `false` | +| `multicluster.clusterGateway.serviceMonitor.enabled` | Whether to enable service monitor | `false` | +| `multicluster.clusterGateway.serviceMonitor.additionalLabels` | Additional labels for service monitor | `{}` | ### Test parameters @@ -131,29 +133,32 @@ helm install --create-namespace -n vela-system kubevela kubevela/vela-core --wai ### Common parameters -| Name | Description | Value | -| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------- | -| `imagePullSecrets` | Image pull secrets | `[]` | -| `nameOverride` | Override name | `""` | -| `fullnameOverride` | Fullname override | `""` | -| `serviceAccount.create` | Specifies whether a service account should be created | `true` | -| `serviceAccount.annotations` | Annotations to add to the service account | `{}` | -| `serviceAccount.name` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | `nil` | -| `nodeSelector` | Node selector | `{}` | -| `tolerations` | Tolerations | `[]` | -| `affinity` | Affinity | `{}` | -| `rbac.create` | Specifies whether a RBAC role should be created | `true` | -| `logDebug` | Enable debug logs for development purpose | `false` | -| `logFilePath` | If non-empty, write log files in this path | `""` | -| `logFileMaxSize` | Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. | `1024` | -| `kubeClient.qps` | The qps for reconcile clients | `400` | -| `kubeClient.burst` | The burst for reconcile clients | `600` | -| `authentication.enabled` | Enable authentication for application | `false` | -| `authentication.withUser` | Application authentication will impersonate as the request User | `true` | -| `authentication.defaultUser` | Application authentication will impersonate as the User if no user provided in Application | `kubevela:vela-core` | -| `authentication.groupPattern` | Application authentication will impersonate as the request Group that matches the pattern | `kubevela:*` | -| `sharding.enabled` | When sharding enabled, the controller will run as master mode. Refer to https://github.com/kubevela/kubevela/blob/master/design/vela-core/sharding.md for details. | `false` | -| `sharding.schedulableShards` | The shards available for scheduling. If empty, dynamic discovery will be used. | `""` | +| Name | Description | Value | +| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------- | +| `imagePullSecrets` | Image pull secrets | `[]` | +| `nameOverride` | Override name | `""` | +| `fullnameOverride` | Fullname override | `""` | +| `serviceAccount.create` | Specifies whether a service account should be created | `true` | +| `serviceAccount.annotations` | Annotations to add to the service account | `{}` | +| `serviceAccount.name` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | `nil` | +| `nodeSelector` | Node selector | `{}` | +| `tolerations` | Tolerations | `[]` | +| `affinity` | Affinity | `{}` | +| `rbac.create` | Specifies whether a RBAC role should be created | `true` | +| `logDebug` | Enable debug logs for development purpose | `false` | +| `logFilePath` | If non-empty, write log files in this path | `""` | +| `logFileMaxSize` | Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. | `1024` | +| `kubeClient.qps` | The qps for reconcile clients | `400` | +| `kubeClient.burst` | The burst for reconcile clients | `600` | +| `authentication.enabled` | Enable authentication for application | `false` | +| `authentication.withUser` | Application authentication will impersonate as the request User | `true` | +| `authentication.defaultUser` | Application authentication will impersonate as the User if no user provided in Application | `kubevela:vela-core` | +| `authentication.groupPattern` | Application authentication will impersonate as the request Group that matches the pattern | `kubevela:*` | +| `sharding.enabled` | When sharding enabled, the controller will run as master mode. Refer to https://github.com/kubevela/kubevela/blob/master/design/vela-core/sharding.md for details. | `false` | +| `sharding.schedulableShards` | The shards available for scheduling. If empty, dynamic discovery will be used. | `""` | +| `core.metrics.enabled` | Enable metrics for vela-core | `false` | +| `core.metrics.serviceMonitor.enabled` | Enable service monitor for metrics | `false` | +| `core.metrics.serviceMonitor.additionalLabels` | Additional labels for service monitor | `{}` | ## Uninstallation diff --git a/charts/vela-core/templates/cluster-gateway/cluster-gateway.yaml b/charts/vela-core/templates/cluster-gateway/cluster-gateway.yaml index 09149e661..c02d85ec0 100644 --- a/charts/vela-core/templates/cluster-gateway/cluster-gateway.yaml +++ b/charts/vela-core/templates/cluster-gateway/cluster-gateway.yaml @@ -124,6 +124,7 @@ spec: - protocol: TCP port: {{ .Values.multicluster.clusterGateway.port }} targetPort: {{ .Values.multicluster.clusterGateway.port }} + name: default --- # 1. Check whether APIService ""v1alpha1.cluster.core.oam.dev" is already present in the cluster # 2.a If the APIService doesn't exist, create it. diff --git a/charts/vela-core/templates/kubevela-controller.yaml b/charts/vela-core/templates/kubevela-controller.yaml index 43f34c6f2..f53dfc8f8 100644 --- a/charts/vela-core/templates/kubevela-controller.yaml +++ b/charts/vela-core/templates/kubevela-controller.yaml @@ -399,3 +399,82 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} + + +{{- if and (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") .Values.core.metrics.enabled }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "kubevela.fullname" . }}-metrics + namespace: {{ .Release.Namespace }} + labels: + component: vela-core-controller +spec: + ports: + - name: http + protocol: TCP + port: 9443 + targetPort: 9443 + - name: metrics + protocol: TCP + port: 8080 + targetPort: 8080 + selector: + {{- include "kubevela.selectorLabels" . | nindent 4 }} + {{ if .Values.sharding.enabled }} + controller.core.oam.dev/shard-id: master + {{ end }} +{{- end -}} + +{{- if and (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") .Values.core.metrics.enabled .Values.core.metrics.serviceMonitor.enabled }} +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "kubevela.fullname" . }}-metrics + namespace: {{ .Release.Namespace }} + labels: + {{- with .Values.core.metrics.serviceMonitor.additionalLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + endpoints: + - honorLabels: true + interval: 10s + path: /metrics + port: metrics + scheme: http + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} + selector: + matchLabels: + component: vela-core-controller +{{- end -}} + +{{- if and (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") .Values.multicluster.metrics.enabled .Values.multicluster.clusterGateway.serviceMonitor.enabled }} +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "kubevela.fullname" . }}-cluster-gateway-metrics + namespace: {{ .Release.Namespace }} + labels: + {{- with .Values.multicluster.clusterGateway.serviceMonitor.additionalLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + endpoints: + - honorLabels: true + interval: 10s + path: /metrics + port: default + scheme: http + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} + selector: + matchLabels: + {{- include "kubevela-cluster-gateway.selectorLabels" . | nindent 4 }} +{{- end -}} diff --git a/charts/vela-core/values.yaml b/charts/vela-core/values.yaml index 6cec1ea7b..f90084640 100644 --- a/charts/vela-core/values.yaml +++ b/charts/vela-core/values.yaml @@ -158,12 +158,17 @@ featureGates: ## @param multicluster.clusterGateway.secureTLS.enabled Whether to enable secure TLS ## @param multicluster.clusterGateway.secureTLS.certPath Path to the certificate file ## @param multicluster.clusterGateway.secureTLS.certManager.enabled Whether to enable cert-manager +## @param multicluster.clusterGateway.serviceMonitor.enabled Whether to enable service monitor +## @param multicluster.clusterGateway.serviceMonitor.additionalLabels Additional labels for service monitor multicluster: enabled: true metrics: enabled: false clusterGateway: direct: true + serviceMonitor: + enabled: false + additionalLabels: { } replicaCount: 1 port: 9443 image: @@ -297,3 +302,13 @@ authentication: sharding: enabled: false schedulableShards: "" + +## @param core.metrics.enabled Enable metrics for vela-core +## @param core.metrics.serviceMonitor.enabled Enable service monitor for metrics +## @param core.metrics.serviceMonitor.additionalLabels Additional labels for service monitor +core: + metrics: + enabled: false + serviceMonitor: + enabled: false + additionalLabels: {} \ No newline at end of file