Skip to content

Commit

Permalink
Helm discovery changes - Review (#58)
Browse files Browse the repository at this point in the history
* Helm chart changes to support Kubernetes Discovery module (Job/CronJob)
  • Loading branch information
paliwalparitosh authored Feb 13, 2024
1 parent 3254c5d commit 00d53c5
Show file tree
Hide file tree
Showing 10 changed files with 292 additions and 292 deletions.
19 changes: 19 additions & 0 deletions charts/common/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) 2023, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.

{{- if eq (include "common.createServiceAccount" .) "true" }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "common.resourceNamePrefix" . }}
namespace: {{ include "common.namespace" . }}
rules:
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["create"]
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "patch"]
resourceNames: ["{{ include "common.resourceNamePrefix" . }}-discovery-state-tracker"]
{{- end }}
19 changes: 19 additions & 0 deletions charts/common/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) 2023, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.

{{- if eq (include "common.createServiceAccount" .) "true" }}
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "common.resourceNamePrefix" . }}
namespace: {{ include "common.namespace" . }}
roleRef:
kind: Role
name: {{ include "common.resourceNamePrefix" . }}
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: {{ include "common.resourceNamePrefix" . }}
namespace: {{ include "common.namespace" . }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/logan/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apiVersion: v2
name: oci-onm-logan
description: Charts for sending Kubernetes platform logs, compute logs, and Kubernetes Objects information to OCI Logging Analytics.
type: application
version: 3.2.2
version: 3.3.0
appVersion: "3.0.0"

dependencies:
Expand Down
141 changes: 141 additions & 0 deletions charts/logan/templates/discovery-cronjob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{{- $authtype := .Values.authtype | lower }}
{{- $resourceNamePrefix := .Values.global.resourceNamePrefix }}
{{- $kubernetesClusterName := (include "logan.kubernetesClusterName" .) }}
{{- $kubernetesClusterId := (include "logan.kubernetesClusterId" .) }}
{{- $kubernetesNamespace := (include "logan.namespace" .) }}
{{- $serviceAccount := (include "logan.serviceAccount" .) }}
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ .Values.global.resourceNamePrefix }}-discovery
namespace: {{ $kubernetesNamespace }}
spec:
schedule: {{ .Values.k8sDiscovery.objects.cronSchedule | quote }}
startingDeadlineSeconds: 120
concurrencyPolicy: Replace
successfulJobsHistoryLimit: {{ .Values.k8sDiscovery.objects.successfulJobsHistoryLimit }}
failedJobsHistoryLimit: {{ .Values.k8sDiscovery.objects.failedJobsHistoryLimit }}
jobTemplate:
spec:
backoffLimit: 2
template:
spec:
restartPolicy: {{ .Values.k8sDiscovery.objects.restartPolicy }}
serviceAccountName: {{ $serviceAccount }}
containers:
- name: k8-discovery-job
image: {{ .Values.image.url }}
{{- if eq $authtype "config" }}
volumeMounts:
- name: ociconfigdir
mountPath: {{ .Values.oci.path }}
readOnly: true
{{- end }}
command:
{{- /* object discovery script */}}
- oci-logan-kubernetes-discovery
{{- /* mandatory inputs */}}
- --kubernetes_cluster_id
- {{ $kubernetesClusterId }}
- --kubernetes_cluster_name
- {{ $kubernetesClusterName }}
- --kubernetes_cluster_namespace
- {{ $kubernetesNamespace }}
- --oci_la_namespace
{{- if .Values.ociLANamespace }}
- {{ .Values.ociLANamespace }}
{{- else }}
{{- required "ociLANamespace is required" .Values.ociLANamespace }}
{{- end }}
- --oci_la_log_group_id
{{- if .Values.k8sDiscovery.objects.ociLALogGroupID }}
- {{ .Values.k8sDiscovery.objects.ociLALogGroupID }}
{{- else if .Values.ociLALogGroupID }}
- {{ .Values.ociLALogGroupID }}
{{- else }}
{{- required "ociLALogGroupID is required" .Values.ociLALogGroupID }}
{{- end }}
{{- /* mandatory inputs when authtype is set as config */}}
{{- if eq .Values.authtype "config" }}
{{- if and .Values.oci.path .Values.oci.file }}
- --config_file_location
- {{ .Values.oci.path -}}/{{ .Values.oci.file }}
{{- else }}
{{- required "{{ .Values.oci.path -}}/{{ .Values.oci.file }} is required" .Values.oci.path }}
{{- end }}
{{- end }}
{{- /* optional discovery job configuration */}}
{{- if and .Values.ociLAClusterEntityID $resourceNamePrefix }}
- --oci_la_cluster_entity_id
- {{ .Values.ociLAClusterEntityID }}
- --kubernetes_resourcename_prefix
- {{ $resourceNamePrefix }}
{{- end }}
{{- if .Values.k8sDiscovery.objects.discoveryMode }}
- --discovery
- {{ .Values.k8sDiscovery.objects.discoveryMode }}
{{- end }}
{{- if .Values.k8sDiscovery.objects.log_format }}
- --log_format
- {{ .Values.k8sDiscovery.objects.log_format }}
{{- end }}
{{- if .Values.k8sDiscovery.objects.log_level }}
- --log_level
- {{ .Values.k8sDiscovery.objects.log_level }}
{{- end }}
{{- if and .Values.k8sDiscovery.objects.enable_threading .Values.k8sDiscovery.objects.thread_count }}
- --enable_threading
- --thread_count
- {{ .Values.k8sDiscovery.objects.thread_count | quote }}
{{- end }}
{{- if .Values.k8sDiscovery.objects.chunk_limit }}
- --chunk_limit
- {{ .Values.k8sDiscovery.objects.chunk_limit | quote }}
{{- end }}
{{- if .Values.k8sDiscovery.objects.collect_warning_events_only }}
- --collect_warning_events_only
{{- end }}
{{- /* optional kubernetes cluster configuration */}}
{{- if .Values.k8sDiscovery.kubeClientOptions.kubernetes_url }}
- --kubernetes_url
- {{ .Values.k8sDiscovery.kubeClientOptions.kubernetes_url }}
{{- end }}
{{- if .Values.k8sDiscovery.kubeClientOptions.client_cert }}
- --client_cert
- {{ .Values.k8sDiscovery.kubeClientOptions.client_cert }}
{{- end }}
{{- if .Values.k8sDiscovery.kubeClientOptions.client_key }}
- --client_key
- {{ .Values.k8sDiscovery.kubeClientOptions.client_key }}
{{- end }}
{{- if .Values.k8sDiscovery.kubeClientOptions.ca_file }}
- --ca_file
- {{ .Values.k8sDiscovery.kubeClientOptions.ca_file }}
{{- end }}
{{- if eq .Values.k8sDiscovery.kubeClientOptions.verify_ssl true }}
- --verify_ssl
{{- end }}
{{- if .Values.k8sDiscovery.kubeClientOptions.bearer_token_file }}
- --bearer_token_file
- {{ .Values.k8sDiscovery.kubeClientOptions.bearer_token_file }}
{{- end }}
{{- if .Values.k8sDiscovery.kubeClientOptions.secret_dir }}
- --secret_dir
- {{ .Values.k8sDiscovery.kubeClientOptions.secret_dir }}
{{- end }}
{{- /* developer options - optional */}}
{{- if .Values.k8sDiscovery.oci_la_endpoint }}
- --endpoint
- {{ .Values.k8sDiscovery.oci_la_endpoint }}
{{- else if .Values.ociLAEndpoint }}
- --endpoint
- {{ .Values.ociLAEndpoint }}
{{- end }}
{{- if eq $authtype "config" }}
volumes:
- name: ociconfigdir
projected:
sources:
- secret:
name: {{ $resourceNamePrefix }}-oci-config
{{- end }}
108 changes: 0 additions & 108 deletions charts/logan/templates/fluentd-deployment.yaml

This file was deleted.

Loading

0 comments on commit 00d53c5

Please sign in to comment.