44 Commits

Author SHA1 Message Date
Vladimir Pouzanov
4773b9f1f8 Add the nix setup guidelines (#244)
Signed-off-by: Vladimir Pouzanov <farcaller@gmail.com>
2025-01-17 17:22:00 -05:00
Thomas Güttler
25eeaf3e0a removed ksonnet (#169) 2025-01-17 17:19:29 -05:00
John Win
ba44faf0a7 Updating plugins/kustomized-helm example (#156)
Updating the `helm template` command with a more complete example.
This command more resembles the helm command that is executed by the built-in helm tooling.

Signed-off-by: John Win <jpaulodit@hotmail.com>
2025-01-17 17:17:48 -05:00
Daniel Helfand
ce918f91b3 chore: remove ksonnet example (#129)
Signed-off-by: Daniel Helfand <helfand.4@gmail.com>
2025-01-17 17:14:05 -05:00
gaborfinta
67763d1415 fix: Add carts service (#81)
* Add carts service

Signed-off-by: Finta Gabor <finta.gabor@alerant.hu>

* Add newline at end of file

Signed-off-by: Finta Gabor <finta.gabor@alerant.hu>

---------

Signed-off-by: Finta Gabor <finta.gabor@alerant.hu>
2025-01-17 17:13:34 -05:00
Anand Francis Joseph
d7927a27b4 Template variable for container port (#251)
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
2023-11-15 09:00:20 -05:00
May Zhang
53e28ff20c feat: update helm samples to use helm3 (#78)
* helm3 guestbook

* helm3 blue-green

* helm3 dependencies

* helm3 plugin

* helm3 plugin

* helm3 plugin

* helm3 apps

* helm3 dependency

* helm3 dependency

* helm3 dependency

* helm3 fix readme
2021-03-03 13:07:29 -08:00
Ajay Kemparaj
466269de45 Move helm repo from to (#75)
more details here https://helm.sh/blog/new-location-stable-incubator-charts/

Signed-off-by: ajayk <ajaykemparaj@gmail.com>
2021-02-10 10:41:07 -08:00
Alexander Matyushentsev
08f72e2a30 chore: downgrade kustomize guestbook image tag (#73)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-01-31 09:54:53 -08:00
Alex Collins
6bed858de3 Updates examples to better reflect hook usage today (#41) 2019-10-17 15:33:32 -07:00
Alex Collins
94ad32f4ea Tidy up the examples repo + add a Helm hooks examples (#40) 2019-10-11 09:22:42 -07:00
jannfis
5c2d89b897 Use apps/v1 API for Deployment resources (#38) 2019-09-27 10:58:45 -07:00
Alexander Matyushentsev
b4ebe0049d Fix broken pre-post-sync example (#37) 2019-08-26 11:59:48 -07:00
Herrmann Hinz
1ccdee0a61 doc-fix: update kasane readme (#36)
pointing to the correct link for custom_tools.md
2019-08-19 19:58:19 +05:00
Alex Collins
6150e82d92 Clean-up (#35) 2019-08-14 11:44:15 -10:00
Omer Kahani
08836bd970 add application of applications example (#29)
* add application of applications example

* Add a link in the readme
2019-06-13 10:43:02 -07:00
Liviu Costea
454cc52962 Add example for jsonnet using functions with top level arguments (#30) 2019-06-12 18:06:34 -07:00
Alex Collins
0ad95c51bc Sync wave (#28) 2019-06-05 09:22:02 -07:00
Alexander Matyushentsev
35ca7c333d Update README.md (#26) 2019-05-03 16:05:25 -07:00
Alex Collins
e8fe3804f8 Adds finalizers (#25) 2019-05-03 10:37:00 -07:00
Alex Collins
c77a1b2d15 fix (#23) 2019-04-29 09:46:47 -07:00
Alex Collins
36363233d0 Adds app-of-apps (#22) 2019-04-25 13:50:56 -07:00
Alexander Matyushentsev
90ff6843e2 Fix blue-gree example instructions (#21) 2019-04-08 18:15:20 -06:00
Alexander Matyushentsev
3f461c308f Add link to blue green sample app (#20) 2019-03-27 08:41:56 -07:00
Alexander Matyushentsev
fd70f16a43 Add blue-green deployment example (#19) 2019-03-26 10:53:15 -07:00
Alexander Matyushentsev
826b3fa710 Fix init command in Helm + Kustomize example (#15) 2019-03-11 08:47:04 -07:00
Alex Collins
3ef31aef9c Removes blue-green-deploy. Removes kustomize1. Moves kustomize2-guestbook to kustomize-guestbook (#12) 2019-03-07 11:19:13 -08:00
Alexander Matyushentsev
23eeb0925b Add config template plugin examples (#7) 2019-02-25 14:19:08 -08:00
Alex Collins
179faabd63 Adds example usage for Kustomize 2 (#6) 2019-02-15 14:43:39 -08:00
Alexander Matyushentsev
8a1cb4a02d Update guestbook-ui-svc.yaml 2019-01-17 13:08:16 -08:00
Nick Johnson
1ff8a67040 adding instructions to helm-dependency example about subchart conditions (#5) 2019-01-03 22:44:26 -08:00
Jesse Suen
58594acf36 Add helm-dependency example demonstrating customization of OTS chart 2018-12-29 17:23:04 -08:00
Jesse Suen
8c06d23268 Add back guestbook-ui-svc.yaml 2018-12-10 18:08:29 -08:00
Jesse Suen
b0decab622 Remove workflow example and limit revision history 2018-12-10 18:05:32 -08:00
Jesse Suen
382b85852f Update examples for Argo CD v0.11 2018-12-08 04:56:06 -08:00
Jesse Suen
62c453945b Fix annotation for pre-post sync example 2018-12-03 04:17:07 -08:00
Jesse Suen
d9c52b4c89 Add examples for a plain-YAML guestbook and kustomize guestbook 2018-09-19 02:45:06 -07:00
Alexander Matyushentsev
c86a7fbb8e Merge pull request #2 from alexmt/jsonnet
Add jsonnet example
2018-09-10 13:45:54 -07:00
Alexander Matyushentsev
9c549b198c Add jsonnet example 2018-09-06 15:18:59 -07:00
Jesse Suen
a3ea618bb9 Add a second values file in the helm-guestbook example 2018-07-25 16:16:14 -07:00
Jesse Suen
9421276024 Add helm guestbook example 2018-07-25 15:57:16 -07:00
Jesse Suen
5eb3352b40 Tweak timings of the pre-post-sync example 2018-07-18 02:15:05 -07:00
Jesse Suen
e3a5ac20fc Add more environments to guestbook. Add README content 2018-07-17 23:12:34 -07:00
Jesse Suen
e0c05b3b14 Update pre-post-sync app to v0.2 2018-07-11 18:57:51 -07:00
115 changed files with 1449 additions and 587 deletions
+19
View File
@@ -1 +1,20 @@
# ArgoCD Example Apps
This repository contains example applications for demoing ArgoCD functionality. Feel free
to register this repository to your ArgoCD instance, or fork this repo and push your own commits
to explore ArgoCD and GitOps!
| Application | Description |
|-------------|-------------|
| [guestbook](guestbook/) | A hello word guestbook app as plain YAML |
| [helm-guestbook](helm-guestbook/) | The guestbook app as a Helm chart |
| [jsonnet-guestbook](jsonnet-guestbook/) | The guestbook app as a raw jsonnet |
| [jsonnet-guestbook-tla](jsonnet-guestbook-tla/) | The guestbook app as a raw jsonnet with support for top level arguments |
| [kustomize-guestbook](kustomize-guestbook/) | The guestbook app as a Kustomize 2 app |
| [pre-post-sync](pre-post-sync/) | Demonstrates Argo CD PreSync and PostSync hooks |
| [sync-waves](sync-waves/) | Demonstrates Argo CD sync waves with hooks |
| [helm-dependency](helm-dependency/) | Demonstrates how to customize an OTS (off-the-shelf) helm chart from an upstream repo |
| [sock-shop](sock-shop/) | A microservices demo app (https://microservices-demo.github.io) |
| [plugins](plugins/) | Apps which demonstrate config management plugins usage |
| [blue-green](blue-green/) | Demonstrates how to implement blue-green deployment using [Argo Rollouts](https://github.com/argoproj/argo-rollouts)
| [apps](apps/) | An app composed of other apps |
+23
View File
@@ -0,0 +1,23 @@
apiVersion: v2
name: applications
description: Applications
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: "1.0"
+16
View File
@@ -0,0 +1,16 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: helm-guestbook
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
destination:
namespace: helm-guestbook
server: {{ .Values.spec.destination.server }}
project: default
source:
path: helm-guestbook
repoURL: {{ .Values.spec.source.repoURL }}
targetRevision: {{ .Values.spec.source.targetRevision }}
+17
View File
@@ -0,0 +1,17 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: helm-hooks
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
destination:
namespace: helm-hooks
server: {{ .Values.spec.destination.server }}
project: default
source:
path: helm-hooks
repoURL: {{ .Values.spec.source.repoURL }}
targetRevision: {{ .Values.spec.source.targetRevision }}
+16
View File
@@ -0,0 +1,16 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: kustomize-guestbook
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
destination:
namespace: kustomize-guestbook
server: {{ .Values.spec.destination.server }}
project: default
source:
path: kustomize-guestbook
repoURL: {{ .Values.spec.source.repoURL }}
targetRevision: {{ .Values.spec.source.targetRevision }}
+27
View File
@@ -0,0 +1,27 @@
apiVersion: v1
kind: Namespace
metadata:
name: helm-guestbook
annotations:
argocd.argoproj.io/sync-wave: "-1"
---
apiVersion: v1
kind: Namespace
metadata:
name: helm-hooks
annotations:
argocd.argoproj.io/sync-wave: "-1"
---
apiVersion: v1
kind: Namespace
metadata:
name: kustomize-guestbook
annotations:
argocd.argoproj.io/sync-wave: "-1"
---
apiVersion: v1
kind: Namespace
metadata:
name: sync-waves
annotations:
argocd.argoproj.io/sync-wave: "-1"
+16
View File
@@ -0,0 +1,16 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: sync-waves
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
destination:
namespace: sync-waves
server: {{ .Values.spec.destination.server }}
project: default
source:
path: sync-waves
repoURL: {{ .Values.spec.source.repoURL }}
targetRevision: {{ .Values.spec.source.targetRevision }}
+6
View File
@@ -0,0 +1,6 @@
spec:
destination:
server: https://kubernetes.default.svc
source:
repoURL: https://github.com/argoproj/argocd-example-apps
targetRevision: HEAD
-4
View File
@@ -1,4 +0,0 @@
/lib
/.ksonnet/registries
/app.override.yaml
/.ks_environment
-11
View File
@@ -1,11 +0,0 @@
apiVersion: 0.1.0
environments:
default:
destination:
namespace: default
server: https://kubernetes.default.svc
k8sVersion: v1.10.0
path: default
kind: ksonnet.io/app
name: blue-green-deploy
version: 0.0.1
@@ -1,64 +0,0 @@
local env = std.extVar("__ksonnet/environments");
local params = std.extVar("__ksonnet/params").components["bg-guestbook"];
[
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": params.name,
"annotations": {
"argocd.argoproj.io/hook": "Skip",
},
},
"spec": {
"ports": [
{
"port": params.servicePort,
"targetPort": params.containerPort
}
],
"selector": {
"app": params.name
},
"type": params.type
}
},
{
"apiVersion": "apps/v1beta2",
"kind": "Deployment",
"metadata": {
"name": params.name,
"annotations": {
"argocd.argoproj.io/hook": "Skip",
},
},
"spec": {
"replicas": params.replicas,
"selector": {
"matchLabels": {
"app": params.name
},
},
"template": {
"metadata": {
"labels": {
"app": params.name
}
},
"spec": {
"containers": [
{
"image": params.image,
"name": params.name,
"ports": [
{
"containerPort": params.containerPort
}
]
}
]
}
}
}
}
]
@@ -1,20 +0,0 @@
local bgGuestbook = std.extVar("__ksonnet/components")["bg-guestbook"];
local bgGuestbookSvc = bgGuestbook[0];
local bgGuestbookDeploy = bgGuestbook[1];
local parseYaml = std.native("parseYaml");
local bgWorkflow = parseYaml(importstr 'wf/bluegreen.yaml')[0];
[
bgWorkflow + {
spec +: {
arguments +: {
parameters : [
{name: "deployment-name", value: bgGuestbookDeploy.metadata.name},
{name: "service-name", value: bgGuestbookSvc.metadata.name},
{name: "new-deployment-manifest", value: std.manifestJson(bgGuestbookDeploy)},
{name: "new-service-manifest", value: std.manifestJson(bgGuestbookSvc)},
],
},
},
}
]
@@ -1,19 +0,0 @@
{
global: {
// User-defined global parameters; accessible to all component and environments, Ex:
// replicas: 4,
},
components: {
// Component-level parameters, defined initially from 'ks prototype use ...'
// Each object below should correspond to a component in the components/ directory
"bg-guestbook": {
containerPort: 80,
image: "gcr.io/heptio-images/ks-guestbook-demo:0.2",
name: "bg-guestbook",
replicas: 3,
servicePort: 80,
type: "LoadBalancer",
},
"bg-workflow": {},
},
}
@@ -1,150 +0,0 @@
# This workflow performs a "blue-green" deployment, while preserving the original deployment object
# and name. It accomplishes this by temporarily redirecting traffic to a *clone* of the original
# deployment. Then after upgrading the original deployment to a later version, redirects traffic
# back to the original (now upgraded) deployment.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: k8s-bluegreen-
annotations:
argocd.argoproj.io/hook: Sync
spec:
entrypoint: k8s-bluegreen
arguments:
parameters:
- name: deployment-name
- name: service-name
- name: new-deployment-manifest
- name: new-service-manifest
templates:
- name: k8s-bluegreen
steps:
# 1. Create a parallel Kubernetes deployment with tweaks to name and selectors
- - name: create-blue-deployment
template: clone-deployment
# 2. Wait for parallel deployment to become ready
- - name: wait-for-blue-deployment
template: wait-deployment-ready
arguments:
parameters:
- name: deployment-name
value: '{{workflow.parameters.deployment-name}}-blue'
# 3. Patch the named service to point to the parallel deployment app
- - name: switch-service-to-blue-deployment
template: patch-service
# 4. Update the original deployment (receiving no traffic) with a new version
- - name: apply-green-deployment
template: apply-manifest
arguments:
parameters:
- name: manifest
value: '{{workflow.parameters.new-deployment-manifest}}'
# 5. Wait for the original deployment, now updated, to become ready
- - name: wait-for-green-deployment
template: wait-deployment-ready
arguments:
parameters:
- name: deployment-name
value: '{{workflow.parameters.deployment-name}}'
# dummy approval step for demo purposes. Sleeps for 30 seconds
- - name: approve
template: approve
# 6. Patch the named service to point to the original, now updated app
- - name: switch-service-to-green-deployment
template: apply-manifest
arguments:
parameters:
- name: manifest
value: '{{workflow.parameters.new-service-manifest}}'
# 7. Remove the cloned deployment (no longer receiving traffic)
- - name: delete-cloned-deployment
template: delete-deployment
# end of steps
# clone-deployment creates a "blue" clone of an existing deployment. The string -blue is appended to:
# - metadata.name
# - spec.selector.matchLabels
# - spec.template.metadata.labels
- name: clone-deployment
container:
image: argoproj/argoexec:v2.1.1
command: [sh, -c, -x]
args:
- kubectl get --export -o json deployment.apps/{{workflow.parameters.deployment-name}} > /original-deploy &&
jq -r '.metadata.name+="-blue" |
.spec.template.metadata.labels += (.spec.template.metadata.labels | to_entries | map(select(.key != "applications.argoproj.io/app-name")) | map(.value+="-blue") | from_entries) |
.spec.selector.matchLabels += (.spec.selector.matchLabels | to_entries | map(select(.key != "applications.argoproj.io/app-name")) | map(.value+="-blue") | from_entries)'
/original-deploy > /cloned-deploy &&
cat /cloned-deploy &&
kubectl apply -o yaml -f /cloned-deploy
# apply-manifest takes a kubernetes manifest and carrys over the app-name label (if present)
# before running `kubectl apply`. The label is used by ArgoCD for monitoring.
- name: apply-manifest
inputs:
parameters:
- name: manifest
artifacts:
- name: manifest-file
path: /manifest
raw:
data: '{{inputs.parameters.manifest}}'
container:
image: argoproj/argoexec:v2.1.1
command: [sh, -c, -x]
args:
- cp /manifest /manifest-new &&
APP_NAME=$(kubectl get -n default -f /manifest-new -o json | jq -r '.metadata.labels."applications.argoproj.io/app-name"') &&
if [ "$APP_NAME" != "null" ]; then
jq -r --arg APP_NAME "$APP_NAME" '.metadata.labels."applications.argoproj.io/app-name" = $APP_NAME' /manifest-new > /manifest-new.tmp &&
mv /manifest-new.tmp /manifest-new &&
if [ "$(jq -r .spec.template.metadata.labels /manifest-new)" != "null" ]; then
jq -r --arg APP_NAME "$APP_NAME" '.spec.template.metadata.labels."applications.argoproj.io/app-name" = $APP_NAME' /manifest-new > /manifest-new.tmp &&
mv /manifest-new.tmp /manifest-new ;
fi ;
fi &&
cat /manifest-new &&
kubectl apply -f /manifest-new
# wait-deployment-ready waits for a deployment to become fully deployed and ready, using the
# `kubectl rollout` command
- name: wait-deployment-ready
inputs:
parameters:
- name: deployment-name
container:
image: argoproj/argoexec:v2.1.1
command: [kubectl, rollout, status, --watch=true, 'deployments/{{inputs.parameters.deployment-name}}']
# patch-service updates the service selector labels to point to the "blue" deployment
- name: patch-service
container:
image: argoproj/argoexec:v2.1.1
command: [sh, -c, -x]
args:
- kubectl get -n default service {{workflow.parameters.service-name}} --export -o json > /original-svc &&
jq '.spec.selector = (.spec.selector | with_entries(.value+="-blue"))' /original-svc > /blue-svc &&
kubectl apply -o yaml -f /blue-svc
- name: delete-deployment
resource:
action: delete
manifest: |
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{workflow.parameters.deployment-name}}-blue
- name: approve
container:
image: argoproj/argoexec:v2.1.1
command: [sleep, "30"]
@@ -1,4 +0,0 @@
local components = std.extVar("__ksonnet/components");
components + {
// Insert user-specified overrides here.
}
@@ -1,2 +0,0 @@
{
}
@@ -1,8 +0,0 @@
local base = import "base.libsonnet";
// uncomment if you reference ksonnet-lib
// local k = import "k.libsonnet";
base + {
// Insert user-specified overrides here. For example if a component is named \"nginx-deployment\", you might have something like:\n")
// "nginx-deployment"+: k.deployment.mixin.metadata.labels({foo: "bar"})
}
@@ -1,17 +0,0 @@
local params = std.extVar("__ksonnet/params");
local globals = import "globals.libsonnet";
local envParams = params + {
components +: {
// Insert component parameter overrides here. Ex:
// guestbook +: {
// name: "guestbook-dev",
// replicas: params.global.replicas,
// },
},
};
{
components: {
[x]: envParams.components[x] + globals, for x in std.objectFields(envParams.components)
},
}
+21
View File
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
+23
View File
@@ -0,0 +1,23 @@
apiVersion: v2
name: helm-guestbook
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: "1.0"
+30
View File
@@ -0,0 +1,30 @@
# Blue Green
The blue green strategy is not supported by built-in Kubernetes Deployment but available via third-party Kubernetes controller.
This example demonstrates how to implement blue-green deployment via [Argo Rollouts](https://github.com/argoproj/argo-rollouts):
1. Install Argo Rollouts controller: https://github.com/argoproj/argo-rollouts#installation
2. Create a sample application and sync it.
```
argocd app create --name blue-green --repo https://github.com/argoproj/argocd-example-apps --dest-server https://kubernetes.default.svc --dest-namespace default --path blue-green && argocd app sync blue-green
```
Once the application is synced you can access it using `blue-green-helm-guestbook` service.
3. Change image version parameter to trigger blue-green deployment process:
```
argocd app set blue-green -p image.tag=0.2 && argocd app sync blue-green
```
Now application runs `ks-guestbook-demo:0.1` and `ks-guestbook-demo:0.2` images simultaneously.
The `ks-guestbook-demo:0.2` is still considered `blue` available only via preview service `blue-green-helm-guestbook-preview`.
4. Promote `ks-guestbook-demo:0.2` to `green` by patching `Rollout` resource:
```
argocd app patch-resource blue-green --kind Rollout --resource-name blue-green-helm-guestbook --patch '{ "status": { "verifyingPreview": false } }' --patch-type 'application/merge-patch+json'
```
This promotes `ks-guestbook-demo:0.2` to `green` status and `Rollout` deletes old replica which runs `ks-guestbook-demo:0.1`.
+19
View File
@@ -0,0 +1,19 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "helm-guestbook.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "helm-guestbook.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "helm-guestbook.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "helm-guestbook.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:80
{{- end }}
+32
View File
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "helm-guestbook.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "helm-guestbook.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "helm-guestbook.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
+56
View File
@@ -0,0 +1,56 @@
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: {{ template "helm-guestbook.fullname" . }}
labels:
app: {{ template "helm-guestbook.name" . }}
chart: {{ template "helm-guestbook.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
revisionHistoryLimit: 3
selector:
matchLabels:
app: {{ template "helm-guestbook.name" . }}
release: {{ .Release.Name }}
strategy:
blueGreen:
activeService: {{ template "helm-guestbook.fullname" . }}
previewService: {{ template "helm-guestbook.fullname" . }}-preview
template:
metadata:
labels:
app: {{ template "helm-guestbook.name" . }}
release: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
+40
View File
@@ -0,0 +1,40 @@
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "helm-guestbook.fullname" . }}
labels:
app: {{ template "helm-guestbook.name" . }}
chart: {{ template "helm-guestbook.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app: {{ template "helm-guestbook.name" . }}
release: {{ .Release.Name }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "helm-guestbook.fullname" . }}-preview
labels:
app: {{ template "helm-guestbook.name" . }}
chart: {{ template "helm-guestbook.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app: {{ template "helm-guestbook.name" . }}
release: {{ .Release.Name }}
+45
View File
@@ -0,0 +1,45 @@
# Default values for helm-guestbook.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: gcr.io/heptio-images/ks-guestbook-demo
tag: 0.1
pullPolicy: IfNotPresent
service:
type: ClusterIP
port: 80
ingress:
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
path: /
hosts:
- chart-example.local
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}
-4
View File
@@ -1,4 +0,0 @@
/lib
/.ksonnet/registries
/app.override.yaml
/.ks_environment
-11
View File
@@ -1,11 +0,0 @@
apiVersion: 0.1.0
environments:
default:
destination:
namespace: default
server: https://kubernetes.default.svc
k8sVersion: v1.10.0
path: default
kind: ksonnet.io/app
name: guestbook
version: 0.0.1
-18
View File
@@ -1,18 +0,0 @@
{
global: {
// User-defined global parameters; accessible to all component and environments, Ex:
// replicas: 4,
},
components: {
// Component-level parameters, defined initially from 'ks prototype use ...'
// Each object below should correspond to a component in the components/ directory
"guestbook-ui": {
containerPort: 80,
image: "gcr.io/heptio-images/ks-guestbook-demo:0.2",
name: "guestbook-ui",
replicas: 1,
servicePort: 80,
type: "LoadBalancer",
},
},
}
-4
View File
@@ -1,4 +0,0 @@
local components = std.extVar("__ksonnet/components");
components + {
// Insert user-specified overrides here.
}

Some files were not shown because too many files have changed in this diff Show More