Browse Source

Draft create

pull/13/head
krithiva 6 years ago
parent
commit
3bfaf7b1e6
  1. 5
      .dockerignore
  2. 27
      .helmignore
  3. 6
      Dockerfile
  4. 4
      OWNERS
  5. 6
      OWNERS_ALIASES
  6. 21
      charts/argocd-example-apps/.helmignore
  7. 5
      charts/argocd-example-apps/Chart.yaml
  8. 48
      charts/argocd-example-apps/Makefile
  9. 1
      charts/argocd-example-apps/README.md
  10. 4
      charts/argocd-example-apps/templates/NOTES.txt
  11. 16
      charts/argocd-example-apps/templates/_helpers.tpl
  12. 43
      charts/argocd-example-apps/templates/deployment.yaml
  13. 23
      charts/argocd-example-apps/templates/service.yaml
  14. 34
      charts/argocd-example-apps/values.yaml
  15. 5
      charts/preview/Chart.yaml
  16. 18
      charts/preview/Makefile
  17. 16
      charts/preview/requirements.yaml
  18. 22
      charts/preview/values.yaml
  19. 6
      pipeline.yaml
  20. 31
      skaffold.yaml

5
.dockerignore

@ -0,0 +1,5 @@
draft.toml
charts/
NOTICE
LICENSE
README.md

27
.helmignore

@ -0,0 +1,27 @@
# 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
*.png
# known compile time folders
target/
node_modules/
vendor/

6
Dockerfile

@ -0,0 +1,6 @@
FROM node:9-slim
ENV PORT 8080
EXPOSE 8080
WORKDIR /usr/src/app
COPY . .
CMD ["npm", "start"]

4
OWNERS

@ -0,0 +1,4 @@
approvers:
- krithiva
reviewers:
- krithiva

6
OWNERS_ALIASES

@ -0,0 +1,6 @@
aliases:
- krithiva
best-approvers:
- krithiva
best-reviewers:
- krithiva

21
charts/argocd-example-apps/.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

5
charts/argocd-example-apps/Chart.yaml

@ -0,0 +1,5 @@
apiVersion: v1
description: A Helm chart for Kubernetes
icon: https://raw.githubusercontent.com/jenkins-x/jenkins-x-platform/d273e09/images/nodejs.png
name: argocd-example-apps
version: 0.1.0-SNAPSHOT

48
charts/argocd-example-apps/Makefile

@ -0,0 +1,48 @@
CHART_REPO := http://jenkins-x-chartmuseum:8080
CURRENT=$(pwd)
NAME := argocd-example-apps
OS := $(shell uname)
RELEASE_VERSION := $(shell cat ../../VERSION)
build: clean
rm -rf requirements.lock
helm dependency build
helm lint
install: clean build
helm install . --name ${NAME}
upgrade: clean build
helm upgrade ${NAME} .
delete:
helm delete --purge ${NAME}
clean:
rm -rf charts
rm -rf ${NAME}*.tgz
release: clean
helm dependency build
helm lint
helm init --client-only
helm package .
curl --fail -u $(CHARTMUSEUM_CREDS_USR):$(CHARTMUSEUM_CREDS_PSW) --data-binary "@$(NAME)-$(shell sed -n 's/^version: //p' Chart.yaml).tgz" $(CHART_REPO)/api/charts
rm -rf ${NAME}*.tgz%
tag:
ifeq ($(OS),Darwin)
sed -i "" -e "s/version:.*/version: $(RELEASE_VERSION)/" Chart.yaml
sed -i "" -e "s/tag:.*/tag: $(RELEASE_VERSION)/" values.yaml
else ifeq ($(OS),Linux)
sed -i -e "s/version:.*/version: $(RELEASE_VERSION)/" Chart.yaml
sed -i -e "s|repository:.*|repository: $(DOCKER_REGISTRY)\/krithiva\/argocd-example-apps|" values.yaml
sed -i -e "s/tag:.*/tag: $(RELEASE_VERSION)/" values.yaml
else
echo "platfrom $(OS) not supported to release from"
exit -1
endif
git add --all
git commit -m "release $(RELEASE_VERSION)" --allow-empty # if first release then no verion update is performed
git tag -fa v$(RELEASE_VERSION) -m "Release version $(RELEASE_VERSION)"
git push origin v$(RELEASE_VERSION)

1
charts/argocd-example-apps/README.md

@ -0,0 +1 @@
# Javascript application

4
charts/argocd-example-apps/templates/NOTES.txt

@ -0,0 +1,4 @@
Get the application URL by running these commands:
kubectl get ingress {{ template "fullname" . }}

16
charts/argocd-example-apps/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 -}}

43
charts/argocd-example-apps/templates/deployment.yaml

@ -0,0 +1,43 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "fullname" . }}
labels:
draft: {{ default "draft-app" .Values.draft }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
spec:
replicas: {{ .Values.replicaCount }}
template:
metadata:
labels:
draft: {{ default "draft-app" .Values.draft }}
app: {{ template "fullname" . }}
{{- if .Values.podAnnotations }}
annotations:
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.service.internalPort }}
livenessProbe:
httpGet:
path: {{ .Values.probePath }}
port: {{ .Values.service.internalPort }}
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
readinessProbe:
httpGet:
path: {{ .Values.probePath }}
port: {{ .Values.service.internalPort }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
resources:
{{ toYaml .Values.resources | indent 12 }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}

23
charts/argocd-example-apps/templates/service.yaml

@ -0,0 +1,23 @@
apiVersion: v1
kind: Service
metadata:
{{- if .Values.service.name }}
name: {{ .Values.service.name }}
{{- else }}
name: {{ template "fullname" . }}
{{- end }}
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
{{- if .Values.service.annotations }}
annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.externalPort }}
targetPort: {{ .Values.service.internalPort }}
protocol: TCP
name: http
selector:
app: {{ template "fullname" . }}

34
charts/argocd-example-apps/values.yaml

@ -0,0 +1,34 @@
# Default values for node projects.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: draft
tag: dev
pullPolicy: IfNotPresent
service:
name: argocd-example-apps
type: ClusterIP
externalPort: 80
internalPort: 8080
annotations:
fabric8.io/expose: "true"
fabric8.io/ingress.annotations: "kubernetes.io/ingress.class: nginx"
resources:
limits:
cpu: 400m
memory: 256Mi
requests:
cpu: 200m
memory: 128Mi
probePath: /
livenessProbe:
initialDelaySeconds: 60
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
readinessProbe:
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
terminationGracePeriodSeconds: 10

5
charts/preview/Chart.yaml

@ -0,0 +1,5 @@
apiVersion: v1
description: A Helm chart for Kubernetes
icon: https://raw.githubusercontent.com/jenkins-x/jenkins-x-platform/master/images/java.png
name: preview
version: 0.1.0-SNAPSHOT

18
charts/preview/Makefile

@ -0,0 +1,18 @@
OS := $(shell uname)
preview:
ifeq ($(OS),Darwin)
sed -i "" -e "s/version:.*/version: $(PREVIEW_VERSION)/" Chart.yaml
sed -i "" -e "s/version:.*/version: $(PREVIEW_VERSION)/" ../*/Chart.yaml
sed -i "" -e "s/tag:.*/tag: $(PREVIEW_VERSION)/" values.yaml
else ifeq ($(OS),Linux)
sed -i -e "s/version:.*/version: $(PREVIEW_VERSION)/" Chart.yaml
sed -i -e "s/version:.*/version: $(PREVIEW_VERSION)/" ../*/Chart.yaml
sed -i -e "s|repository:.*|repository: $(DOCKER_REGISTRY)\/krithiva\/argocd-example-apps|" values.yaml
sed -i -e "s/tag:.*/tag: $(PREVIEW_VERSION)/" values.yaml
else
echo "platfrom $(OS) not supported to release from"
exit -1
endif
echo " version: $(PREVIEW_VERSION)" >> requirements.yaml
jx step helm build

16
charts/preview/requirements.yaml

@ -0,0 +1,16 @@
# !! File must end with empty line !!
dependencies:
- alias: expose
name: exposecontroller
repository: http://chartmuseum.jenkins-x.io
version: 2.3.92
- alias: cleanup
name: exposecontroller
repository: http://chartmuseum.jenkins-x.io
version: 2.3.92
# !! "alias: preview" must be last entry in dependencies array !!
# !! Place custom dependencies above !!
- alias: preview
name: argocd-example-apps
repository: file://../argocd-example-apps

22
charts/preview/values.yaml

@ -0,0 +1,22 @@
expose:
Annotations:
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-delete-policy: hook-succeeded
config:
exposer: Ingress
http: true
tlsacme: false
cleanup:
Args:
- --cleanup
Annotations:
helm.sh/hook: pre-delete
helm.sh/hook-delete-policy: hook-succeeded
preview:
image:
repository:
tag:
pullPolicy: IfNotPresent

6
pipeline.yaml

@ -0,0 +1,6 @@
extends:
file: ../javascript/pipeline.yaml
agent:
label: jenkins-nodejs
container: nodejs

31
skaffold.yaml

@ -0,0 +1,31 @@
apiVersion: skaffold/v1beta2
kind: Config
build:
tagPolicy:
envTemplate:
template: "{{.DOCKER_REGISTRY}}/krithiva/argocd-example-apps:{{.VERSION}}"
artifacts:
- imageName: changeme
workspace: .
docker: {}
local: {}
deploy:
kubectl:
manifests:
profiles:
- name: dev
build:
tagPolicy:
envTemplate:
template: "{{.DOCKER_REGISTRY}}/krithiva/argocd-example-apps:{{.DIGEST_HEX}}"
artifacts:
- docker: {}
local: {}
deploy:
helm:
releases:
- name: argocd-example-apps
chartPath: charts/argocd-example-apps
setValueTemplates:
image.repository: "{{.DOCKER_REGISTRY}}/krithiva/argocd-example-apps"
image.tag: "{{.DIGEST_HEX}}"
Loading…
Cancel
Save