Skip to content

Commit

Permalink
Merge pull request #51 from kumarabd/kumarabd/feature/helm
Browse files Browse the repository at this point in the history
Kumarabd/feature/helm
  • Loading branch information
leecalcote authored Aug 31, 2020
2 parents 14309c0 + cc523f6 commit e6e57ec
Show file tree
Hide file tree
Showing 13 changed files with 229 additions and 1 deletion.
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,22 @@ jobs:
docker push ${{ secrets.IMAGE_NAME }}:${GITHUB_REF/refs\/tags\//}
docker tag ${{ secrets.IMAGE_NAME }}:smi ${{ secrets.IMAGE_NAME }}:smi-${GITHUB_REF/refs\/tags\//}
docker push ${{ secrets.IMAGE_NAME }}:smi-${GITHUB_REF/refs\/tags\//}
helm:
name: Helm charts publish
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
with:
fetch-depth: 1
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Run chart-releaser
uses: helm/[email protected]
with:
version: ${GITHUB_REF/refs\/tags\//}
charts_repo_url: https://layer5.github.io/smi-conformance
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
Binary file added charts/smi-conformance-0.1.0.tgz
Binary file not shown.
23 changes: 23 additions & 0 deletions charts/smi-conformance/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
3 changes: 3 additions & 0 deletions charts/smi-conformance/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Name: smi-conformance
description: A Helm chart to install the SMI conformance tool on Kubernetes
version: 0.1.0
15 changes: 15 additions & 0 deletions charts/smi-conformance/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
1. Get the application URL by running these commands:
{{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "smi-conformance.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 "smi-conformance.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "smi-conformance.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 "smi-conformance.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
{{- end }}
74 changes: 74 additions & 0 deletions charts/smi-conformance/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "smi-conformance.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "smi-conformance.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "smi-conformance.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "smi-conformance.labels" -}}
helm.sh/chart: {{ include "smi-conformance.chart" . }}
{{ include "smi-conformance.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "smi-conformance.selectorLabels" -}}
app.kubernetes.io/name: {{ include "smi-conformance.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "smi-conformance.serviceAccount" -}}
{{- if .Values.serviceAccount }}
{{- default (include "smi-conformance.fullname" .) .Values.serviceAccount }}
{{- else }}
{{- default "default" .Values.serviceAccount }}
{{- end }}
{{- end }}

{{/*
Create the name of the namespace to use
*/}}
{{- define "smi-conformance.namespace" -}}
{{- if .Values.namespace }}
{{- default (include "smi-conformance.fullname" .) .Values.namespace }}
{{- else }}
{{- default "default" .Values.namespace }}
{{- end }}
{{- end }}
34 changes: 34 additions & 0 deletions charts/smi-conformance/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "smi-conformance.name" . }}
namespace: {{ include "smi-conformance.namespace" . }}
labels:
{{- include "smi-conformance.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "smi-conformance.labels" . | nindent 6 }}
strategy:
rollingUpdate:
maxSurge: 10%
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
labels:
{{- include "smi-conformance.labels" . | nindent 8 }}
spec:
serviceAccountName: {{ include "smi-conformance.serviceAccount" . }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.Version }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: grpc
containerPort: {{ .Values.image.port }}
protocol: TCP
resources:
{{- toYaml .Values.resources | nindent 12 }}
restartPolicy: Always
14 changes: 14 additions & 0 deletions charts/smi-conformance/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "smi-conformance.name" . }}
namespace: meshery
subjects:
- kind: ServiceAccount
name: {{ include "smi-conformance.name" . }}
namespace: {{ include "smi-conformance.namespace" . }}
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
16 changes: 16 additions & 0 deletions charts/smi-conformance/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "smi-conformance.name" . }}
namespace: {{ include "smi-conformance.namespace" . }}
labels:
{{- include "smi-conformance.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: grpc
protocol: TCP
name: {{ include "smi-conformance.name" . }}
selector:
{{- include "smi-conformance.labels" . | nindent 4 }}
5 changes: 5 additions & 0 deletions charts/smi-conformance/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "smi-conformance.serviceAccount" . }}
namespace: {{ include "smi-conformance.namespace" . }}
20 changes: 20 additions & 0 deletions charts/smi-conformance/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace: meshery
serviceAccount: meshery
labels:
app: smi-conformance
release: smi-conformance
image:
repository: layer5/learn-layer5
tag: smi
pullPolicy: Always
port: 10008
resources:
limits:
cpu: "500m"
memory: 1000Mi
requests:
cpu: "200m"
memory: 500Mi
service:
type: NodePort
port: 10008
5 changes: 5 additions & 0 deletions service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@ FROM golang:1.13.5 as bd
WORKDIR /github.com/layer5io/sample-app-service
ADD . .
RUN GOPROXY=direct GOSUMDB=off go build -a -o ./main .

FROM alpine:latest
COPY --from=bd /github.com/layer5io/sample-app-service/** /home/
WORKDIR /home/
EXPOSE 9091
CMD ["./main"]
2 changes: 1 addition & 1 deletion smi-conformance/test-gen/test_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func RunTest(meshConfig ServiceMesh, annotations, labels map[string]string) Resu
args := []string{"./test-yamls/"}

options.TestDirs = args
options.Timeout = 120
options.Timeout = 300
options.Parallel = 1
options.TestDirs = manifestDirs
options.StartKIND = startKIND
Expand Down

0 comments on commit e6e57ec

Please sign in to comment.