forked from keptn/lifecycle-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: guide for multi stage delivery (keptn#3080)
Signed-off-by: Florian Bacher <[email protected]> Co-authored-by: Moritz Wiesinger <[email protected]>
- Loading branch information
Showing
14 changed files
with
603 additions
and
0 deletions.
There are no files selected for viewing
101 changes: 101 additions & 0 deletions
101
docs/docs/guides/assets/multi-stage-delivery/application-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,101 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: podtato-head-frontend | ||
namespace: podtato-head-dev | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: podtato-head-frontend | ||
template: | ||
metadata: | ||
labels: | ||
app: podtato-head-frontend | ||
app.kubernetes.io/name: podtato-head-frontend | ||
app.kubernetes.io/part-of: podtato-head | ||
app.kubernetes.io/version: {{.Values.serviceVersion}} | ||
spec: | ||
containers: | ||
- image: ghcr.io/podtato-head/podtato-server:{{.Values.serviceVersion}} | ||
name: podtato-head-service | ||
imagePullPolicy: Always | ||
ports: | ||
- containerPort: 9000 | ||
name: http | ||
protocol: TCP | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app.kubernetes.io/part-of: podtato-head | ||
name: podtato-head-frontend | ||
namespace: podtato-head-dev | ||
spec: | ||
ports: | ||
- name: http | ||
port: 8080 | ||
targetPort: 9000 | ||
protocol: TCP | ||
selector: | ||
app: podtato-head-frontend | ||
type: ClusterIP | ||
--- | ||
apiVersion: lifecycle.keptn.sh/v1beta1 | ||
kind: KeptnAppContext | ||
metadata: | ||
name: podtato-head | ||
namespace: podtato-head-dev | ||
spec: | ||
postDeploymentTasks: | ||
- post-deployment | ||
promotionTasks: | ||
- promote | ||
metadata: | ||
commitID: {{.Values.commitID}} | ||
--- | ||
apiVersion: lifecycle.keptn.sh/v1beta1 | ||
kind: KeptnTaskDefinition | ||
metadata: | ||
name: post-deployment | ||
namespace: podtato-head-dev | ||
spec: | ||
function: | ||
inline: | ||
code: | | ||
console.log("deployment completed"); | ||
--- | ||
apiVersion: lifecycle.keptn.sh/v1beta1 | ||
kind: KeptnTaskDefinition | ||
metadata: | ||
name: promote | ||
namespace: podtato-head-dev | ||
spec: | ||
function: | ||
secureParameters: | ||
secret: github-token | ||
inline: | ||
code: | | ||
let secureDataText = Deno.env.get("SECURE_DATA"); | ||
let secureData; | ||
if (secureDataText != "") { | ||
secureData = JSON.parse(secureDataText); | ||
} | ||
let contextText = Deno.env.get("KEPTN_CONTEXT"); | ||
let context; | ||
if (contextText != "") { | ||
context = JSON.parse(contextText); | ||
} | ||
let body = `{"ref":"main","inputs":{"traceParent":"${context.metadata.traceparent}"}}`; | ||
let resp = await fetch( | ||
"https://api.github.com/repos/" + secureData.githubRepoOwner + "/" + secureData.githubRepo + "/actions/workflows/promote.yaml/dispatches", | ||
{ | ||
method: "POST", | ||
body: body, | ||
headers: { | ||
'Accept': 'application/vnd.github+json', | ||
'Authorization': `Bearer ${secureData.apiToken}`, | ||
'X-GitHub-Api-Version': '2022-11-28' | ||
}, | ||
}); | ||
console.log(resp); |
51 changes: 51 additions & 0 deletions
51
docs/docs/guides/assets/multi-stage-delivery/application-production.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,51 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: podtato-head-frontend | ||
namespace: podtato-head-production | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: podtato-head-frontend | ||
template: | ||
metadata: | ||
labels: | ||
app: podtato-head-frontend | ||
app.kubernetes.io/name: podtato-head-frontend | ||
app.kubernetes.io/part-of: podtato-head | ||
app.kubernetes.io/version: {{.Values.serviceVersion}} | ||
spec: | ||
containers: | ||
- image: ghcr.io/podtato-head/podtato-server:{{.Values.serviceVersion}} | ||
name: podtato-head-service | ||
imagePullPolicy: Always | ||
ports: | ||
- containerPort: 9000 | ||
name: http | ||
protocol: TCP | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app.kubernetes.io/part-of: podtato-head | ||
name: podtato-head-frontend | ||
namespace: podtato-head-production | ||
spec: | ||
ports: | ||
- name: http | ||
port: 8080 | ||
targetPort: 9000 | ||
protocol: TCP | ||
selector: | ||
app: podtato-head-frontend | ||
type: ClusterIP | ||
--- | ||
apiVersion: lifecycle.keptn.sh/v1beta1 | ||
kind: KeptnAppContext | ||
metadata: | ||
name: podtato-head | ||
namespace: podtato-head-production | ||
spec: | ||
metadata: | ||
commitID: {{.Values.commitID}} |
24 changes: 24 additions & 0 deletions
24
docs/docs/guides/assets/multi-stage-delivery/argo-app-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,24 @@ | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Application | ||
metadata: | ||
name: podtato-head-dev | ||
namespace: argocd | ||
spec: | ||
project: default | ||
source: | ||
repoURL: 'https://github.com/<repo-owner>/<repo>' | ||
path: dev | ||
targetRevision: main | ||
helm: | ||
parameters: | ||
- name: "commitID" # (1)! | ||
value: "$ARGOCD_APP_REVISION" | ||
destination: | ||
server: 'https://kubernetes.default.svc' | ||
namespace: podtato-head-dev | ||
syncPolicy: | ||
automated: | ||
prune: true | ||
selfHeal: true | ||
syncOptions: | ||
- CreateNamespace=true |
24 changes: 24 additions & 0 deletions
24
docs/docs/guides/assets/multi-stage-delivery/argo-app-production.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,24 @@ | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Application | ||
metadata: | ||
name: podtato-head-prod | ||
namespace: argocd | ||
spec: | ||
project: default | ||
source: | ||
repoURL: 'https://github.com/<repo-owner>/<repo>' | ||
path: production | ||
targetRevision: main | ||
helm: | ||
parameters: | ||
- name: "commitID" # (1)! | ||
value: "$ARGOCD_APP_REVISION" | ||
destination: | ||
server: 'https://kubernetes.default.svc' | ||
namespace: podtato-head-production | ||
syncPolicy: | ||
automated: | ||
prune: true | ||
selfHeal: true | ||
syncOptions: | ||
- CreateNamespace=true |
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,6 @@ | ||
apiVersion: v2 | ||
name: podtato-head | ||
kubeVersion: ">= 1.24.0-0" | ||
type: application | ||
version: 0.1.0 | ||
appVersion: "v0.1.0" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,46 @@ | ||
name: promote | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
traceParent: | ||
description: 'OTEL parent trace' | ||
required: false | ||
type: string | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
promote: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: | | ||
# configure git client | ||
git config --global user.email "<email address>" | ||
git config --global user.name "<name>" | ||
# create a new branch | ||
git switch -c production/${{ github.sha }} | ||
# promote the change | ||
cp dev/values.yaml production/values.yaml | ||
echo "traceParent: $TRACE_PARENT" >> production/values.yaml | ||
# push the change to the new branch | ||
git add production/values.yaml | ||
git commit -m "Promote dev to production" | ||
git push -u origin production/${{ github.sha }} | ||
env: | ||
TRACE_PARENT: ${{ inputs.traceParent }} | ||
- run: | | ||
gh pr create \ | ||
-B main \ | ||
-H production/${{ github.sha }} \ | ||
--title "Promote dev to production" \ | ||
--body "Automatically created by GHA" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions
2
docs/docs/guides/assets/multi-stage-delivery/values-dev-updated.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,2 @@ | ||
serviceVersion: v0.3.1 | ||
commitID: "" # (1)! |
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 @@ | ||
serviceVersion: v0.3.0 | ||
commitID: "" # (1)! |
3 changes: 3 additions & 0 deletions
3
docs/docs/guides/assets/multi-stage-delivery/values-production.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,3 @@ | ||
serviceVersion: v0.3.0 | ||
commitID: "" # (1)! | ||
traceParent: "" # (2)! |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.