Skip to content

Commit

Permalink
Merge pull request #2 from sngular/add-envs-and-checks
Browse files Browse the repository at this point in the history
Add envs and checks
  • Loading branch information
Manuel Morejón authored May 23, 2021
2 parents 6e99544 + 0ffb8f3 commit 9780a46
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 140 deletions.
Empty file modified .github/helm-docs.sh
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions .github/kubeval.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
set -euo pipefail

CHART_DIRS="$(git diff --find-renames --name-only "$(git rev-parse --abbrev-ref HEAD)" remotes/origin/master -- charts | grep '[cC]hart.yaml' | sed -e 's#/[Cc]hart.yaml##g')"
KUBEVAL_VERSION="0.16.1"
SCHEMA_LOCATION="https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/"
CHART_DIRS="$(git diff --find-renames --name-only "$(git rev-parse --abbrev-ref HEAD)" remotes/origin/main -- charts | grep '[cC]hart.yaml' | sed -e 's#/[Cc]hart.yaml##g')"
KUBEVAL_VERSION="v0.16.1"
SCHEMA_LOCATION="https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/master/"

# install kubeval
curl --silent --show-error --fail --location --output /tmp/kubeval.tar.gz https://github.com/instrumenta/kubeval/releases/download/"${KUBEVAL_VERSION}"/kubeval-linux-amd64.tar.gz
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ jobs:
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed)
changed=$(ct list-changed --target-branch=main)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Run chart-testing (lint)
run: ct lint
run: ct lint --target-branch=main

lint-docs:
runs-on: ubuntu-latest
Expand Down
27 changes: 7 additions & 20 deletions charts/echobot/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
apiVersion: v2
name: echobot
description: A Helm chart for the echobot service

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.3"
version: 0.2.0
appVersion: "v0.1.3"
maintainers:
- email: manuel.morejon@users.noreply.github.com
name: mmorejon
- email: enrique.benito@users.noreply.github.com
name: enribd
24 changes: 2 additions & 22 deletions charts/echobot/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,2 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "echobot.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "echobot.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "echobot.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "echobot.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
Echobot application is running. Print logs with this command:
kubectl --namespace {{ .Release.Namespace }} logs --selector app.kubernetes.io/name=echobot
14 changes: 4 additions & 10 deletions charts/echobot/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,12 @@ spec:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 8080
protocol: TCP
env:
{{- toYaml .Values.env | nindent 12 }}
livenessProbe:
httpGet:
path: /
port: http
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
httpGet:
path: /
port: http
{{- toYaml .Values.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
Expand Down
41 changes: 0 additions & 41 deletions charts/echobot/templates/ingress.yaml

This file was deleted.

15 changes: 0 additions & 15 deletions charts/echobot/templates/service.yaml

This file was deleted.

13 changes: 8 additions & 5 deletions charts/echobot/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "echobot.fullname" . }}-test-connection"
name: "{{ include "echobot.fullname" . }}-test-file"
labels:
{{- include "echobot.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "echobot.fullname" . }}:{{ .Values.service.port }}']
- name: test
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
command:
- '/usr/bin/test'
args:
- '-f'
- '/usr/local/bin/gitops-echobot'
restartPolicy: Never
41 changes: 19 additions & 22 deletions charts/echobot/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ replicaCount: 1
image:
repository: ghcr.io/sngular/gitops-echobot
pullPolicy: IfNotPresent
tag: "v0.1.0"
tag: ""

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

env: {}
# - name: VARIABLE_NAME
# value: "Example value"

serviceAccount:
# Specifies whether a service account should be created
create: true
Expand All @@ -35,27 +39,6 @@ securityContext: {}
# runAsNonRoot: true
# runAsUser: 1000

service:
type: ClusterIP
port: 8080

ingress:
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
backend:
serviceName: chart-example.local
servicePort: 80
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
Expand All @@ -68,6 +51,20 @@ resources: {}
# cpu: 100m
# memory: 128Mi

livenessProbe:
exec:
command:
- '/usr/bin/test'
- '-f'
- '/usr/local/bin/gitops-echobot'

readinessProbe:
exec:
command:
- '/usr/bin/test'
- '-f'
- '/usr/local/bin/gitops-echobot'

autoscaling:
enabled: false
minReplicas: 1
Expand Down

0 comments on commit 9780a46

Please sign in to comment.