Skip to content

Commit

Permalink
Merge pull request #4 from eclipse-tractusx/test-helm-pr-action
Browse files Browse the repository at this point in the history
Test helm pr action
  • Loading branch information
Siegfriedk authored Jan 5, 2023
2 parents 4bc2f59 + 5840499 commit 8d13cbe
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 37 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/helm-lint-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ jobs:
with:
fetch-depth: 0

- name: Kubernetes KinD Cluster
uses: container-tools/kind-action@v1

- name: Build image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: kind-registry:5000/app-dashboard:testing

- name: Set up Helm
uses: azure/setup-helm@v3
with:
Expand All @@ -32,12 +42,8 @@ jobs:
echo "::set-output name=changed::true"
fi
- name: Run chart-testing (lint)
run: ct lint --target-branch ${{ github.event.repository.default_branch }}

- name: Create kind cluster
uses: helm/[email protected]
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --validate-maintainers=false --target-branch ${{ github.event.repository.default_branch }}

- name: Run chart-testing (install)
run: ct install --charts charts
run: ct install --charts charts/app-dashboard
if: steps.list-changed.outputs.changed == 'true'
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ RUN CGO_ENABLED=0 go test ./... && \

FROM gcr.io/distroless/static:nonroot AS final

WORKDIR /app

COPY ./web /app/web
COPY --from=builder --chown=nonroot:nonroot /app/dashboard /app/dashboard

Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions charts/Chart.yaml → charts/app-dashboard/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ version: 1.0.0-RC2
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.0.0-RC1"


maintainers:
- name: The System Team of Catena-X / Eclipse Tractus-X
url: https://projects.eclipse.org/projects/automotive.tractusx
3 changes: 3 additions & 0 deletions charts/app-dashboard/ci/zdefault-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
image:
repository: kind-registry:5000/app-dashboard
tag: "testing"
12 changes: 12 additions & 0 deletions charts/app-dashboard/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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 }}
{{- end }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "app-dashboard.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
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ metadata:
labels:
{{- include "app-dashboard.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "app-dashboard.selectorLabels" . | nindent 6 }}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
spec:
type: ClusterIP
ports:
- port: 8080
- port: {{ .Values.service.port }}
protocol: TCP
name: http
selector:
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion charts/values.yaml → charts/app-dashboard/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ image:
# Overrides the image tag whose default is the chart appVersion.
tag: ""

service:
port: 8080

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
Expand All @@ -26,7 +29,7 @@ serviceAccount:
podAnnotations: {}

ingress:
enabled: true
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
Expand Down
22 changes: 0 additions & 22 deletions charts/templates/NOTES.txt

This file was deleted.

12 changes: 7 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ const k8sRefreshTimeInSeconds = 300 // 5 Minutes
func main() {
cluster, envName, ignoreNamespace := initializeAppFlags()

var err error
errorPage, err = os.ReadFile("web/error.html")
if err != nil {
panic(err)
}

clientSet := GetClientSet(*cluster)

version, err := clientSet.DiscoveryClient.ServerVersion()
Expand All @@ -114,11 +120,6 @@ func main() {
AppVersion: 1,
}

errorPage, err = os.ReadFile("web/error.html")
if err != nil {
panic(err)
}

go startWebserver(&values)

go refreshApplications(&values, k8sRefreshTimeInSeconds, clientSet, ignoreNamespace)
Expand All @@ -145,6 +146,7 @@ func requestAndTransformApplications(clientset *kubernetes.Clientset, ignoreName
if statusError, ok := err.(*errors.StatusError); ok && statusError.Status().Code == 404 {
println("No app found")
} else {
fmt.Println(err)
panic(err)
}
} else {
Expand Down

0 comments on commit 8d13cbe

Please sign in to comment.