github.com/jchauncey/draft@v0.3.0/pkg/draft/defaultpacks/common.go (about) 1 package defaultpacks 2 3 const commonIgnore = `# Patterns to ignore when building packages. 4 # This supports shell glob matching, relative path matching, and 5 # negation (prefixed with !). Only one pattern per line. 6 .DS_Store 7 # Common VCS dirs 8 .git/ 9 .gitignore 10 .bzr/ 11 .bzrignore 12 .hg/ 13 .hgignore 14 .svn/ 15 # Common backup files 16 *.swp 17 *.bak 18 *.tmp 19 *~ 20 # Various IDEs 21 .project 22 .idea/ 23 *.tmproj 24 ` 25 26 const commonDeployment = `apiVersion: extensions/v1beta1 27 kind: Deployment 28 metadata: 29 name: {{ template "fullname" . }} 30 labels: 31 chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" 32 spec: 33 replicas: {{ .Values.replicaCount }} 34 template: 35 metadata: 36 labels: 37 app: {{ template "fullname" . }} 38 spec: 39 containers: 40 - name: {{ .Chart.Name }} 41 image: "{{ .Values.image.registry }}/{{ .Values.image.org }}/{{ .Values.image.name }}:{{ .Values.image.tag }}" 42 imagePullPolicy: {{ .Values.image.pullPolicy }} 43 ports: 44 - containerPort: {{ .Values.service.internalPort }} 45 livenessProbe: 46 httpGet: 47 path: / 48 port: {{ .Values.service.internalPort }} 49 readinessProbe: 50 httpGet: 51 path: / 52 port: {{ .Values.service.internalPort }} 53 resources: 54 {{ toYaml .Values.resources | indent 12 }} 55 ` 56 57 const commonService = `apiVersion: v1 58 kind: Service 59 metadata: 60 name: {{ template "fullname" . }} 61 labels: 62 chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" 63 spec: 64 type: {{ .Values.service.type }} 65 ports: 66 - port: {{ .Values.service.externalPort }} 67 targetPort: {{ .Values.service.internalPort }} 68 protocol: TCP 69 name: {{ .Values.service.name }} 70 selector: 71 app: {{ template "fullname" . }} 72 ` 73 74 const commonIngress = `apiVersion: extensions/v1beta1 75 kind: Ingress 76 metadata: 77 name: {{ template "fullname" . }} 78 labels: 79 chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" 80 spec: 81 rules: 82 - host: {{ .Release.Name }}.{{ .Values.basedomain }} 83 http: 84 paths: 85 - path: / 86 backend: 87 serviceName: {{ template "fullname" . }} 88 servicePort: {{ .Values.service.externalPort }} 89 ` 90 91 const commonHelpers = `{{/* vim: set filetype=mustache: */}} 92 {{/* 93 Expand the name of the chart. 94 */}} 95 {{- define "name" -}} 96 {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} 97 {{- end -}} 98 99 {{/* 100 Create a default fully qualified app name. 101 We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 102 */}} 103 {{- define "fullname" -}} 104 {{- $name := default .Chart.Name .Values.nameOverride -}} 105 {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} 106 {{- end -}} 107 ` 108 109 const commonNotes = ` 110 {{- if contains "NodePort" .Values.service.type }} 111 Get the application URL by running these commands: 112 export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }}) 113 export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") 114 echo http://$NODE_IP:$NODE_PORT/login 115 {{- else if contains "LoadBalancer" .Values.service.type }} 116 Get the application URL by running these commands: 117 NOTE: It may take a few minutes for the LoadBalancer IP to be available. 118 You can watch the status of by running 'kubectl get svc -w {{ template "fullname" . }}' 119 export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') 120 echo http://$SERVICE_IP:{{ .Values.service.externalPort }} 121 {{- else }} 122 http://{{ .Release.Name }}.{{ .Values.basedomain }} to access your application 123 {{- end }} 124 ` 125 126 const commonDockerignore = `Dockerfile 127 draft.toml 128 chart/ 129 NOTICE 130 ` 131 132 const commonHerokuLicense = `MIT License: 133 134 Copyright (C) 2011-2015 Heroku, Inc. 135 136 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 137 138 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 139 140 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 141 `