Π·Π΅ΡΠΊΠ°Π»ΠΎ ΠΈΠ· https://github.com/Azure/draft-classic.git
feat(rust): add rust support to Draft π
This commit is contained in:
Π ΠΎΠ΄ΠΈΡΠ΅Π»Ρ
cedded7d28
ΠΠΎΠΌΠΌΠΈΡ
0a4f67e776
|
@ -0,0 +1,5 @@
|
|||
Dockerfile
|
||||
draft.toml
|
||||
chart/
|
||||
NOTICE
|
||||
target
|
|
@ -0,0 +1,10 @@
|
|||
FROM rust:1.19.0
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
COPY . /usr/src/app
|
||||
RUN cargo install && cargo build
|
||||
|
||||
ENV PORT 8080
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["cargo", "run", "-q"]
|
|
@ -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
|
|
@ -0,0 +1,4 @@
|
|||
name: rust
|
||||
description: A Helm chart for Kubernetes
|
||||
apiVersion: v1
|
||||
version: v0.1.0
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
{{- if contains "NodePort" .Values.service.type }}
|
||||
Get the application URL by running these commands:
|
||||
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/login
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
Get the application URL by running these commands:
|
||||
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 }}
|
||||
http://{{ .Release.Name }}.{{ .Values.basedomain }} to access your application
|
||||
{{- end }}
|
|
@ -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 -}}
|
|
@ -0,0 +1,23 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}
|
||||
labels:
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
|
||||
draft: {{ default "draft-app" .Values.draft }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "fullname" . }}
|
||||
draft: {{ default "draft-app" .Values.draft }}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.service.internalPort }}
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 12 }}
|
|
@ -0,0 +1,17 @@
|
|||
{{- if .Values.ingress.enabled -}}
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}
|
||||
labels:
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
|
||||
spec:
|
||||
rules:
|
||||
- host: {{ .Release.Name }}.{{ .Values.basedomain }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
backend:
|
||||
serviceName: {{ template "fullname" . }}
|
||||
servicePort: {{ .Values.service.externalPort }}
|
||||
{{- end -}}
|
|
@ -0,0 +1,15 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}
|
||||
labels:
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.externalPort }}
|
||||
targetPort: {{ .Values.service.internalPort }}
|
||||
protocol: TCP
|
||||
name: {{ .Values.service.name }}
|
||||
selector:
|
||||
app: {{ template "fullname" . }}
|
|
@ -0,0 +1,20 @@
|
|||
# Default values for Swift.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare variables to be passed into your templates.
|
||||
replicaCount: 2
|
||||
image:
|
||||
repository: rust
|
||||
tag: latest
|
||||
pullPolicy: IfNotPresent
|
||||
service:
|
||||
name: rust
|
||||
type: ClusterIP
|
||||
externalPort: 80
|
||||
internalPort: 8080
|
||||
resources:
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
BUILD_DIR=$1
|
||||
|
||||
# Exit early if app is clearly not Rust.
|
||||
if [ ! -f $BUILD_DIR/Cargo.lock ] && [ ! -f $BUILD_DIR/Cargo.toml ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo Rust
|
ΠΠ°Π³ΡΡΠ·ΠΊΠ°β¦
Π‘ΡΡΠ»ΠΊΠ° Π² Π½ΠΎΠ²ΠΎΠΉ Π·Π°Π΄Π°ΡΠ΅