diff --git a/.lighthouse/jenkins-x/pullrequest.yaml b/.lighthouse/jenkins-x/pullrequest.yaml new file mode 100644 index 0000000..8f88cf8 --- /dev/null +++ b/.lighthouse/jenkins-x/pullrequest.yaml @@ -0,0 +1,41 @@ +apiVersion: tekton.dev/v1beta1 +kind: PipelineRun +metadata: + creationTimestamp: null + name: pullrequest +spec: + pipelineSpec: + tasks: + - name: from-build-pack + resources: {} + taskSpec: + metadata: {} + stepTemplate: + image: uses:jenkins-x/jx3-pipeline-catalog/tasks/javascript/pullrequest.yaml@versionStream + name: "" + resources: + requests: + cpu: 0.1 + memory: 128Mi + limits: + cpu: 400m + memory: 512Mi + workingDir: /workspace/source + steps: + - image: uses:jenkins-x/jx3-pipeline-catalog/tasks/git-clone/git-clone-pr.yaml@versionStream + name: "" + resources: {} + - name: jx-variables + resources: {} + - name: build-npm-install + resources: {} + - name: check-registry + resources: {} + - name: build-container-build + resources: {} + - name: promote-jx-preview + resources: {} + podTemplate: {} + serviceAccountName: tekton-bot + timeout: 12h0m0s +status: {} diff --git a/.lighthouse/jenkins-x/release.yaml b/.lighthouse/jenkins-x/release.yaml new file mode 100644 index 0000000..d98fd51 --- /dev/null +++ b/.lighthouse/jenkins-x/release.yaml @@ -0,0 +1,60 @@ +apiVersion: tekton.dev/v1beta1 +kind: PipelineRun +metadata: + creationTimestamp: null + name: release +spec: + pipelineSpec: + tasks: + - name: from-build-pack + resources: {} + taskSpec: + metadata: {} + stepTemplate: + env: + - name: NPM_CONFIG_USERCONFIG + value: /tekton/home/npm/.npmrc + image: uses:jenkins-x/jx3-pipeline-catalog/tasks/javascript/release.yaml@versionStream + name: "" + resources: + requests: + cpu: 0.1 + memory: 128Mi + limits: + cpu: 400m + memory: 512Mi + volumeMounts: + - mountPath: /tekton/home/npm + name: npmrc + workingDir: /workspace/source + steps: + - image: uses:jenkins-x/jx3-pipeline-catalog/tasks/git-clone/git-clone.yaml@versionStream + name: "" + resources: {} + - name: next-version + resources: {} + - name: jx-variables + resources: {} + - name: build-npm-install + resources: {} + - name: build-npm-test + resources: {} + - name: check-registry + resources: {} + - name: build-container-build + resources: {} + - name: promote-changelog + resources: {} + - name: promote-helm-release + resources: {} + - name: promote-jx-promote + resources: {} + volumes: + - name: npmrc + secret: + optional: true + secretName: npmrc + podTemplate: {} + serviceAccountName: tekton-bot + timeout: 12h0m0s +status: {} diff --git a/.lighthouse/jenkins-x/triggers.yaml b/.lighthouse/jenkins-x/triggers.yaml new file mode 100644 index 0000000..ae2fcfa --- /dev/null +++ b/.lighthouse/jenkins-x/triggers.yaml @@ -0,0 +1,16 @@ +apiVersion: config.lighthouse.jenkins-x.io/v1alpha1 +kind: TriggerConfig +spec: + presubmits: + - name: pr + context: "pr" + always_run: true + optional: false + source: "pullrequest.yaml" + postsubmits: + - name: release + context: "release" + source: "release.yaml" + branches: + - ^main$ + - ^master$ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5e537bc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM node:12-slim +ENV PORT 8080 +EXPOSE 8080 +WORKDIR /usr/src/app +COPY . . +CMD ["npm", "start"] \ No newline at end of file diff --git a/OWNERS b/OWNERS new file mode 100644 index 0000000..3b98152 --- /dev/null +++ b/OWNERS @@ -0,0 +1,4 @@ +approvers: +- niazhussain +reviewers: +- niazhussain diff --git a/OWNERS_ALIASES b/OWNERS_ALIASES new file mode 100644 index 0000000..e688dfb --- /dev/null +++ b/OWNERS_ALIASES @@ -0,0 +1,6 @@ +aliases: +- niazhussain +best-approvers: +- niazhussain +best-reviewers: +- niazhussain diff --git a/charts/nodejs-websocket-example/.helmignore b/charts/nodejs-websocket-example/.helmignore new file mode 100755 index 0000000..f0c1319 --- /dev/null +++ b/charts/nodejs-websocket-example/.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/nodejs-websocket-example/Chart.yaml b/charts/nodejs-websocket-example/Chart.yaml new file mode 100644 index 0000000..c34f017 --- /dev/null +++ b/charts/nodejs-websocket-example/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +description: A Helm chart for Kubernetes +icon: https://raw.githubusercontent.com/cdfoundation/artwork/master/jenkinsx/icon/color/jenkinsx-icon-color.png +name: nodejs-websocket-example +version: 0.1.0-SNAPSHOT diff --git a/charts/nodejs-websocket-example/Kptfile b/charts/nodejs-websocket-example/Kptfile new file mode 100755 index 0000000..2a814c7 --- /dev/null +++ b/charts/nodejs-websocket-example/Kptfile @@ -0,0 +1,11 @@ +apiVersion: kpt.dev/v1alpha1 +kind: Kptfile +metadata: + name: charts +upstream: + type: git + git: + commit: b52b35506a05e046d54615c3ade97f3aef8bfb08 + repo: https://github.com/jenkins-x/jx3-pipeline-catalog + directory: /helm/charts + ref: master diff --git a/charts/nodejs-websocket-example/Makefile b/charts/nodejs-websocket-example/Makefile new file mode 100755 index 0000000..a8c50e7 --- /dev/null +++ b/charts/nodejs-websocket-example/Makefile @@ -0,0 +1,48 @@ +CHART_REPO := http://jenkins-x-chartmuseum:8080 +CURRENT=$(pwd) +NAME := nodejs-websocket-example +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)\/peaqnetwork\/nodejs-websocket-example|" 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 "chore: 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) diff --git a/charts/nodejs-websocket-example/README.md b/charts/nodejs-websocket-example/README.md new file mode 100755 index 0000000..89f8286 --- /dev/null +++ b/charts/nodejs-websocket-example/README.md @@ -0,0 +1 @@ +# my application \ No newline at end of file diff --git a/charts/nodejs-websocket-example/templates/NOTES.txt b/charts/nodejs-websocket-example/templates/NOTES.txt new file mode 100755 index 0000000..97823be --- /dev/null +++ b/charts/nodejs-websocket-example/templates/NOTES.txt @@ -0,0 +1,4 @@ + +Get the application URL by running these commands: + +kubectl get ingress {{ template "fullname" . }} diff --git a/charts/nodejs-websocket-example/templates/_helpers.tpl b/charts/nodejs-websocket-example/templates/_helpers.tpl new file mode 100755 index 0000000..f0d83d2 --- /dev/null +++ b/charts/nodejs-websocket-example/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/nodejs-websocket-example/templates/canary.yaml b/charts/nodejs-websocket-example/templates/canary.yaml new file mode 100755 index 0000000..b5f55d3 --- /dev/null +++ b/charts/nodejs-websocket-example/templates/canary.yaml @@ -0,0 +1,66 @@ +{{- if .Values.canary.enabled }} +apiVersion: flagger.app/v1beta1 +kind: Canary +metadata: + name: {{ template "fullname" . }} + labels: + draft: {{ default "draft-app" .Values.draft }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" +{{- if .Values.canary.labels }} +{{ toYaml .Values.canary.labels | indent 4 }} +{{- end }} +spec: + provider: istio + targetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ template "fullname" . }} + progressDeadlineSeconds: {{ .Values.canary.progressDeadlineSeconds }} + {{- if .Values.hpa.enabled }} + autoscalerRef: + apiVersion: autoscaling/v2beta1 + kind: HorizontalPodAutoscaler + name: {{ template "fullname" . }} + {{- end }} + service: + port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + gateways: + - {{ template "fullname" . }} + hosts: + - {{ .Values.canary.host | default (printf "%s%s%s" .Values.service.name .Values.jxRequirements.ingress.namespaceSubDomain .Values.jxRequirements.ingress.domain) }} + analysis: + interval: {{ .Values.canary.analysis.interval }} + threshold: {{ .Values.canary.analysis.threshold }} + maxWeight: {{ .Values.canary.analysis.maxWeight }} + stepWeight: {{ .Values.canary.analysis.stepWeight }} + metrics: + - name: latency + templateRef: + name: latency + namespace: istio-system + thresholdRange: + max: {{ .Values.canary.analysis.metrics.latency.threshold }} + interval: {{ .Values.canary.analysis.metrics.latency.interval | quote }} + +--- + +apiVersion: networking.istio.io/v1alpha3 +kind: Gateway +metadata: + name: {{ template "fullname" . }} +{{- if .Values.canary.gatewayLabels }} + labels: +{{ toYaml .Values.canary.gatewayLabels | indent 4 }} +{{- end }} +spec: + selector: + istio: ingressgateway + servers: + - port: + number: {{ .Values.service.externalPort }} + name: http + protocol: HTTP + hosts: + - {{ .Values.canary.host | default (printf "%s%s%s" .Values.service.name .Values.jxRequirements.ingress.namespaceSubDomain .Values.jxRequirements.ingress.domain) }} +{{- end }} diff --git a/charts/nodejs-websocket-example/templates/deployment.yaml b/charts/nodejs-websocket-example/templates/deployment.yaml new file mode 100755 index 0000000..a5e4c62 --- /dev/null +++ b/charts/nodejs-websocket-example/templates/deployment.yaml @@ -0,0 +1,79 @@ +{{- if .Values.knativeDeploy }} +{{- else }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "fullname" . }} + labels: + draft: {{ default "draft-app" .Values.draft }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" +{{- if .Values.deploymentLabels }} +{{ toYaml .Values.deploymentLabels | indent 4 }} +{{- end }} +spec: + selector: + matchLabels: + app: {{ template "fullname" . }} +{{- if .Values.hpa.enabled }} +{{- else }} + replicas: {{ .Values.replicaCount }} +{{- end }} + template: + metadata: + labels: + draft: {{ default "draft-app" .Values.draft }} + app: {{ template "fullname" . }} +{{- if .Values.podsLabels }} +{{ toYaml .Values.podsLabels | indent 6 }} +{{- end }} +{{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8 }} +{{- end }} + spec: +{{- if .Values.serviceAccount.enabled }} +{{- if .Values.serviceAccount.name }} + serviceAccountName: {{ .Values.serviceAccount.name }} +{{- else }} + serviceAccountName: {{ template "fullname" . }} +{{- end }} +{{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: VERSION + value: {{ .Chart.Version }} +{{- range $pkey, $pval := .Values.env }} + - name: {{ $pkey }} + value: {{ quote $pval }} +{{- end }} + envFrom: +{{ toYaml .Values.envFrom | indent 10 }} + ports: + - name: http + containerPort: {{ .Values.service.internalPort }} + livenessProbe: + httpGet: + path: {{ .Values.livenessProbe.probePath | default .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.readinessProbe.probePath | default .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 }} + imagePullSecrets: +{{- range $pval := .Values.jx.imagePullSecrets }} + - name: {{ quote $pval }} +{{- end }} +{{- end }} diff --git a/charts/nodejs-websocket-example/templates/hpa.yaml b/charts/nodejs-websocket-example/templates/hpa.yaml new file mode 100755 index 0000000..a20a001 --- /dev/null +++ b/charts/nodejs-websocket-example/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.hpa.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ template "fullname" . }} + labels: + draft: {{ default "draft-app" .Values.draft }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" +{{- if .Values.hpa.labels }} +{{ toYaml .Values.hpa.labels | indent 4 }} +{{- end }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ template "fullname" . }} + minReplicas: {{ .Values.hpa.minReplicas }} + maxReplicas: {{ .Values.hpa.maxReplicas }} + metrics: + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.hpa.cpuTargetAverageUtilization }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.hpa.memoryTargetAverageUtilization }} +{{- end }} \ No newline at end of file diff --git a/charts/nodejs-websocket-example/templates/ingress.yaml b/charts/nodejs-websocket-example/templates/ingress.yaml new file mode 100755 index 0000000..7c641c1 --- /dev/null +++ b/charts/nodejs-websocket-example/templates/ingress.yaml @@ -0,0 +1,48 @@ +{{- if and (.Values.jxRequirements.ingress.domain) (not .Values.knativeDeploy) }} +{{- $annotations := dict }} +{{- $_ := merge $annotations .Values.ingress.annotations .Values.jxRequirements.ingress.annotations }} +{{- if not (hasKey $annotations "kubernetes.io/ingress.class") }} +{{- $_ := set $annotations "kubernetes.io/ingress.class" (.Values.ingress.classAnnotation | default "nginx") }} +{{- end }} +{{- if and (hasKey .Values.jxRequirements.ingress "serviceType") (.Values.jxRequirements.ingress.serviceType) (eq .Values.jxRequirements.ingress.serviceType "NodePort") (not (hasKey $annotations "jenkins.io/host")) }} +{{- $_ := set $annotations "jenkins.io/host" .Values.jxRequirements.ingress.domain }} +{{- end }} +apiVersion: {{ .Values.jxRequirements.ingress.apiVersion }} +kind: Ingress +metadata: + annotations: +{{- if $annotations }} +{{ toYaml $annotations | indent 4 }} +{{- end }} + name: {{ .Values.service.name }} +{{- if .Values.ingress.labels }} +{{ toYaml .Values.ingress.labels | indent 4 }} +{{- end }} +spec: + rules: + - http: + paths: + - pathType: {{ .Values.ingress.pathType | default "ImplementationSpecific" }} + backend: + service: + name: {{ .Values.service.name }} + port: + number: {{ .Values.service.externalPort }} +{{- if eq "NodePort" .Values.jxRequirements.ingress.serviceType }} + path: "/{{ .Release.Namespace }}/hook" +{{- else if .Values.jxRequirements.ingress.domain }} + host: {{ .Values.service.name }}{{ .Values.jxRequirements.ingress.namespaceSubDomain }}{{ .Values.jxRequirements.ingress.domain }} +{{- end }} +{{- if .Values.jxRequirements.ingress.tls.enabled }} + tls: + - hosts: + - {{ .Values.service.name }}{{ .Values.jxRequirements.ingress.namespaceSubDomain }}{{ .Values.jxRequirements.ingress.domain }} +{{- if and (hasKey .Values.jxRequirements.ingress.tls "secretName") (.Values.jxRequirements.ingress.tls.secretName) }} + secretName: "{{ .Values.jxRequirements.ingress.tls.secretName }}" +{{- else if .Values.jxRequirements.ingress.tls.production }} + secretName: "tls-{{ .Values.jxRequirements.ingress.domain | replace "." "-" }}-p" +{{- else }} + secretName: "tls-{{ .Values.jxRequirements.ingress.domain | replace "." "-" }}-s" +{{- end }} +{{- end }} +{{- end }} diff --git a/charts/nodejs-websocket-example/templates/ksvc.yaml b/charts/nodejs-websocket-example/templates/ksvc.yaml new file mode 100755 index 0000000..ebf2a53 --- /dev/null +++ b/charts/nodejs-websocket-example/templates/ksvc.yaml @@ -0,0 +1,51 @@ +{{- if .Values.knativeDeploy }} +apiVersion: serving.knative.dev/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.labels }} +{{ toYaml .Values.service.labels | indent 4 }} +{{- end }} +spec: + template: + metadata: + annotations: + autoscaling.knative.dev/minScale: "0" +{{- if .Values.podsLabels }} + labels: +{{ toYaml .Values.podsLabels | indent 8 }} +{{- end }} + spec: + containers: + - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: VERSION + value: {{ .Chart.Version }} +{{- range $pkey, $pval := .Values.env }} + - name: {{ $pkey }} + value: {{ quote $pval }} +{{- end }} + livenessProbe: + httpGet: + path: {{ .Values.livenessProbe.probePath | default .Values.probePath }} + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + readinessProbe: + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + httpGet: + path: {{ .Values.readinessProbe.probePath | default .Values.probePath }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + resources: +{{ toYaml .Values.resources | indent 14 }} +{{- end }} diff --git a/charts/nodejs-websocket-example/templates/sa.yaml b/charts/nodejs-websocket-example/templates/sa.yaml new file mode 100755 index 0000000..c1f9836 --- /dev/null +++ b/charts/nodejs-websocket-example/templates/sa.yaml @@ -0,0 +1,16 @@ +{{- if .Values.serviceAccount.enabled }} +apiVersion: v1 +kind: ServiceAccount +metadata: +{{- if .Values.serviceAccount.name }} + name: {{ .Values.serviceAccount.name }} +{{- else }} + name: {{ template "fullname" . }} +{{- end }} + {{- if .Values.serviceAccount.labels }} + labels: {{- toYaml .Values.serviceAccount.labels | nindent 4 }} + {{- end }} + {{- if .Values.serviceAccount.annotations }} + annotations: {{ toYaml .Values.serviceAccount.annotations | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/nodejs-websocket-example/templates/service.yaml b/charts/nodejs-websocket-example/templates/service.yaml new file mode 100755 index 0000000..67664f3 --- /dev/null +++ b/charts/nodejs-websocket-example/templates/service.yaml @@ -0,0 +1,29 @@ +{{- if or .Values.knativeDeploy .Values.canary.enabled }} +{{- else }} +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.labels }} +{{ toYaml .Values.service.labels | indent 4 }} +{{- end }} +{{- 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" . }} +{{- end }} diff --git a/charts/nodejs-websocket-example/values.yaml b/charts/nodejs-websocket-example/values.yaml new file mode 100755 index 0000000..1b5f80c --- /dev/null +++ b/charts/nodejs-websocket-example/values.yaml @@ -0,0 +1,135 @@ +# Default values for your projects. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +replicaCount: 1 +# Add annotations to the pods +podAnnotations: {} +# Add labels to the pods +podsLabels: {} +# Add labels to the deployment +deploymentLabels: {} + +image: + repository: draft + tag: dev + pullPolicy: IfNotPresent + +# optional list of image pull secrets to use to pull images +jx: + # optional image pull secrets + imagePullSecrets: [] + + # whether to create a Release CRD when installing charts with Release CRDs included + releaseCRD: true + +# define environment variables here as a map of key: value +env: + +# enable this flag to use knative serve to deploy the app +knativeDeploy: false + +# HorizontalPodAutoscaler +hpa: + enabled: false + minReplicas: 2 + maxReplicas: 6 + cpuTargetAverageUtilization: 80 + memoryTargetAverageUtilization: 80 + # Add labels to the HPA + labels: {} + +# Canary deployments +# If enabled, Istio and Flagger need to be installed in the cluster +canary: + enabled: false + progressDeadlineSeconds: 60 + analysis: + interval: "1m" + threshold: 5 + maxWeight: 60 + stepWeight: 20 + # WARNING: Canary deployments will fail and rollback if there is no traffic that will generate the below specified metrics. + metrics: + latency: + threshold: 500 + interval: "1m" + # The host is using Istio Gateway or the underlying ingress mechanism + # This value is defaulted from the environments jx-requirements.yml ingress configuration + host: "" + # Add labels to the canary + labels: {} + # Add labels to the canary gateway + gatewayLabels: {} + +service: + name: nodejs-websocket-example + type: ClusterIP + externalPort: 80 + internalPort: 8080 + annotations: {} + # Add labels to the service + labels: {} +resources: + limits: + cpu: 400m + memory: 256Mi + requests: + cpu: 0.1 + memory: 128Mi +probePath: / +livenessProbe: + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + # Optional distinct liveness probe path, if empty the probePath is used + probePath: "" +readinessProbe: + failureThreshold: 1 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + # Optional distinct readiness probe path, if empty the probePath is used + probePath: "" + +# custom ingress annotations on this service +ingress: + annotations: {} + # defaults to nginx if no other ingress class annotation specified + classAnnotation: "" + # Add labels to the ingress + labels: {} + + # ingress path type + pathType: ImplementationSpecific + +serviceAccount: + enabled: true + name: "" + annotations: {} +# iam.gke.io/gcp-service-account: my-sa-in-gke + # Add labels to the SA + labels: {} +# my-custom-label: value + +# values we use from the `jx-requirements.yml` file if we are using helmfile and helm 3 +jxRequirements: + ingress: + # shared ingress annotations on all services + annotations: {} + # kubernetes.io/ingress.class: nginx + + apiVersion: "networking.k8s.io/v1" + + # the domain for hosts + domain: "" + externalDNS: false + namespaceSubDomain: -jx. + serviceType: "" + tls: + email: "" + enabled: false + production: false + secretName: "" + + diff --git a/preview/Kptfile b/preview/Kptfile new file mode 100644 index 0000000..6e6ae8a --- /dev/null +++ b/preview/Kptfile @@ -0,0 +1,11 @@ +apiVersion: kpt.dev/v1alpha1 +kind: Kptfile +metadata: + name: preview +upstream: + type: git + git: + commit: b52b35506a05e046d54615c3ade97f3aef8bfb08 + repo: https://github.com/jenkins-x/jx3-pipeline-catalog + directory: /helm/preview + ref: master diff --git a/preview/helmfile.yaml b/preview/helmfile.yaml new file mode 100644 index 0000000..7485be5 --- /dev/null +++ b/preview/helmfile.yaml @@ -0,0 +1,31 @@ +environments: + default: + values: + - jx-values.yaml +repositories: +- name: jx3 + url: https://jenkins-x-charts.github.io/repo +releases: +- chart: jx3/jx-verify + name: jx-verify + namespace: '{{ requiredEnv "PREVIEW_NAMESPACE" }}' +- chart: '../charts/{{ requiredEnv "APP_NAME" }}' + name: preview + wait: true + createNamespace: true + namespace: '{{ requiredEnv "PREVIEW_NAMESPACE" }}' + values: + - jx-values.yaml + - values.yaml.gotmpl + hooks: + - events: ["presync"] + showlogs: true + command: "jx" + args: + - secret + - copy + - --create-namespace + - --selector + - "secret.jenkins-x.io/replica-source=true" + - --to + - '{{ requiredEnv "PREVIEW_NAMESPACE" }}' diff --git a/preview/values.yaml.gotmpl b/preview/values.yaml.gotmpl new file mode 100644 index 0000000..0283df2 --- /dev/null +++ b/preview/values.yaml.gotmpl @@ -0,0 +1,8 @@ +jxRequirements: + ingress: + namespaceSubDomain: "-pr{{ requiredEnv "PULL_NUMBER" }}." + +image: + repository: "{{ requiredEnv "DOCKER_REGISTRY" }}/{{ requiredEnv "DOCKER_REGISTRY_ORG" }}/{{ requiredEnv "APP_NAME" }}" + tag: "{{ requiredEnv "VERSION" }}" + pullPolicy: "Always"