Skip to content
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

feat: Adding scoop helm chart #240

Merged
merged 15 commits into from
Sep 2, 2024
11 changes: 11 additions & 0 deletions charts/scoop/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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: [email protected]
name: Devops-Team DEVTRON


23 changes: 23 additions & 0 deletions charts/scoop/README.md
Original file line number Diff line number Diff line change
@@ -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 |



31 changes: 31 additions & 0 deletions charts/scoop/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -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:
- '*'

Check warning

Code scanning / SonarCloud

Wildcards should not be used to define RBAC permissions Medium

Do not use wildcards when defining RBAC permissions. See more on SonarCloud
verbs:
- get
- list
- watch
- apiGroups:
- extensions
resources:
- '*'

Check warning

Code scanning / SonarCloud

Wildcards should not be used to define RBAC permissions Medium

Do not use wildcards when defining RBAC permissions. See more on SonarCloud
verbs:
- get
- list
- watch
- apiGroups:
- apps
resources:
- '*'

Check warning

Code scanning / SonarCloud

Wildcards should not be used to define RBAC permissions Medium

Do not use wildcards when defining RBAC permissions. See more on SonarCloud
verbs:
- get
- list
- watch
12 changes: 12 additions & 0 deletions charts/scoop/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
15 changes: 15 additions & 0 deletions charts/scoop/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -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 }}




76 changes: 76 additions & 0 deletions charts/scoop/templates/deployment.yml
Original file line number Diff line number Diff line change
@@ -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:
Fixed Show fixed Hide fixed
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
Fixed Show fixed Hide fixed

Check warning

Code scanning / SonarCloud

Storage limits should be enforced Medium

Specify a storage limit for this container. See more on SonarCloud
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

28 changes: 28 additions & 0 deletions charts/scoop/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -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 }}


23 changes: 23 additions & 0 deletions charts/scoop/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions charts/scoop/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: scoop-sa
namespace: {{ $.Values.scoopNamespace | default .Release.Namespace }}





80 changes: 80 additions & 0 deletions charts/scoop/values.yaml
Original file line number Diff line number Diff line change
@@ -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


Loading