diff --git a/charts/scoop/Chart.yaml b/charts/scoop/Chart.yaml new file mode 100644 index 00000000..2705a83f --- /dev/null +++ b/charts/scoop/Chart.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +name: devtron-scoop +description: Chart to deploy scoop +type: application +version: 1.0.0 +appVersion: "1.16.0" +maintainers: +- email: devops@devtron.ai + name: Devops-Team DEVTRON + + diff --git a/charts/scoop/README.md b/charts/scoop/README.md new file mode 100644 index 00000000..559733df --- /dev/null +++ b/charts/scoop/README.md @@ -0,0 +1,23 @@ +## Introduction + Scoop is a feature of Devtron designed to enhance the management and monitoring of Kubernetes clusters. Its primary use cases include: + - **Monitoring Pod Restarts**: Track and view details of application pod restarts, including information on pods, restart events, previous container logs, and node status. + - **Event Tracking**: Observe and act on events across all Kubernetes resources in the cluster. + - **Resource Caching**: Cache Kubernetes resources in the target cluster to reduce API fetch times when accessing resources from the resource browser of Devtron. + +The following table lists the configurable parameters of the template Helm chart and their default values. + +| Parameter | Description | Default | +| ----------------------- | --------------------------------------------- | ---------------------------------------------------------- | +| `scoop.image` | Image of the scoop | `devtroninc.azurecr.io/scoop:187a41b0-629-25109` | +| `scoop.imagePullSecrets.existingImagePullSecret` | ImagePullsecret of the scoop Image | | +| `image.pullPolicy` | Image pull policy | `Always` | +| `scoopNamespace` | Namespace where scoop will be delpoyed | | +| `env.CLUSTER_ID` | The ID of the target cluster where Scoop will be implemented | | +| `env.ORCHESTRATOR_URL` | scoop will use this url to send the events , and that will be available in k8s watcher| | +| `env.TOKEN` | It will be used to authenticate while sending the events to the orchestrator| | +| `env.CACHED_NAMESPACE` | storing the cache of specified namespaces. | ` it will store the cache of all the namespaces` +| `service.type` | Kubernetes service type exposing port | `ClusterIP` | +| `service.port` | TCP Port for this service | 80 | + + + diff --git a/charts/scoop/templates/clusterrole.yaml b/charts/scoop/templates/clusterrole.yaml new file mode 100644 index 00000000..6d690904 --- /dev/null +++ b/charts/scoop/templates/clusterrole.yaml @@ -0,0 +1,31 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + annotations: + rbac.authorization.kubernetes.io/autoupdate: "true" + name: read-only-cluster-role-scoop +rules: +- apiGroups: + - '*' + resources: + - '*' + verbs: + - get + - list + - watch +- apiGroups: + - extensions + resources: + - '*' + verbs: + - get + - list + - watch +- apiGroups: + - apps + resources: + - '*' + verbs: + - get + - list + - watch \ No newline at end of file diff --git a/charts/scoop/templates/clusterrolebinding.yaml b/charts/scoop/templates/clusterrolebinding.yaml new file mode 100644 index 00000000..afd7752e --- /dev/null +++ b/charts/scoop/templates/clusterrolebinding.yaml @@ -0,0 +1,12 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: read-only-user-crb-scoop +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: read-only-cluster-role-scoop +subjects: +- kind: ServiceAccount + name: scoop-sa + namespace: {{ $.Values.scoopNamespace | default .Release.Namespace }} diff --git a/charts/scoop/templates/configmap.yaml b/charts/scoop/templates/configmap.yaml new file mode 100644 index 00000000..72ea8a34 --- /dev/null +++ b/charts/scoop/templates/configmap.yaml @@ -0,0 +1,15 @@ +{{- if $.Values.ConfigMap.enabled }} +{{- if $.Values.ConfigMap.data }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ $.Values.ConfigMap.name }} + namespace: {{ $.Values.scoopNamespace | default .Release.Namespace }} +data: +{{ toYaml $.Values.ConfigMap.data | indent 2 }} +{{- end }} +{{- end }} + + + + diff --git a/charts/scoop/templates/deployment.yml b/charts/scoop/templates/deployment.yml new file mode 100644 index 00000000..9f70ee77 --- /dev/null +++ b/charts/scoop/templates/deployment.yml @@ -0,0 +1,76 @@ + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: scoop-deployment + labels: + {{- if $.Values.labels }} +{{ toYaml $.Values.labels | nindent 4 }} + {{- end }} + namespace: {{ $.Values.scoopNamespace | default .Release.Namespace }} +spec: + selector: + matchLabels: + app: scoop + {{- if $.Values.scoop.replicaCount }} + replicas: {{ $.Values.scoop.replicaCount}} + {{- end }} + minReadySeconds: 60 + template: + metadata: + labels: + app: scoop + spec: + serviceAccountName: scoop-sa + terminationGracePeriodSeconds: 30 + {{- if $.Values.scoop.imagePullSecrets.existingImagePullSecret }} + imagePullSecrets: + - name: {{ $.Values.scoop.imagePullSecrets.existingImagePullSecret }} + {{- else }} + {{- if $.Values.scoop.imagePullSecrets.enabled }} + imagePullSecrets: + - name: scoop-imagepull-secret + {{- end }} + {{- end }} + restartPolicy: Always + {{- if $.Values.volumes }} + volumes: +{{ toYaml $.Values.volumes | indent 8 }} + {{- end }} + containers: + - name: scoop + image: {{ $.Values.scoop.image }} + imagePullPolicy: IfNotPresent + ports: + - name: app + containerPort: 8080 + protocol: TCP + {{- if $.Values.env }} + env: +{{ toYaml $.Values.env | indent 12 }} + {{- end }} + + {{- if or $.Values.ConfigMap.enabled $.Values.secrets.enabled }} + envFrom: + {{- if $.Values.ConfigMap.enabled }} + - configMapRef: + name: {{ $.Values.ConfigMap.name }} + {{- end }} + + {{- if $.Values.secrets.enabled }} + - secretRef: + name: {{ $.Values.secrets.name }} + {{- end }} + {{- end }} + + {{- if $.Values.resources }} + resources: +{{ toYaml $.Values.resources | indent 12 }} + {{- end }} + + {{- if $.Values.volumeMounts }} + volumeMounts: +{{ toYaml $.Values.volumeMounts | indent 12 }} + {{- end }} + revisionHistoryLimit: 3 + \ No newline at end of file diff --git a/charts/scoop/templates/secret.yaml b/charts/scoop/templates/secret.yaml new file mode 100644 index 00000000..7c7afade --- /dev/null +++ b/charts/scoop/templates/secret.yaml @@ -0,0 +1,28 @@ +{{- if and $.Values.secrets.enabled $.Values.secrets.data }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ $.Values.secrets.name }} + namespace: {{ $.Values.scoopNamespace | default .Release.Namespace }} +type: Opaque +data: +{{ toYaml $.Values.secrets.data | b64enc | indent 2 }} +{{- end }} +--- + +{{- if and $.Values.scoop.imagePullSecrets.enabled $.Values.scoop.imagePullSecrets.data.value }} +{{- if not $.Values.scoop.imagePullSecrets.existingImagePullSecret }} +apiVersion: v1 +kind: Secret +metadata: + name: scoop-imagepull-secret + namespace: {{ $.Values.scoopNamespace | default .Release.Namespace }} +type: kubernetes.io/dockerconfigjson +{{- if $.Values.scoop.imagePullSecrets.data}} +data: + .dockerconfigjson: {{ $.Values.scoop.imagePullSecrets.data.value | b64enc | quote }} +{{- end }} +{{- end }} +{{- end }} + + diff --git a/charts/scoop/templates/service.yaml b/charts/scoop/templates/service.yaml new file mode 100644 index 00000000..8d041074 --- /dev/null +++ b/charts/scoop/templates/service.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: Service +metadata: + name: scoop-service + labels: + app: scoop + {{- if $.Values.labels }} +{{ toYaml .Values.labels | indent 2 }} + {{- end }} + namespace: {{ $.Values.scoopNamespace | default .Release.Namespace }} +spec: + {{- if $.Values.service.type }} + type: {{ $.Values.service.type }} + {{- end }} + ports: + {{- if $.Values.service.port }} + - port: {{ $.Values.service.port }} + {{- end }} + targetPort: 8080 + protocol: TCP + name: app + selector: + app: scoop \ No newline at end of file diff --git a/charts/scoop/templates/serviceaccount.yaml b/charts/scoop/templates/serviceaccount.yaml new file mode 100644 index 00000000..81a49309 --- /dev/null +++ b/charts/scoop/templates/serviceaccount.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: scoop-sa + namespace: {{ $.Values.scoopNamespace | default .Release.Namespace }} + + + + + \ No newline at end of file diff --git a/charts/scoop/values.yaml b/charts/scoop/values.yaml new file mode 100644 index 00000000..c4539824 --- /dev/null +++ b/charts/scoop/values.yaml @@ -0,0 +1,80 @@ +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +scoopNamespace: "" +# namespace where all the resource will be created +service: + type: ClusterIP + port: 80 + +# If both existingImagePullSecret and imagePullSecrets are present, existingImagePullSecret will be given preference. +scoop: + replicaCount: 1 + image: "devtroninc.azurecr.io/scoop:187a41b0-629-25109" + imagePullSecrets: + existingImagePullSecret: "" + enabled: false + data: + value: "" + # value: '{"auths":{"https://index.docker.io/v1/":{"username":"example_user","password":"XXXXXXXXX"}}}' + ## When you are creating secret for docker hub please use below syntax keep values in single quote only + + +env: + - name: X-PASS-KEY + value: "random-string" + - name: PASS_KEY + value: "random-string" + # X_PASS_KEY and PASS_KEY (should be the same) are used for authentication + - name: RETENTION + value: "10080" + # Period for which cache will be stored + + # ID of the cluster where scoop needs to be implemented + - name: CLUSTER_ID + value: "" + + # URL to which scoop sends the metrics + - name: ORCHESTRATOR_URL + value: "" + + #token of the orchestrator url + - name: TOKEN + value: "" +#storing the cache of specified namespaces. If you do not specify it, by default, it will store the cache of all the namespaces. + + +ConfigMap: +# Set enabled to true if you want to pass any configMapSecret from configmap + name: scoop-config + enabled: false + data: [] + + + # Set enabled to true if you want to pass the values of secret.yaml from SecretRef +secrets: + name: scoop-secret + enabled: false + data: [] + +volumes: +# - name: log-volume +# emptyDir: {} + + +volumeMounts: [] +# - name: log-volume +# mountPath: /var/log + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + #limits: + #cpu: 1 + #memory: 200Mi + #requests: + #cpu: 0.10 + #memory: 100Mi + +