Skip to content

Commit e6e57ec

Browse files
authored
Merge pull request #51 from kumarabd/kumarabd/feature/helm
Kumarabd/feature/helm
2 parents 14309c0 + cc523f6 commit e6e57ec

File tree

13 files changed

+229
-1
lines changed

13 files changed

+229
-1
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,22 @@ jobs:
4343
docker push ${{ secrets.IMAGE_NAME }}:${GITHUB_REF/refs\/tags\//}
4444
docker tag ${{ secrets.IMAGE_NAME }}:smi ${{ secrets.IMAGE_NAME }}:smi-${GITHUB_REF/refs\/tags\//}
4545
docker push ${{ secrets.IMAGE_NAME }}:smi-${GITHUB_REF/refs\/tags\//}
46+
helm:
47+
name: Helm charts publish
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Checkout code
51+
uses: actions/checkout@master
52+
with:
53+
fetch-depth: 1
54+
- name: Configure Git
55+
run: |
56+
git config user.name "$GITHUB_ACTOR"
57+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
58+
- name: Run chart-releaser
59+
uses: helm/chart-releaser-action@v1.0.0
60+
with:
61+
version: ${GITHUB_REF/refs\/tags\//}
62+
charts_repo_url: https://layer5.github.io/smi-conformance
63+
env:
64+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

charts/smi-conformance-0.1.0.tgz

2.31 KB
Binary file not shown.

charts/smi-conformance/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/smi-conformance/Chart.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Name: smi-conformance
2+
description: A Helm chart to install the SMI conformance tool on Kubernetes
3+
version: 0.1.0
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
1. Get the application URL by running these commands:
2+
{{- if contains "NodePort" .Values.service.type }}
3+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "smi-conformance.fullname" . }})
4+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
5+
echo http://$NODE_IP:$NODE_PORT
6+
{{- else if contains "LoadBalancer" .Values.service.type }}
7+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
8+
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "smi-conformance.fullname" . }}'
9+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "smi-conformance.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
10+
echo http://$SERVICE_IP:{{ .Values.service.port }}
11+
{{- else if contains "ClusterIP" .Values.service.type }}
12+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "smi-conformance.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
13+
echo "Visit http://127.0.0.1:8080 to use your application"
14+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
15+
{{- end }}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "smi-conformance.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
7+
{{- end }}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "smi-conformance.fullname" -}}
15+
{{- if .Values.fullnameOverride }}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
17+
{{- else }}
18+
{{- $name := default .Chart.Name .Values.nameOverride }}
19+
{{- if contains $name .Release.Name }}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
21+
{{- else }}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
23+
{{- end }}
24+
{{- end }}
25+
{{- end }}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "smi-conformance.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
32+
{{- end }}
33+
34+
{{/*
35+
Common labels
36+
*/}}
37+
{{- define "smi-conformance.labels" -}}
38+
helm.sh/chart: {{ include "smi-conformance.chart" . }}
39+
{{ include "smi-conformance.selectorLabels" . }}
40+
{{- if .Chart.AppVersion }}
41+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
42+
{{- end }}
43+
app.kubernetes.io/managed-by: {{ .Release.Service }}
44+
{{- end }}
45+
46+
{{/*
47+
Selector labels
48+
*/}}
49+
{{- define "smi-conformance.selectorLabels" -}}
50+
app.kubernetes.io/name: {{ include "smi-conformance.name" . }}
51+
app.kubernetes.io/instance: {{ .Release.Name }}
52+
{{- end }}
53+
54+
{{/*
55+
Create the name of the service account to use
56+
*/}}
57+
{{- define "smi-conformance.serviceAccount" -}}
58+
{{- if .Values.serviceAccount }}
59+
{{- default (include "smi-conformance.fullname" .) .Values.serviceAccount }}
60+
{{- else }}
61+
{{- default "default" .Values.serviceAccount }}
62+
{{- end }}
63+
{{- end }}
64+
65+
{{/*
66+
Create the name of the namespace to use
67+
*/}}
68+
{{- define "smi-conformance.namespace" -}}
69+
{{- if .Values.namespace }}
70+
{{- default (include "smi-conformance.fullname" .) .Values.namespace }}
71+
{{- else }}
72+
{{- default "default" .Values.namespace }}
73+
{{- end }}
74+
{{- end }}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "smi-conformance.name" . }}
5+
namespace: {{ include "smi-conformance.namespace" . }}
6+
labels:
7+
{{- include "smi-conformance.labels" . | nindent 4 }}
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
{{- include "smi-conformance.labels" . | nindent 6 }}
13+
strategy:
14+
rollingUpdate:
15+
maxSurge: 10%
16+
maxUnavailable: 0
17+
type: RollingUpdate
18+
template:
19+
metadata:
20+
labels:
21+
{{- include "smi-conformance.labels" . | nindent 8 }}
22+
spec:
23+
serviceAccountName: {{ include "smi-conformance.serviceAccount" . }}
24+
containers:
25+
- name: {{ .Chart.Name }}
26+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.Version }}"
27+
imagePullPolicy: {{ .Values.image.pullPolicy }}
28+
ports:
29+
- name: grpc
30+
containerPort: {{ .Values.image.port }}
31+
protocol: TCP
32+
resources:
33+
{{- toYaml .Values.resources | nindent 12 }}
34+
restartPolicy: Always
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRoleBinding
4+
metadata:
5+
name: {{ include "smi-conformance.name" . }}
6+
namespace: meshery
7+
subjects:
8+
- kind: ServiceAccount
9+
name: {{ include "smi-conformance.name" . }}
10+
namespace: {{ include "smi-conformance.namespace" . }}
11+
roleRef:
12+
kind: ClusterRole
13+
name: cluster-admin
14+
apiGroup: rbac.authorization.k8s.io
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "smi-conformance.name" . }}
5+
namespace: {{ include "smi-conformance.namespace" . }}
6+
labels:
7+
{{- include "smi-conformance.labels" . | nindent 4 }}
8+
spec:
9+
type: {{ .Values.service.type }}
10+
ports:
11+
- port: {{ .Values.service.port }}
12+
targetPort: grpc
13+
protocol: TCP
14+
name: {{ include "smi-conformance.name" . }}
15+
selector:
16+
{{- include "smi-conformance.labels" . | nindent 4 }}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: {{ include "smi-conformance.serviceAccount" . }}
5+
namespace: {{ include "smi-conformance.namespace" . }}

0 commit comments

Comments
 (0)