diff --git a/Dockerfile b/Dockerfile index b70d890..eb621c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ FROM python:latest RUN apt update && apt install -y lm-sensors watch stress +RUN pip install glances bottle statsd pysnmp -CMD sleep infinity \ No newline at end of file +COPY glances.conf /etc/glances/glances.conf + +CMD glances -w \ No newline at end of file diff --git a/README.md b/README.md index a2de881..b24206e 100644 --- a/README.md +++ b/README.md @@ -16,4 +16,4 @@ kubectl exec -it $(kubectl get pod --selector=app=temp --output=jsonpath={.items ```bash kubectl exec -it $(kubectl get pod --selector=app=temp --output=jsonpath={.items..metadata.name}) -- stress -c 24 -``` \ No newline at end of file +``` diff --git a/docker-compose.yaml b/docker-compose.yaml index 631fbfd..8e009f3 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,6 +1,15 @@ version: '3' services: - temp: - build: . - image: hub.ducoterra.net/ducoterra/temp:0.0.2 \ No newline at end of file + web: + image: hub.ducoterra.net/ducoterra/temp:0.0.7 + ports: + - 61208:61208 + command: glances -w + exporter: + image: hub.ducoterra.net/ducoterra/temp:0.0.7 + command: glances --export statsd + graphite-statsd: + image: hub.ducoterra.net/ducoterra/graphite:0.0.1 + ports: + - 8080:80 \ No newline at end of file diff --git a/glances.conf b/glances.conf new file mode 100644 index 0000000..b4b0058 --- /dev/null +++ b/glances.conf @@ -0,0 +1,4 @@ +[statsd] +host=graphite-statsd +port=8125 +prefix=mainframe diff --git a/helm/templates/deploy.yaml b/helm/templates/deploy.yaml index f5406df..85fdd31 100644 --- a/helm/templates/deploy.yaml +++ b/helm/templates/deploy.yaml @@ -13,12 +13,22 @@ spec: app: {{ .Release.Name }} spec: containers: - - name: {{ .Release.Name }} - image: hub.ducoterra.net/ducoterra/temp:0.0.2 + - name: {{ .Release.Name }}-web + image: {{ .Values.image }} resources: requests: memory: 1Mi cpu: 1m limits: - memory: 1Gi - cpu: '48' \ No newline at end of file + memory: 256Mi + cpu: "24" + - name: {{ .Release.Name }}-exporter + image: {{ .Values.image }} + command: ["glances", "-q", "--export", "statsd"] + resources: + requests: + memory: 1Mi + cpu: 1m + limits: + memory: 256Mi + cpu: 250m \ No newline at end of file diff --git a/helm/templates/ingress.yaml b/helm/templates/ingress.yaml new file mode 100644 index 0000000..373f3bd --- /dev/null +++ b/helm/templates/ingress.yaml @@ -0,0 +1,39 @@ +apiVersion: traefik.containo.us/v1alpha1 +kind: IngressRoute +metadata: + name: {{ .Release.Name }}-internal-tls + annotations: + kubernetes.io/ingress.class: traefik-internal +spec: + entryPoints: + - websecure + tls: + certResolver: myresolver + domains: + - main: "*.ducoterra.net" + routes: + - match: Host(`{{ .Release.Name }}.ducoterra.net`) + kind: Rule + services: + - name: {{ .Release.Name }} + port: 61208 + +--- + +apiVersion: traefik.containo.us/v1alpha1 +kind: IngressRoute +metadata: + name: {{ .Release.Name }}-internal-web + annotations: + kubernetes.io/ingress.class: traefik-internal +spec: + entryPoints: + - web + routes: + - match: Host(`{{ .Release.Name }}.ducoterra.net`) + kind: Rule + services: + - name: {{ .Release.Name }} + port: 61208 + middlewares: + - name: httpsredirect \ No newline at end of file diff --git a/helm/templates/service.yaml b/helm/templates/service.yaml new file mode 100644 index 0000000..d05d508 --- /dev/null +++ b/helm/templates/service.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }} +spec: + selector: + app: {{ .Release.Name }} + ports: + - port: 61208 + targetPort: 61208 \ No newline at end of file diff --git a/helm/values.yaml b/helm/values.yaml index 5c23cc8..36350f4 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -1,79 +1 @@ -# Default values for helm. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 - -image: - repository: nginx - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "" - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -serviceAccount: - # Specifies whether a service account should be created - create: true - # Annotations to add to the service account - annotations: {} - # The name of the service account to use. - # If not set and create is true, a name is generated using the fullname template - name: "" - -podAnnotations: {} - -podSecurityContext: {} - # fsGroup: 2000 - -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 - -service: - type: ClusterIP - port: 80 - -ingress: - enabled: false - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: chart-example.local - paths: [] - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - -nodeSelector: {} - -tolerations: [] - -affinity: {} +image: hub.ducoterra.net/ducoterra/temp:0.0.7 \ No newline at end of file