commit 4ad4d551f9d307b48c62b4996621488f2dc50a7c Author: Alexander Matyushentsev Date: Wed Oct 11 08:54:34 2017 -0700 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..9385855f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +output +.vscode diff --git a/charts/argo-lite/.helmignore b/charts/argo-lite/.helmignore new file mode 100644 index 00000000..f0c13194 --- /dev/null +++ b/charts/argo-lite/.helmignore @@ -0,0 +1,21 @@ +# 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 +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/charts/argo-lite/Chart.yaml b/charts/argo-lite/Chart.yaml new file mode 100644 index 00000000..bbd8579b --- /dev/null +++ b/charts/argo-lite/Chart.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +description: Lighweight workflow engine for Kubernetes +name: argo-lite +version: 0.1.0 +icon: https://raw.githubusercontent.com/argoproj/argo/master/saas/axops/src/ui/src/assets/favicon/favicon-32x32.png +keywords: +- workflow +- ci diff --git a/charts/argo-lite/templates/NOTES.txt b/charts/argo-lite/templates/NOTES.txt new file mode 100644 index 00000000..ccfecb7e --- /dev/null +++ b/charts/argo-lite/templates/NOTES.txt @@ -0,0 +1,19 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http://{{ . }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "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 svc -w {{ template "fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.externalPort }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:{{ .Values.service.externalPort }} +{{- end }} diff --git a/charts/argo-lite/templates/_helpers.tpl b/charts/argo-lite/templates/_helpers.tpl new file mode 100644 index 00000000..f0d83d2e --- /dev/null +++ b/charts/argo-lite/templates/_helpers.tpl @@ -0,0 +1,16 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "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). +*/}} +{{- define "fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/charts/argo-lite/templates/deployment.yaml b/charts/argo-lite/templates/deployment.yaml new file mode 100644 index 00000000..1b093303 --- /dev/null +++ b/charts/argo-lite/templates/deployment.yaml @@ -0,0 +1,38 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ template "name" . }} + release: {{ .Release.Name }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: ["node", "/app/dist/main.js", "--engine", "kubernetes-in-cluster", "-u", "/app/dist/ui"] + ports: + - containerPort: {{ .Values.service.internalPort }} + livenessProbe: + httpGet: + path: / + port: {{ .Values.service.internalPort }} + readinessProbe: + httpGet: + path: / + port: {{ .Values.service.internalPort }} + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} + {{- end }} diff --git a/charts/argo-lite/templates/service.yaml b/charts/argo-lite/templates/service.yaml new file mode 100644 index 00000000..f311d10a --- /dev/null +++ b/charts/argo-lite/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + protocol: TCP + name: {{ .Values.service.name }} + selector: + app: {{ template "name" . }} + release: {{ .Release.Name }} diff --git a/charts/argo-lite/values.yaml b/charts/argo-lite/values.yaml new file mode 100644 index 00000000..fe07a32d --- /dev/null +++ b/charts/argo-lite/values.yaml @@ -0,0 +1,21 @@ +replicaCount: 1 +image: + repository: argoproj/argo-lite + tag: latest + pullPolicy: IfNotPresent +service: + name: nginx + type: ClusterIP + externalPort: 8080 + internalPort: 8080 +ingress: + enabled: false + hosts: + - chart-example.local +resources: + limits: + cpu: 100m + memory: 512Mi + requests: + cpu: 100m + memory: 512Mi diff --git a/scripts/publish.rb b/scripts/publish.rb new file mode 100644 index 00000000..e147ca84 --- /dev/null +++ b/scripts/publish.rb @@ -0,0 +1,25 @@ +require 'yaml' + +root_dir = "#{File.dirname(__FILE__)}/.." +output_index_path = "#{root_dir}/output/index.yaml" + +`mkdir -p #{root_dir}/output` + +list = Dir.glob("#{root_dir}/charts/**/*Chart.yaml") + +repo_index = if File.exists?(output_index_path) then YAML.load_file(output_index_path) else { 'apiVersion' => 'v1', 'entries' => {}} end + +list.each do |filename| + chart_name = File.basename(File.dirname(filename)) + chart_versions = repo_index['entries'][chart_name] || [] + repo_index['entries'][chart_name] = chart_versions + version_info = YAML.load_file(filename) + existing_info = chart_versions.find{ |item| item.version == version_info['version'] } + if existing_info then + chart_versions[chart_versions.index(existing_info)] = version_info + else + chart_versions.push version_info + end + `tar -zcvf #{root_dir}/output/#{chart_name}-#{version_info['version']}.tar.gz #{File.dirname(filename)}` + File.open(output_index_path, 'w') { |file| file.write(repo_index.to_yaml( :Indent => 4, :UseHeader => true, :UseVersion => true )) } +end