-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#513] restore PTPA changes to feature branch
To allow for the dev branch to be released, the changes in this commit were reverted and moved to this feature branch. The original work was done in the following tickets: - #483 (9b4c2b6) merged in #487 - #483 (33b597a) merged in #489 - #488 (5bf5151) merged in #493
- Loading branch information
1 parent
4f1faaf
commit 7d75a0f
Showing
10 changed files
with
224 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...type/src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/.helmignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pom.xml | ||
target |
9 changes: 9 additions & 0 deletions
9
...etype/src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/Chart.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v2 | ||
name: "${parentArtifactId}" | ||
version: "${version}" | ||
appVersion: "${version}" | ||
|
||
dependencies: | ||
- name: aissemble-infrastructure-chart | ||
version: ${archetypeVersion} | ||
repository: oci://ghcr.io/boozallen |
28 changes: 28 additions & 0 deletions
28
...rchetype/src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" | ||
xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>${groupId}</groupId> | ||
<artifactId>${parentArtifactId}</artifactId> | ||
<version>${version}</version> | ||
</parent> | ||
|
||
<artifactId>${parentArtifactId}-infrastructure</artifactId> | ||
<name>${projectName}::Infrastructure</name> | ||
<description>Contains the infrastructure artifacts for ${projectName}</description> | ||
<packaging>helm</packaging> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>${group.helm.plugin}</groupId> | ||
<artifactId>helm-maven-plugin</artifactId> | ||
<extensions>true</extensions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
21 changes: 21 additions & 0 deletions
21
.../src/main/resources/archetype-resources/__rootArtifactId__-infrastructure/values-dev.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Deploys ArgoCD with anonymous admin access enabled. | ||
# ArgoCD will be available at http://localhost:30080/ | ||
aissemble-infrastructure-chart: | ||
jenkins: | ||
enabled: false | ||
ingress-nginx: | ||
enabled: false | ||
argo-cd: | ||
crds: | ||
keep: false | ||
configs: | ||
cm: | ||
admin.enabled: false | ||
users.anonymous.enabled: true | ||
rbac: | ||
policy.default: "role:admin" | ||
server: | ||
ingress: | ||
enabled: false | ||
service: | ||
type: "NodePort" |
Empty file.
88 changes: 88 additions & 0 deletions
88
foundation/foundation-archetype/src/main/resources/archetype-resources/deploy.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/bin/sh | ||
|
||
APP_NAME=${artifactId} | ||
INFRA_NAME=infrastructure | ||
|
||
print_usage() { | ||
echo "Usage: $0 [up|down|shutdown]" | ||
echo " startup create/upgrade deployment infrastructure" | ||
echo " shutdown tear down deployment infrastructure (tears down application if needed)" | ||
echo " up deploy application (starts deployment infrastructure if needed)" | ||
echo " down tear down application" | ||
} | ||
|
||
startup() { | ||
echo "Deploying infrastructure..." | ||
helm upgrade --install $INFRA_NAME ${artifactId}-infrastructure \ | ||
--values ${artifactId}-infrastructure/values.yaml \ | ||
--values ${artifactId}-infrastructure/values-dev.yaml | ||
if ! kubectl rollout status --namespace argocd deployment/argocd-server --timeout=30s; then | ||
exit $? | ||
fi | ||
argocd repo add ${projectGitUrl} --server localhost:30080 --plaintext --insecure-skip-server-verification | ||
} | ||
|
||
is_app_running() { | ||
argocd app get $APP_NAME --server localhost:30080 --plaintext > /dev/null 2>&1 | ||
} | ||
|
||
deploy() { | ||
echo "Checking for deployment infrastructure..." | ||
helm status $INFRA_NAME > /dev/null 2>&1 | ||
if [ $? -ne 0 ]; then | ||
startup | ||
fi | ||
|
||
if is_app_running; then | ||
echo "${artifactId} is deployed" | ||
else | ||
branch=$(git rev-parse --abbrev-ref HEAD) | ||
echo "Deploying ${artifactId} from branch '$branch'..." | ||
argocd app create $APP_NAME \ | ||
--server localhost:30080 --plaintext \ | ||
--dest-namespace ${artifactId} \ | ||
--dest-server https://kubernetes.default.svc \ | ||
--repo ${projectGitUrl} \ | ||
--path ${artifactId}-deploy/src/main/resources \ | ||
--revision $branch \ | ||
--helm-set spec.targetRevision=$branch \ | ||
--values values.yaml \ | ||
--values values-dev.yaml \ | ||
--sync-policy automated | ||
fi | ||
} | ||
|
||
down() { | ||
if is_app_running; then | ||
echo "Tearing down app..." | ||
argocd app delete $APP_NAME --server localhost:30080 --plaintext --yes | ||
else | ||
echo "${artifactId} is not deployed" | ||
fi | ||
} | ||
|
||
shutdown() { | ||
helm status $INFRA_NAME > /dev/null 2>&1 | ||
if [ $? -ne 0 ]; then | ||
echo "Infrastructure already shutdown" | ||
else | ||
if is_app_running; then | ||
down | ||
fi | ||
echo "Shutting down infrastructure..." | ||
helm uninstall $INFRA_NAME | ||
fi | ||
} | ||
|
||
|
||
if [ "$1" = "up" ]; then | ||
deploy | ||
elif [ "$1" = "down" ]; then | ||
down | ||
elif [ "$1" = "shutdown" ]; then | ||
shutdown | ||
elif [ "$1" = "startup" ]; then | ||
startup | ||
else | ||
print_usage | ||
fi |