Skip to content

Commit

Permalink
Merge pull request #25 from armory-io/lambdaconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenatwell authored Sep 26, 2023
2 parents 87035d6 + e342654 commit 02026ec
Show file tree
Hide file tree
Showing 15 changed files with 320 additions and 108 deletions.
27 changes: 24 additions & 3 deletions configuration/build-deploy-kustommizations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,36 @@ build()
echo "yq eval 'del(.metadata)' ../$DESTINATION -i"
yq eval 'del(.metadata)' ../$DESTINATION -i
echo "reordering output...."
yq eval '{"version": .version, "kind": .kind,"application": .application, "targets":.targets, "manifests":.manifests,"strategies": .strategies,"analysis": .analysis,"trafficManagement": .trafficManagement, "webhooks": .webhooks}' ../$DESTINATION -i
yq eval '{"version": .version, "kind": .kind,"application": .application, "targets":.targets, "manifests":.manifests,"artifacts":.artifacts,"providerOptions":.providerOptions,"strategies": .strategies,"analysis": .analysis,"trafficManagement": .trafficManagement, "webhooks": .webhooks, "deploymentConfig": .deploymentConfig}' ../$DESTINATION -i
yq eval '(.targets | key) line_comment="#This section defines the targets to which you are deploying, and their constraints."' ../$DESTINATION -i
yq eval '(.manifests | key) line_comment="#This section defines the Manifests you are deploying, by default they reach all targets, but you can specify certain targets if needed."' ../$DESTINATION -i
yq eval '(.strategies | key) line_comment="#This section defines the strategies environments can use to deploy."' ../$DESTINATION -i
yq eval '(.analysis | key) line_comment="#This section defines queries against your monitoring system that can be used for automated canary analysis."' ../$DESTINATION -i
yq eval '(.providerOptions | key) line_comment="#This section defines options specific to the cloud provider to which we are deploying."' ../$DESTINATION -i
yq eval '(.trafficManagement | key) line_comment="#Traffic management configuration"' ../$DESTINATION -i
yq eval '(.webhooks | key) line_comment="#Webhooks can be used to run external automation."' ../$DESTINATION -i
yq eval '.analysis.queries[].lowerLimit=0.0' ../$DESTINATION -i
if [ $3 == "lambda" ]
then
yq eval 'del(.manifests)' ../$DESTINATION -i
yq eval '.kind="lambda"' ../$DESTINATION -i
yq eval '(.artifacts | key) line_comment="#This section defines the artifacts you are deploying, by default they reach all targets, but you can specify certain targets if needed."' ../$DESTINATION -i
#temporary, remove features we do not yet support.
yq eval 'del(.strategies.myBlueGreen)' ../$DESTINATION -i
yq eval 'del(.strategies.mycanary)' ../$DESTINATION -i
yq eval 'del(.strategies.rolling)' ../$DESTINATION -i
yq eval 'del(.trafficManagement)' ../$DESTINATION -i
#end temporary
fi
if [ $3 == "k8s" ]
then
yq eval '(.manifests | key) line_comment="#This section defines the Manifests you are deploying, by default they reach all targets, but you can specify certain targets if needed."' ../$DESTINATION -i
yq eval 'del(.artifacts)' ../$DESTINATION -i
yq eval 'del(.providerOptions)' ../$DESTINATION -i
fi
}

brew install yq
build deploy-vanilla deploy.yml
build deploy-argo deploy-w-argo.yml
build deploy-vanilla deploy.yml k8s
build deploy-lambda lambda-deploy.yml lambda
build deploy-argo deploy-w-argo.yml k8s
14 changes: 7 additions & 7 deletions configuration/deploy-appTargets/potato-facts/targets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ targets: # The list of manifests sources
afterDeployment:
- runWebhook:
name: Security_Scanners
prod-eu:
prod-eu (blue-green):
# the name of an agent configured account
account: demo-prod-eu-cluster
# Optionally override the namespaces that are in the manifests
Expand All @@ -55,7 +55,7 @@ targets: # The list of manifests sources
afterDeployment:
- runWebhook:
name: Send_Slack_Deployment_Complete
prod-west:
prod-west (canary-pod):
# the name of an agent configured account
account: demo-prod-west-cluster
# Optionally override the namespaces that are in the manifests
Expand All @@ -74,7 +74,7 @@ targets: # The list of manifests sources
afterDeployment:
- runWebhook:
name: Send_Slack_Deployment_Complete
prod-east:
prod-east (canary-smi):
# the name of an agent configured account
account: demo-prod-west-cluster
# Optionally override the namespaces that are in the manifests
Expand All @@ -93,7 +93,7 @@ targets: # The list of manifests sources
afterDeployment:
- runWebhook:
name: Send_Slack_Deployment_Complete
prod-apac:
prod-apac (canary-istio):
account: demo-prod-west-cluster
constraints:
afterDeployment:
Expand All @@ -112,11 +112,11 @@ targets: # The list of manifests sources
namespace: borealis-prod-apac
strategy: mycanary
trafficManagement:
- targets: [prod-east]
- targets: [prod-east (canary-smi)]
smi:
- rootServiceName: potato-facts-external
- rootServiceName: potato-lies-external
- targets: [prod-eu]
- targets: [prod-eu (blue-green)]
kubernetes:
- activeService: potato-facts-external
previewService: potato-facts-internal
Expand All @@ -134,4 +134,4 @@ trafficManagement:
name: potato-lies-external
activeSubsetName: v1
targets:
- prod-apac
- prod-apac (canary-istio)
12 changes: 6 additions & 6 deletions configuration/deploy-argo/baseDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ targets:
beforeDeployment:
- pause:
untilApproved: true
requiresRoles:
requiresRoles:
- Organization Admin
afterDeployment:
- runWebhook:
name: Refer to Argo Rollouts for status
manifests: # The map of strategies, a deployment target will reference one of these
- path: manifests/potato-facts.yml
targets: ["infosec", "staging", "dev",prod-west, prod-eu, prod-east, prod-apac]
targets: ["infosec", "staging", "dev",prod-west (canary-pod), prod-eu (blue-green), prod-east (canary-smi), prod-apac (canary-istio)]
- path: manifests/argo-facts.yml
targets: ["prod-operator"]
- path: manifests/potato-facts-external-service.yml
targets: ["prod-operator",prod-west, prod-eu, prod-east, prod-apac]
targets: ["prod-operator",prod-west (canary-pod), prod-eu (blue-green), prod-east (canary-smi),prod-apac (canary-istio)]
- path: manifests/potato-facts-internal-service.yml
targets: [dev,staging,infosec,prod-eu]
targets: [dev,staging,infosec,prod-eu (blue-green)]
- path: manifests/potato-lies.yml
targets: ["infosec", "staging", "dev",prod-west, prod-eu, prod-east, prod-apac]
targets: ["infosec", "staging", "dev",prod-west (canary-pod), prod-eu (blue-green), prod-east (canary-smi), prod-apac (canary-istio)]
- path: manifests/istio-files/
targets:
- prod-apac
- prod-apac (canary-istio)
webhooks:
- name: Refer to Argo Rollouts for status
method: POST
Expand Down
47 changes: 47 additions & 0 deletions configuration/deploy-lambda/baseDeploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: v1
kind: kubernetes
metadata:
name: deploymentConfig
application: potatolessFacts
description: awsLambda
context:
key: value
deploymentConfig:
timeout:
unit: minutes
duration: 30
targets:
armory-product-demos:
account: arn:aws:iam::957626022434:role/ArmoryRole
strategy: allAtOnce
deployAsIamRole: "arn:aws:iam::957626022434:role/ArmoryRole"
region: us-east-2
constraints:
afterDeployment:
- runWebhook:
name: Integration_Tests
beforeDeployment:
- runWebhook:
name: Send_Slack_Deployment_Approval_Required
strategies:
allAtOnce:
canary:
steps:
- setWeight:
weight: 100
- runWebhook:
name: Send_Slack_Deployment_Approval_Required
artifacts:
- functionName: CdkSandboxStack-WidgetsWidgetHandler1BC9DB34-Ir3DzIVJh74G #WidgetsWidgetHandler1BC9DB34
path: s3://cdk-hnb659fds-assets-957626022434-us-east-2/71dec8493297ae732c123fb4aea7dae0
type: zipFile
webhooks: []
providerOptions:
lambda:
- name: CdkSandboxStack-WidgetsWidgetHandler1BC9DB34-Ir3DzIVJh74G #WidgetsWidgetHandler1BC9DB34
target: armory-product-demos
runAsIamRole: "arn:aws:iam::957626022434:role/CdkSandboxStack-WidgetsWidgetHandlerServiceRole8C2-14A5P01L3VA1Q"
handler: index.handler
runtime: nodejs18.x


14 changes: 14 additions & 0 deletions configuration/deploy-lambda/kustomization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

#namespace: spinnaker

components:
- ../deploy-shared
#- ../deploy-appTargets/potato-facts

resources:
- baseDeploy.yml

generatorOptions:
disableNameSuffixHash: true
2 changes: 1 addition & 1 deletion configuration/deploy-shared/queries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ analysis:
queryTemplate: avg (avg_over_time(container_cpu_system_seconds_total{job="kubelet"}[{{armory.promQlStepInterval}}])
* on (pod) group_left (annotation_app) sum(kube_pod_annotations{job="kube-state-metrics",annotation_deploy_armory_io_replica_set_name="{{armory.replicaSetName}}"})
by (annotation_app, pod)) by (annotation_app) OR on() vector(0)
upperLimit: 10000
upperLimit: 10000.1
- lowerLimit: 0
name: avgCPUUsage-fail
queryTemplate: "avg (avg_over_time(container_cpu_system_seconds_total{job=\"kubelet\"}[{{armory.promQlStepInterval}}])
Expand Down
4 changes: 3 additions & 1 deletion configuration/deploy-shared/strategies.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

version: v1
kind: kubernetes
metadata:
name: deploymentConfig
deploymentConfig:
keepDeploymentObject: true
strategies:
rolling:
canary:
Expand Down Expand Up @@ -97,5 +98,6 @@ strategies:
units: seconds
numberOfJudgmentRuns: 1
rollBackMode: manual
rollForwardMode: automatic
queries:
- avgCPUUsage-pass
6 changes: 3 additions & 3 deletions configuration/deploy-vanilla/baseDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ manifests: # The map of strategies, a deployment target will reference one of t
# This will read all yaml|yml files in a dir and deploy all manifests in that directory to all targets.
- path: manifests/potato-facts.yml
- path: manifests/potato-facts-external-service.yml
targets: [prod-west, prod-eu, prod-east,prod-apac]
targets: [prod-west (canary-pod), prod-eu (blue-green), prod-east (canary-smi),prod-apac (canary-istio)]
- path: manifests/potato-facts-internal-service.yml
targets: [dev,staging,infosec,prod-eu,prod-apac]
targets: [dev,staging,infosec,prod-eu (blue-green)]
- path: manifests/potato-lies.yml
- path: manifests/istio-files
targets: [prod-apac]
targets: [prod-apac (canary-istio)]
webhooks: []


Loading

0 comments on commit 02026ec

Please sign in to comment.