Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into alekp_kubeflow_tensorflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandr Panchul committed Jun 17, 2020
2 parents 2986259 + 66613f0 commit 6254532
Show file tree
Hide file tree
Showing 56 changed files with 2,617 additions and 4 deletions.
298 changes: 298 additions & 0 deletions AKSe-on-AzStackHub/DEPLOYMENT.md

Large diffs are not rendered by default.

370 changes: 370 additions & 0 deletions AKSe-on-AzStackHub/README.md

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions AKSe-on-AzStackHub/application/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Overview

> This page is part of the "[Deploying Kubernetes Clusters on Azure Stack Hub](/README.md)" deployment guide.
The demo application is based on the [Azure Kubernetes Service Workshop](https://docs.microsoft.com/en-us/learn/modules/aks-workshop/).

## Application

It is a 3-Tier Web Application using NodeJS and mongoDB:

![application architecture](https://docs.microsoft.com/en-us/learn/modules/aks-workshop/media/01-app-overview.svg)

You can find the application components on GitHub:

* [MicrosoftDocs/mslearn-aks-workshop-ratings-web](https://github.com/MicrosoftDocs/mslearn-aks-workshop-ratings-web)
* [MicrosoftDocs/mslearn-aks-workshop-ratings-api](https://github.com/MicrosoftDocs/mslearn-aks-workshop-ratings-api)

### Container Images

We've as part of this pattern pre-build the Docker container images for you:

* [demo-rating-api](https://hub.docker.com/repository/docker/heoelri/demo-rating-api)
* [demo-rating-web](https://hub.docker.com/repository/docker/heoelri/demo-rating-web)
* [demo-rating-mongodb](https://hub.docker.com/repository/docker/heoelri/demo-rating-mongodb)

The subdirectory mongodb contains a Dockerfile based on mongo (from docker hub) with sample data from [here](https://github.com/MicrosoftDocs/mslearn-aks-workshop-ratings-api/tree/master/data).

### Helm Chart

This directory also contains a helm chart to deploy the whole application.
6 changes: 6 additions & 0 deletions AKSe-on-AzStackHub/application/helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: ratings
description: ratings application
version: 0.0.0 # is overriden by the build id
appVersion: 0.0.1
apiVersion: "v2"
kubeVersion: ">=1.14.0"
73 changes: 73 additions & 0 deletions AKSe-on-AzStackHub/application/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ratings-web
labels:
app: ratings-web
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
spec:
replicas: 1
selector:
matchLabels:
app: ratings-web
template:
metadata:
labels:
app: ratings-web
#annotations:
spec:
containers:
- name: ratings-web
image: {{ .Values.container.registry }}/{{ .Values.frontend.image }}:{{ .Values.frontend.tag }}
ports:
- containerPort: {{ int .Values.frontend.port }}
imagePullPolicy: Always
resources:
limits:
cpu: "125m"
#memory: "300Mi"
requests:
cpu: "25m"
#memory: "50Mi"
env:
- name: API
value: ratings-api:80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ratings-api
labels:
app: ratings-api
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
spec:
replicas: 1
selector:
matchLabels:
app: ratings-api
template:
metadata:
labels:
app: ratings-api
#annotations:
spec:
containers:
- name: ratings-api
image: {{ .Values.container.registry }}/{{ .Values.midtier.image }}:{{ .Values.midtier.tag }}
ports:
- containerPort: {{ int .Values.midtier.port }}
imagePullPolicy: Always
resources:
limits:
cpu: "125m"
#memory: "300Mi"
requests:
cpu: "25m"
#memory: "50Mi"
env:
- name: MONGODB_URI
value: mongodb://{{ .Values.database.user }}:{{ .Values.database.pass }}@ratings-mongodb:27017/admin
15 changes: 15 additions & 0 deletions AKSe-on-AzStackHub/application/helm/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ratings-web
labels:
app: ratings-web
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
backend:
serviceName: ratings-web
servicePort: 80
48 changes: 48 additions & 0 deletions AKSe-on-AzStackHub/application/helm/templates/mongodb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
## Generate a key
# openssl rand -base64 741 > mongodb-keyfile
## Create k8s secrets
# kubectl create secret generic mongo-key --from-file=mongodb-keyfile
# https://gist.github.com/thilinapiy/0c5abc2c0c28efe1bbe2165b0d8dc115
---
apiVersion: v1
kind: Service
metadata:
name: ratings-mongodb
labels:
name: ratings-mongo
app: ratings-mongo
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
spec:
ports:
- port: 27017
targetPort: {{ .Values.database.port }}
clusterIP: None
selector:
role: ratings-mongo
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: ratings-mongodb
spec:
serviceName: ratings-mongodb
replicas: 1
selector:
matchLabels:
app: ratings-mongodb
template:
metadata:
labels:
app: ratings-mongodb
selector: mongodb-standalone
spec:
containers:
- name: mongodb-standalone
image: {{ .Values.database.image }}:{{ .Values.database.tag }}
env:
- name: MONGO_INITDB_ROOT_USERNAME
value: {{ .Values.database.user }}
- name: MONGO_INITDB_ROOT_PASSWORD
value: {{ .Values.database.pass }}
35 changes: 35 additions & 0 deletions AKSe-on-AzStackHub/application/helm/templates/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
kind: Service
apiVersion: v1
metadata:
name: ratings-web
labels:
app: ratings-web
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
spec:
selector:
app: ratings-web
ports:
- protocol: TCP
port: 80
targetPort: {{ int .Values.frontend.port }}
type: ClusterIP
---
kind: Service
apiVersion: v1
metadata:
name: ratings-api
labels:
app: ratings-api
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
spec:
selector:
app: ratings-api
ports:
- protocol: TCP
port: 80
targetPort: {{ int .Values.midtier.port }}
type: ClusterIP
19 changes: 19 additions & 0 deletions AKSe-on-AzStackHub/application/helm/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
container:
registry: "heoelri"

frontend:
image: "demo-rating-web"
tag: "latest"
port: 8080

midtier:
image: "demo-rating-api"
tag: "latest"
port: 80

database:
image: "mongo" #"demo-rating-mongodb"
tag: "4.0.8" # "latest"
port: 27017
user: "admin"
pass: "password"
8 changes: 8 additions & 0 deletions AKSe-on-AzStackHub/application/mongodb/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM mongo:3.4.24-xenial

RUN apt update; apt upgrade -y

RUN mkdir /app
WORKDIR /app

COPY . .
6 changes: 6 additions & 0 deletions AKSe-on-AzStackHub/application/mongodb/data/items.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{"name":"Banana","uid":1.0,"img":"/static/img/fruits/banana.jpeg"},
{"name":"Coconut","uid":2.0,"img":"/static/img/fruits/coconut.jpeg"},
{"name":"Oranges","uid":3.0,"img":"/static/img/fruits/oranges.jpeg"},
{"name":"Pineapple","uid":4.0,"img":"/static/img/fruits/pineapple.jpeg"}
]
15 changes: 15 additions & 0 deletions AKSe-on-AzStackHub/application/mongodb/data/ratings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
{"_id":{"oid":"5a4fbd21e1af3aa7cfcd74c1"},"raterIp":"47.201.183.55","itemRated":[{"oid":"5a4f97cddbbb7e24bd9a13d5"}],"timestamp":{"date":"2018-01-05T18:00:01.984Z"},"rating":5,"__v":0},
{"_id":{"oid":"5a4fbd21e1af3aa7cfcd74c3"},"raterIp":"47.201.183.55","itemRated":[{"oid":"5a4f97e7dbbb7e24bd9a13d7"}],"timestamp":{"date":"2018-01-05T18:00:01.989Z"},"rating":5,"__v":0},
{"_id":{"oid":"5a4fbd21e1af3aa7cfcd74c2"},"raterIp":"47.201.183.55","itemRated":[{"oid":"5a4f97dcdbbb7e24bd9a13d6"}],"timestamp":{"date":"2018-01-05T18:00:01.989Z"},"rating":5,"__v":0},
{"_id":{"oid":"5a4fbd21e1af3aa7cfcd74c4"},"raterIp":"47.201.183.55","itemRated":[{"oid":"5a4f97f0dbbb7e24bd9a13d8"}],"timestamp":{"date":"2018-01-05T18:00:01.989Z"},"rating":5,"__v":0},
{"_id":{"oid":"5a4fbd58e1af3aa7cfcd74c7"},"raterIp":"47.201.183.55","itemRated":[{"oid":"5a4f97e7dbbb7e24bd9a13d7"}],"timestamp":{"date":"2018-01-05T18:00:56.302Z"},"rating":4,"__v":0},
{"_id":{"oid":"5a4fbd58e1af3aa7cfcd74c5"},"raterIp":"47.201.183.55","itemRated":[{"oid":"5a4f97cddbbb7e24bd9a13d5"}],"timestamp":{"date":"2018-01-05T18:00:56.301Z"},"rating":5,"__v":0},
{"_id":{"oid":"5a4fbd58e1af3aa7cfcd74c8"},"raterIp":"47.201.183.55","itemRated":[{"oid":"5a4f97f0dbbb7e24bd9a13d8"}],"timestamp":{"date":"2018-01-05T18:00:56.302Z"},"rating":4,"__v":0},
{"_id":{"oid":"5a4fcaf8e1af3aa7cfcd7504"},"raterIp":"47.201.183.55","itemRated":[{"oid":"5a4f97f0dbbb7e24bd9a13d8"}],"timestamp":{"date":"2018-01-05T18:59:04.023Z"},"rating":4,"__v":0},
{"_id":{"oid":"5a4fcaf8e1af3aa7cfcd7502"},"raterIp":"47.201.183.55","itemRated":[{"oid":"5a4f97dcdbbb7e24bd9a13d6"}],"timestamp":{"date":"2018-01-05T18:59:04.023Z"},"rating":4,"__v":0},
{"_id":{"oid":"5a4fcb1ce1af3aa7cfcd7507"},"raterIp":"47.201.183.55","itemRated":[{"oid":"5a4f97e7dbbb7e24bd9a13d7"}],"timestamp":{"date":"2018-01-05T18:59:40.136Z"},"rating":4,"__v":0},
{"_id":{"oid":"5a4fcb1ce1af3aa7cfcd7508"},"raterIp":"47.201.183.55","itemRated":[{"oid":"5a4f97f0dbbb7e24bd9a13d8"}],"timestamp":{"date":"2018-01-05T18:59:40.136Z"},"rating":4,"__v":0},
{"_id":{"oid":"5a4fcb1ce1af3aa7cfcd7506"},"raterIp":"47.201.183.55","itemRated":[{"oid":"5a4f97dcdbbb7e24bd9a13d6"}],"timestamp":{"date":"2018-01-05T18:59:40.136Z"},"rating":3,"__v":0},
{"_id":{"oid":"5a4fcb1ce1af3aa7cfcd7505"},"raterIp":"47.201.183.55","itemRated":[{"oid":"5a4f97cddbbb7e24bd9a13d5"}],"timestamp":{"date":"2018-01-05T18:59:40.136Z"},"rating":5,"__v":0}
]
23 changes: 23 additions & 0 deletions AKSe-on-AzStackHub/application/mongodb/data/sites.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
{
"name": "Fruit Smoothies",
"shortCode": "FR",
"pages": {
"Home": {
"title": "Fruit Smoothies :: Project Homepage",
"headerImage": "/static/img/fruits/smoothies.jpeg",
"subtitle": "Fruit Smoothies - Project Homepage"
},
"Rating": {
"title": "Fruit Smoothies :: Rate the Superheroes",
"headerImage": "/static/img/fruits/smoothies.jpeg",
"subtitle": "Rate the smoothies"
},
"Leaderboard": {
"title": "Fruit Smoothies :: Current Leaderboard",
"headerImage": "/static/img/fruits/smoothies.jpeg",
"subtitle": "Current Leaderboard - Orange smoothie? Yuck."
}
}
}
]
31 changes: 31 additions & 0 deletions AKSe-on-AzStackHub/application/mongodb/mongo.build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Docker
# Build a Docker image
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker

trigger:
- master

resources:
- repo: self

variables:
tag: '$(Build.BuildId)'

stages:
- stage: Build
displayName: Build image
jobs:
- job: Build
displayName: Build
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Docker@2
inputs:
containerRegistry: 'dockerhub'
repository: 'heoelri/demo-rating-mongodb'
command: 'buildAndPush'
Dockerfile: '$(Build.SourcesDirectory)/application/mongodb/Dockerfile'
tags: |
$(Build.BuildId)
latest
Binary file added AKSe-on-AzStackHub/img/aks-azure-architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AKSe-on-AzStackHub/img/aksengine-vm-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AKSe-on-AzStackHub/img/azuremonitor_on_stack1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions AKSe-on-AzStackHub/msp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Partner Solutions
There are Microsoft Partner solutions that can extend the capabilities of Azure Stack Hub. This document includes some that have been found useful in deployments of applications running on Kubernetes clusters.

## Storage and Data solutions

As described in the overview section of the sample solution, Azure Stack Hub currently does not have a native solution to replicate storage across multiple Azure Stack Hub instances. Unlike in Azure, the capability of replicating storage across multiple regions does not exist - each instance is its own distinct cloud. However, solutions are available from Microsoft Partners that enable storage replication across Azure Stack Hubs and Azure.


**SCALITY**

Scality delivers web-scale storage that has powered digital businesses since 2009. The Scality RING, our software-defined storage, turns commodity x86 servers into an unlimited storage pool for any type of data –file and object– at petabyte scale.

https://www.scality.com/

**CLOUDIAN**

Cloudian simplifies enterprise storage with limitlessly scalable storage that consolidates massive data sets to a single, easily managed environment.

https://www.cloudian.com/
Loading

0 comments on commit 6254532

Please sign in to comment.