Skip to content

Commit

Permalink
Feature/support aks (#61)
Browse files Browse the repository at this point in the history
* remove secrets and streamline

* fix indentation bug
  • Loading branch information
johnazariah authored Oct 22, 2020
1 parent 32eeb5c commit 693ee4e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 28 deletions.
20 changes: 9 additions & 11 deletions templates/webapi-directclient/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@
-include Setup.cfg

# project name
project ?=GeneratedProjectName
project-lc:=$(shell echo $(project) | tr A-Z a-z)
project ?=GeneratedProjectName
project-lc :=$(shell echo $(project) | tr A-Z a-z)

# project configuration
config ?=Debug
config ?=Debug

#
#

# container name
acr ?=local
git_branch ?=$(subst /,--,$(shell git rev-parse --abbrev-ref HEAD))
git_latest_hash ?=$(shell git log -1 --pretty=format:"%h")
image_tag ?=$(git_branch).$(git_latest_hash)

container_name ?=$(acr)/$(project-lc):$(image_tag)
oaks_acr_login_server ?=local
git_branch ?=$(subst /,--,$(shell git rev-parse --abbrev-ref HEAD))
git_latest_hash ?=$(shell git log -1 --pretty=format:"%h")
image_tag ?=$(git_branch).$(git_latest_hash)
container_name ?=$(oaks_acr_login_server)/$(project-lc):$(image_tag)

# k8s namespace
k8s_namespace=green
Expand Down Expand Up @@ -160,15 +159,14 @@ list-config:
@echo "sub : "[$(sub)]
@echo "region : "[$(region)]
@echo "org : "[$(org)]
@echo "acr : "[$(acr)]
@echo "container_name : "[$(container_name)]
@echo
@echo "oaks_name : "[$(oaks_name)]
@echo "oaks_resource_group : "[$(oaks_resource_group)]
@echo "oaks_keyvault : "[$(oaks_keyvault)]
@echo "oaks_lawks : "[$(oaks_lawks)]
@echo "oaks_acr : "[$(oaks_acr)]
@echo "oaks_acr_login : "[$(oaks_acr_login_server)]
@echo "oaks_acr_login_server : "[$(oaks_acr_login_server)]
@echo
@echo "paks_resource_group : "[$(paks_resource_group)]
@echo "paks_keyvault : "[$(paks_keyvault)]
Expand Down
30 changes: 24 additions & 6 deletions templates/webapi-directclient/Setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

# This file is included by the Makefile, and is in Makefile syntax

#
# IMPORTANT - please fill this value appropriately
#
# The 'sub' variable refers to the active subscription you want to use.
# You can get this from:
# 1. the portal
Expand All @@ -11,8 +14,12 @@
#
# e.g.
# sub=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
sub=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
#
sub=

#
# IMPORTANT - please fill this value appropriately
#
# The 'org' variable refers to your organization name.
# You should use a version of your organization name that has 6-20 lowercase alphanumerics. (Only [a-z][0-9] allowed.)
# This organization name should be sufficiently random that it results in a unique ACR name, so you should consider
Expand All @@ -21,7 +28,7 @@ sub=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
#
# e.g.
# org="jaz013468"
org=jsa013468
org=

# The 'region' variable refers to the azure region you want your resources to be created in.
#
Expand All @@ -42,7 +49,6 @@ oaks_keyvault=kv-$(oaks_name)
oaks_lawks=lawks-$(oaks_name)
oaks_acr=$(shell echo """acr$(org-lc)$(oaks)""" | cut -c1-45 | tr A-Z a-z)
oaks_acr_login_server=$(oaks_acr).azurecr.io
acr=$(oaks_acr_login_server)

project :=GeneratedProjectName
project-lc:=$(shell echo $(project) | tr A-Z a-z)
Expand All @@ -54,17 +60,29 @@ paks_cluster=aks-$(paks_name)
paks_storage=$(shell echo """stg$(org-lc)$(project-lc)""" | cut -c1-45 | tr A-Z a-z)
paks_storage_secret=secret-$(paks_storage)

#
# IMPORTANT - please fill this value appropriately
#
# Secrets like this are why we have included this file in .gitignore
#
# The 'paks_storage_connection_string' variable contains the connection string to the storage account above.
# From the docker container, run `make paks-get-storage-connection-string` and carefully copy the value and put it into this file, and save it!
#
# Secrets like this are why we have included this file in .gitignore
paks_storage_connection_string=DefaultEndpointsProtocol="https;EndpointSuffix=core.windows.net;AccountName=stgjaz013468ricekrispie;AccountKey=Wcu+JI7/vP2zYthGpL6wUpEPqZT/u1g6f8K9sVsYq5ZgfY436Cw4gzaQ56eZcDdBESlyWgSXZXpmMEzD8XiQUQ=="
# e.g.
# paks_storage_connection_string="DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=...;AccountKey=..."
paks_storage_connection_string=


#
# IMPORTANT - please fill this value appropriately
#
# Secrets like this are why we have included this file in .gitignore
#
# The 'oaks_acr_login_token' variable is used to log into the ACR when you do not have the 'az cli' installed,
# such as when the 'az cli' is being run from within a docker container.
#
# From the docker container, run `make oaks-login-acr` and carefully copy the value and put it into this file, and save it!
#
# Secrets like this are why we have included this file in .gitignore
# e.g.
# oaks_acr_login_token=...
oaks_acr_login_token=
22 changes: 11 additions & 11 deletions templates/webapi-directclient/k8s-deployment.ymlt
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ spec:
requests:
memory: "128Mi"
cpu: "500m"
env:
- name: ENV_CLUSTER_AZURE_STORAGE
valueFrom:
secretKeyRef:
name: {storage-secret-name}
key: connection-string
- name: ENV_PERSISTENCE_AZURE_STORAGE
valueFrom:
secretKeyRef:
name: {storage-secret-name}
key: connection-string
env:
- name: ENV_CLUSTER_AZURE_STORAGE
valueFrom:
secretKeyRef:
name: {storage-secret-name}
key: connection-string
- name: ENV_PERSISTENCE_AZURE_STORAGE
valueFrom:
secretKeyRef:
name: {storage-secret-name}
key: connection-string
ports:
- name: http
containerPort: 80
Expand Down

0 comments on commit 693ee4e

Please sign in to comment.