Compare commits
No commits in common. "master" and "bg-guestbook-v0.2" have entirely different histories.
master
...
bg-guestbo
|
@ -1 +0,0 @@
|
|||
/**/charts/
|
50
README.md
50
README.md
|
@ -1,51 +1 @@
|
|||
# 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!
|
||||
|
||||
| Status | Application | Description |
|
||||
| ------------------------------------------------------------------------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
||||
| [![App Status][badge_sync_example_apps]][app_sync_example_apps] | [apps](apps/) | An app composed of other apps synchronized in [cd.apps.argoproj.io][app_sync_example_apps] |
|
||||
| [![App Status][badge_blue_green]][app_blue_green] | [blue-green](blue-green/) | Demonstrates how to implement blue-green deployment using [Argo Rollouts](https://github.com/argoproj/argo-rollouts) |
|
||||
| [![App Status][badge_guestbook]][app_guestbook] | [guestbook](guestbook/) | A hello word guestbook app as plain YAML |
|
||||
| [![App Status][badge_helm_dependency]][app_helm_dependency] | [helm-dependency](helm-dependency/) | Demonstrates how to customize an OTS (off-the-shelf) helm chart from an upstream repo |
|
||||
| [![App Status][badge_helm_guestbook]][app_helm_guestbook] | [helm-guestbook](helm-guestbook/) | The guestbook app as a Helm chart |
|
||||
| [![App Status][badge_helm_hooks]][app_helm_hooks] | [helm-hooks](helm-hooks/) | An application with native Helm hooks |
|
||||
| [![App Status][badge_jsonnet_guestbook]][app_jsonnet_guestbook] | [jsonnet-guestbook](jsonnet-guestbook/) | The guestbook app as a raw jsonnet |
|
||||
| [![App Status][badge_jsonnet_guestbook_tla]][app_jsonnet_guestbook_tla] | [jsonnet-guestbook-tla](jsonnet-guestbook-tla/) | The guestbook app as a raw jsonnet with support for top level arguments |
|
||||
| [![App Status][badge_kustomize_guestbook]][app_kustomize_guestbook] | [kustomize-guestbook](kustomize-guestbook/) | The guestbook app as a Kustomize app |
|
||||
| [![App Status][badge_plugin_kasane]][app_plugin_kasane] | [plugins/kasane](plugins/kasane) | Apps which demonstrate config management plugins usage with [kasane](plugins/kasane/README.md) |
|
||||
| [![App Status][badge_plugin_kustomized_helm]][app_plugin_kustomized_helm] | [plugins/kustomized-helm](plugins/kustomized-helm) | Apps which demonstrate config management plugins usage with a [kustomized helm chart](plugins/kustomized-helm/README.md) |
|
||||
| [![App Status][badge_pre_post_sync]][app_pre_post_sync] | [pre-post-sync](pre-post-sync/) | Demonstrates Argo CD PreSync and PostSync hooks |
|
||||
| [![App Status][badge_sock_shop]][app_sock_shop] | [sock-shop](sock-shop/) | A microservices demo app (https://microservices-demo.github.io) |
|
||||
| [![App Status][badge_sync_waves]][app_sync_waves] | [sync-waves](sync-waves/) | Demonstrates Argo CD sync waves with hooks |
|
||||
|
||||
[app_sync_example_apps]: https://cd.apps.argoproj.io/applications/sync-example-apps
|
||||
[badge_sync_example_apps]: https://cd.apps.argoproj.io/api/badge?revision=true&name=sync-example-apps
|
||||
[app_blue_green]: https://cd.apps.argoproj.io/applications/example.blue-green
|
||||
[badge_blue_green]: https://cd.apps.argoproj.io/api/badge?revision=true&name=example.blue-green
|
||||
[app_guestbook]: https://cd.apps.argoproj.io/applications/example.guestbook
|
||||
[badge_guestbook]: https://cd.apps.argoproj.io/api/badge?revision=true&name=example.guestbook
|
||||
[app_helm_dependency]: https://cd.apps.argoproj.io/applications/example.helm-dependency
|
||||
[badge_helm_dependency]: https://cd.apps.argoproj.io/api/badge?revision=true&name=example.helm-dependency
|
||||
[app_helm_guestbook]: https://cd.apps.argoproj.io/applications/example.helm-guestbook
|
||||
[badge_helm_guestbook]: https://cd.apps.argoproj.io/api/badge?revision=true&name=example.helm-guestbook
|
||||
[app_helm_hooks]: https://cd.apps.argoproj.io/applications/example.helm-hooks
|
||||
[badge_helm_hooks]: https://cd.apps.argoproj.io/api/badge?revision=true&name=example.helm-hooks
|
||||
[app_jsonnet_guestbook]: https://cd.apps.argoproj.io/applications/example.jsonnet-guestbook
|
||||
[badge_jsonnet_guestbook]: https://cd.apps.argoproj.io/api/badge?revision=true&name=example.jsonnet-guestbook
|
||||
[app_jsonnet_guestbook_tla]: https://cd.apps.argoproj.io/applications/example.jsonnet-guestbook-tla
|
||||
[badge_jsonnet_guestbook_tla]: https://cd.apps.argoproj.io/api/badge?revision=true&name=example.jsonnet-guestbook-tla
|
||||
[app_kustomize_guestbook]: https://cd.apps.argoproj.io/applications/example.kustomize-guestbook
|
||||
[badge_kustomize_guestbook]: https://cd.apps.argoproj.io/api/badge?revision=true&name=example.kustomize-guestbook
|
||||
[app_plugin_kasane]: https://cd.apps.argoproj.io/applications/example.plugin-kasane
|
||||
[badge_plugin_kasane]: https://cd.apps.argoproj.io/api/badge?revision=true&name=example.plugin-kasane
|
||||
[app_plugin_kustomized_helm]: https://cd.apps.argoproj.io/applications/example.plugin-kustomized-helm
|
||||
[badge_plugin_kustomized_helm]: https://cd.apps.argoproj.io/api/badge?revision=true&name=example.plugin-kustomized-helm
|
||||
[app_pre_post_sync]: https://cd.apps.argoproj.io/applications/example.pre-post-sync
|
||||
[badge_pre_post_sync]: https://cd.apps.argoproj.io/api/badge?revision=true&name=example.pre-post-sync
|
||||
[app_sock_shop]: https://cd.apps.argoproj.io/applications/example.sock-shop
|
||||
[badge_sock_shop]: https://cd.apps.argoproj.io/api/badge?revision=true&name=example.sock-shop
|
||||
[app_sync_waves]: https://cd.apps.argoproj.io/applications/example.sync-waves
|
||||
[badge_sync_waves]: https://cd.apps.argoproj.io/api/badge?revision=true&name=example.sync-waves
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
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"
|
|
@ -1,29 +0,0 @@
|
|||
{{- range .Values.applications }}
|
||||
{{- $config := $.Values.config -}}
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: {{ printf "example.%s" .name | quote }}
|
||||
namespace: argocd
|
||||
finalizers:
|
||||
- resources-finalizer.argocd.argoproj.io
|
||||
spec:
|
||||
destination:
|
||||
namespace: {{ .namespace | default .name | quote }}
|
||||
server: {{ $config.spec.destination.server | quote }}
|
||||
project: default
|
||||
source:
|
||||
path: {{ .path | default .name | quote }}
|
||||
repoURL: {{ $config.spec.source.repoURL }}
|
||||
targetRevision: {{ $config.spec.source.targetRevision }}
|
||||
{{- with .tool }}
|
||||
{{- . | toYaml | nindent 4 }}
|
||||
{{- end }}
|
||||
syncPolicy:
|
||||
syncOptions:
|
||||
- CreateNamespace=true
|
||||
automated:
|
||||
prune: true
|
||||
selfHeal: true
|
||||
---
|
||||
{{ end -}}
|
|
@ -1,44 +0,0 @@
|
|||
config:
|
||||
spec:
|
||||
destination:
|
||||
server: https://kubernetes.default.svc
|
||||
source:
|
||||
repoURL: https://github.com/argoproj/argocd-example-apps
|
||||
targetRevision: master
|
||||
|
||||
applications:
|
||||
- name: blue-green
|
||||
tool:
|
||||
helm:
|
||||
releaseName: blue-green
|
||||
- name: guestbook
|
||||
- name: helm-dependency
|
||||
tool:
|
||||
helm:
|
||||
releaseName: helm-dependency
|
||||
- name: helm-guestbook
|
||||
tool:
|
||||
helm:
|
||||
releaseName: helm-guestbook
|
||||
- name: helm-hooks
|
||||
- name: jsonnet-guestbook
|
||||
- name: jsonnet-guestbook-tla
|
||||
- name: kustomize-guestbook
|
||||
- name: plugin-kasane
|
||||
path: plugins/kasane
|
||||
tool:
|
||||
plugin:
|
||||
name: kasane
|
||||
- name: plugin-kustomized-helm
|
||||
path: plugins/kustomized-helm
|
||||
tool:
|
||||
plugin:
|
||||
name: kustomized-helm
|
||||
- name: plugin-nix
|
||||
path: plugins/nix
|
||||
tool:
|
||||
plugin:
|
||||
name: nix
|
||||
- name: pre-post-sync
|
||||
- name: sock-shop
|
||||
- name: sync-waves
|
|
@ -0,0 +1,4 @@
|
|||
/lib
|
||||
/.ksonnet/registries
|
||||
/app.override.yaml
|
||||
/.ks_environment
|
|
@ -0,0 +1,11 @@
|
|||
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
|
|
@ -0,0 +1,64 @@
|
|||
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
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
|
@ -0,0 +1,20 @@
|
|||
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)},
|
||||
],
|
||||
},
|
||||
},
|
||||
}
|
||||
]
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
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": {},
|
||||
},
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
# 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"]
|
|
@ -0,0 +1,4 @@
|
|||
local components = std.extVar("__ksonnet/components");
|
||||
components + {
|
||||
// Insert user-specified overrides here.
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
{
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
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"})
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
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)
|
||||
},
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
# 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
|
|
@ -1,23 +0,0 @@
|
|||
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"
|
|
@ -1,30 +0,0 @@
|
|||
# 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`.
|
|
@ -1,19 +0,0 @@
|
|||
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 }}
|
|
@ -1,32 +0,0 @@
|
|||
{{/* 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 -}}
|
|
@ -1,56 +0,0 @@
|
|||
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 }}
|
|
@ -1,40 +0,0 @@
|
|||
---
|
||||
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 }}
|
|
@ -1,47 +0,0 @@
|
|||
# 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/google-samples/gb-frontend
|
||||
tag: v5
|
||||
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: {}
|
|
@ -0,0 +1,4 @@
|
|||
/lib
|
||||
/.ksonnet/registries
|
||||
/app.override.yaml
|
||||
/.ks_environment
|
|
@ -0,0 +1,11 @@
|
|||
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
|
|
@ -1,5 +1,5 @@
|
|||
local params = import 'params.libsonnet';
|
||||
|
||||
local env = std.extVar("__ksonnet/environments");
|
||||
local params = std.extVar("__ksonnet/params").components["guestbook-ui"];
|
||||
[
|
||||
{
|
||||
"apiVersion": "v1",
|
||||
|
@ -21,14 +21,13 @@ local params = import 'params.libsonnet';
|
|||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "apps/v1",
|
||||
"apiVersion": "apps/v1beta2",
|
||||
"kind": "Deployment",
|
||||
"metadata": {
|
||||
"name": params.name
|
||||
},
|
||||
"spec": {
|
||||
"replicas": params.replicas,
|
||||
"revisionHistoryLimit": 3,
|
||||
"selector": {
|
||||
"matchLabels": {
|
||||
"app": params.name
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
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",
|
||||
},
|
||||
},
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
local components = std.extVar("__ksonnet/components");
|
||||
components + {
|
||||
// Insert user-specified overrides here.
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
{
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
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"})
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
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)
|
||||
},
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: guestbook-ui
|
||||
spec:
|
||||
replicas: 1
|
||||
revisionHistoryLimit: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
app: guestbook-ui
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: guestbook-ui
|
||||
spec:
|
||||
containers:
|
||||
- image: gcr.io/google-samples/gb-frontend:v5
|
||||
name: guestbook-ui
|
||||
ports:
|
||||
- containerPort: 80
|
|
@ -1,10 +0,0 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: guestbook-ui
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
selector:
|
||||
app: guestbook-ui
|
|
@ -1,28 +0,0 @@
|
|||
apiVersion: v2
|
||||
name: wordpress
|
||||
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"
|
||||
|
||||
dependencies:
|
||||
- name: wordpress
|
||||
version: 9.0.3
|
||||
repository: https://charts.helm.sh/stable
|
|
@ -1,55 +0,0 @@
|
|||
# Helm Dependencies
|
||||
|
||||
This example application demonstrates how an OTS (off-the-shelf) helm chart can be retrieved and
|
||||
pinned to a specific helm sem version from an upstream helm repository, and customized using a custom
|
||||
values.yaml in the private git repository.
|
||||
|
||||
In this example, the wordpress application is pulled from the stable helm repo, and pinned to v5.0.2:
|
||||
|
||||
```yaml
|
||||
dependencies:
|
||||
- name: wordpress
|
||||
version: 5.0.2
|
||||
repository: https://charts.helm.sh/stable
|
||||
```
|
||||
|
||||
A custom values.yaml is used to customize the parameters of the wordpress helm chart:
|
||||
|
||||
```yaml
|
||||
wordpress:
|
||||
wordpressPassword: foo
|
||||
mariadb:
|
||||
db:
|
||||
password: bar
|
||||
rootUser:
|
||||
password: baz
|
||||
```
|
||||
|
||||
### Subchart Note
|
||||
|
||||
The wordpress chart referenced in this example contains a subchart for mariadb as specified in the requirements.yaml file of the wordpress chart:
|
||||
```yaml
|
||||
- name: mariadb
|
||||
version: 5.x.x
|
||||
repository: https://charts.helm.sh/stable
|
||||
condition: mariadb.enabled
|
||||
tags:
|
||||
- wordpress-database
|
||||
```
|
||||
|
||||
In order to disable this chart, you must set the value to false for both `mariadb.enabled` and `wordpress.mariadb.enabled`. The first is used by the mariadb subchart condition field, the second is used by the wordpress chart deployment template. An example demonstration is available in the values-nomaria.yaml file:
|
||||
```yaml
|
||||
mariadb:
|
||||
enabled: false
|
||||
|
||||
wordpress:
|
||||
wordpressPassword: foo
|
||||
mariadb:
|
||||
enabled: false
|
||||
externalDatabase:
|
||||
host: localhost
|
||||
user: bn_wordpress
|
||||
password: ""
|
||||
database: bitnami_wordpress
|
||||
port: 3306
|
||||
```
|
|
@ -1,13 +0,0 @@
|
|||
mariadb:
|
||||
enabled: false
|
||||
|
||||
wordpress:
|
||||
wordpressPassword: foo
|
||||
mariadb:
|
||||
enabled: false
|
||||
externalDatabase:
|
||||
host: localhost
|
||||
user: bn_wordpress
|
||||
password: ""
|
||||
database: bitnami_wordpress
|
||||
port: 3306
|
|
@ -1,9 +0,0 @@
|
|||
wordpress:
|
||||
image:
|
||||
tag: invalid #break this app on purpose until a dedicated broken app is created
|
||||
wordpressPassword: foo
|
||||
mariadb:
|
||||
db:
|
||||
password: bar
|
||||
rootUser:
|
||||
password: baz
|
|
@ -1,21 +0,0 @@
|
|||
# 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
|
|
@ -1,23 +0,0 @@
|
|||
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"
|
|
@ -1,19 +0,0 @@
|
|||
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 }}
|
|
@ -1,32 +0,0 @@
|
|||
{{/* 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 -}}
|
|
@ -1,52 +0,0 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
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 }}
|
||||
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: {{ .Values.containerPort }}
|
||||
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 }}
|
|
@ -1,19 +0,0 @@
|
|||
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 }}
|
|
@ -1,2 +0,0 @@
|
|||
service:
|
||||
type: LoadBalancer
|
|
@ -1,49 +0,0 @@
|
|||
# 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/google-samples/gb-frontend
|
||||
tag: v5
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
containerPort: 80
|
||||
|
||||
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: {}
|
|
@ -1,82 +0,0 @@
|
|||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
generateName: upgrade-sql-schema
|
||||
annotations:
|
||||
helm.sh/hook: pre-install
|
||||
helm.sh/hook-weight: "-2"
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: upgrade-sql-schema
|
||||
image: alpine:latest
|
||||
command: ["sleep", "5"]
|
||||
restartPolicy: Never
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: maint-page-up
|
||||
annotations:
|
||||
helm.sh/hook: pre-install
|
||||
helm.sh/hook-delete-policy: before-hook-creation
|
||||
helm.sh/hook-weight: "-1"
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: page-up
|
||||
image: alpine:latest
|
||||
command: ["sleep", "2"]
|
||||
restartPolicy: Never
|
||||
backoffLimit: 0
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: ReplicaSet
|
||||
metadata:
|
||||
name: frontend
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
tier: frontend
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
tier: frontend
|
||||
spec:
|
||||
containers:
|
||||
- name: main
|
||||
image: nginx:latest
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: frontend
|
||||
annotations:
|
||||
helm.sh/hook-weight: "2"
|
||||
spec:
|
||||
selector:
|
||||
tier: frontend
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: 80
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: maint-page-down
|
||||
annotations:
|
||||
helm.sh/hook: post-install
|
||||
helm.sh/hook-delete-policy: before-hook-creation
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: page-down
|
||||
image: alpine:latest
|
||||
command: ["sleep", "2"]
|
||||
restartPolicy: Never
|
|
@ -1,65 +0,0 @@
|
|||
function (
|
||||
containerPort=80,
|
||||
image="gcr.io/google-samples/gb-frontend:v5",
|
||||
name="jsonnet-guestbook-ui",
|
||||
replicas=1,
|
||||
servicePort=80,
|
||||
type="LoadBalancer"
|
||||
)
|
||||
[
|
||||
{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Service",
|
||||
"metadata": {
|
||||
"name": name
|
||||
},
|
||||
"spec": {
|
||||
"ports": [
|
||||
{
|
||||
"port": servicePort,
|
||||
"targetPort": containerPort
|
||||
}
|
||||
],
|
||||
"selector": {
|
||||
"app": name
|
||||
},
|
||||
"type": type
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "Deployment",
|
||||
"metadata": {
|
||||
"name": name
|
||||
},
|
||||
"spec": {
|
||||
"replicas": replicas,
|
||||
"revisionHistoryLimit": 3,
|
||||
"selector": {
|
||||
"matchLabels": {
|
||||
"app": name
|
||||
},
|
||||
},
|
||||
"template": {
|
||||
"metadata": {
|
||||
"labels": {
|
||||
"app": name
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"containers": [
|
||||
{
|
||||
"image": image,
|
||||
"name": name,
|
||||
"ports": [
|
||||
{
|
||||
"containerPort": containerPort
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
containerPort: 80,
|
||||
image: "gcr.io/google-samples/gb-frontend:v5",
|
||||
name: "jsonnet-guestbook-ui",
|
||||
replicas: 1,
|
||||
servicePort: 80,
|
||||
type: "LoadBalancer",
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: guestbook-ui
|
||||
spec:
|
||||
replicas: 1
|
||||
revisionHistoryLimit: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
app: guestbook-ui
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: guestbook-ui
|
||||
spec:
|
||||
containers:
|
||||
- image: gcr.io/google-samples/gb-frontend:v5
|
||||
name: guestbook-ui
|
||||
ports:
|
||||
- containerPort: 80
|
|
@ -1,10 +0,0 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: guestbook-ui
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
selector:
|
||||
app: guestbook-ui
|
|
@ -1,7 +0,0 @@
|
|||
namePrefix: kustomize-
|
||||
|
||||
resources:
|
||||
- guestbook-ui-deployment.yaml
|
||||
- guestbook-ui-svc.yaml
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
|
@ -1,7 +0,0 @@
|
|||
# Config Management Plugins Examples
|
||||
|
||||
| Application | Description |
|
||||
|-------------|-------------|
|
||||
| [kasane](kasane/) | The guestbook application as a `kasane` package. |
|
||||
| [kustomized-helm](kustomized-helm/) | Application comprised of a `helm` chart and customized using `kustomize` |
|
||||
| [nix](nix/) | Application comprised of a `helm` chart built and customized using `nix` |
|
|
@ -1,2 +0,0 @@
|
|||
vendor
|
||||
Kasanefile.lock
|
|
@ -1,5 +0,0 @@
|
|||
layers:
|
||||
- ../../guestbook/guestbook-ui-deployment.yaml
|
||||
- patch.jsonnet
|
||||
- ../../guestbook/guestbook-ui-svc.yaml
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
# Kasane
|
||||
|
||||
[Kasane](https://github.com/google/kasane) is a layering tool for Kubernetes which utilises Jsonnet for deep object modification and patching.
|
||||
|
||||
Use following steps to try the application:
|
||||
|
||||
* Follow instructions from [custom_tools.md](https://github.com/argoproj/argo-cd/blob/master/docs/operator-manual/custom_tools.md) to make sure `kasane` binary is available in `argocd-repo-server` pod.
|
||||
* Register `kasane` plugin `argocd-cm` ConfigMap:
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
data:
|
||||
configManagementPlugins: |
|
||||
- name: kasane
|
||||
init:
|
||||
command: [kasane, update]
|
||||
generate:
|
||||
command: [kasane, show]
|
||||
```
|
||||
* Create application using `kasane` as a config management plugin name.
|
||||
|
||||
```
|
||||
argocd app create kasane \
|
||||
--config-management-plugin kasane \
|
||||
--repo https://github.com/argoproj/argocd-example-apps \
|
||||
--path plugins/kasane \
|
||||
--dest-server https://kubernetes.default.svc \
|
||||
--dest-namespace default
|
||||
```
|
|
@ -1,9 +0,0 @@
|
|||
function (layers)
|
||||
|
||||
[
|
||||
layers[0] {
|
||||
spec+: {
|
||||
replicas: 2,
|
||||
},
|
||||
}
|
||||
]
|
|
@ -1,3 +0,0 @@
|
|||
all.yaml
|
||||
charts
|
||||
requirements.lock
|
|
@ -1,28 +0,0 @@
|
|||
apiVersion: v2
|
||||
name: 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"
|
||||
|
||||
dependencies:
|
||||
- name: helm-guestbook
|
||||
version: 0.1.0
|
||||
repository: file://../../helm-guestbook
|
|
@ -1,35 +0,0 @@
|
|||
# Helm + Kustomize
|
||||
|
||||
Sometimes Helm chart don't have all required parameters and additional customization is required. This example application demonstrates how to combine Helm and Kustomize and use it
|
||||
as a config management plugin in Argo CD.
|
||||
|
||||
Use following steps to try the application:
|
||||
|
||||
* configure `kustomized-helm` tool in `argocd-cm` ConfigMap:
|
||||
|
||||
```yaml
|
||||
configManagementPlugins: |
|
||||
- name: kustomized-helm
|
||||
init:
|
||||
command: ["/bin/sh", "-c"]
|
||||
args: ["helm dependency build"]
|
||||
generate:
|
||||
command: ["/bin/sh", "-c"]
|
||||
args: ["helm template . --name-template $ARGOCD_APP_NAME --namespace $ARGOCD_APP_NAMESPACE --kube-version $KUBE_VERSION > all.yaml && kustomize build"]
|
||||
```
|
||||
|
||||
Notes:
|
||||
- `$ARGOCD_APP_NAME`, `$ARGOCD_APP_NAMESPACE` and `$KUBE_VERSION` are environment variables that exists in the context of the plugin.
|
||||
- setting `--kube-version` is important as helm template can mock up data which may not match the actual cluster version.
|
||||
|
||||
* create application using `kustomized-helm` as a config management plugin name:
|
||||
|
||||
|
||||
```
|
||||
argocd app create kustomized-helm \
|
||||
--config-management-plugin kustomized-helm \
|
||||
--repo https://github.com/argoproj/argocd-example-apps \
|
||||
--path plugins/kustomized-helm \
|
||||
--dest-server https://kubernetes.default.svc \
|
||||
--dest-namespace default
|
||||
```
|
|
@ -1,7 +0,0 @@
|
|||
namePrefix: kustomize-
|
||||
|
||||
resources:
|
||||
- ./all.yaml
|
||||
|
||||
patches:
|
||||
- overlays/guestbook-deployment.yaml
|
|
@ -1,10 +0,0 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: release-name-helm-guestbook
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: helm-guestbook
|
||||
image: 'gcr.io/google-samples/gb-frontend:v5'
|
|
@ -1 +0,0 @@
|
|||
result
|
|
@ -1,138 +0,0 @@
|
|||
# nix
|
||||
|
||||
[nix](https://nixos.org/) is a tool that takes a unique approach to package
|
||||
management and system configuration.
|
||||
|
||||
This setup is based on the [NixCon 2023 talk](https://www.youtube.com/watch?v=SEA1Qm8K4gY).
|
||||
|
||||
## Set up the argo-cd installation for nix support
|
||||
|
||||
This setup uses the stock `nixos/nix:latest` image without any modifications.
|
||||
That requires some changes in runtime, as nix cannot run as user 999 our of the
|
||||
box.
|
||||
|
||||
Add the following bits to the values.yaml of your helm deployment:
|
||||
|
||||
```yaml
|
||||
repoServer:
|
||||
volumes:
|
||||
- name: nix-cmp-config
|
||||
configMap:
|
||||
name: nix-cmp-config
|
||||
- name: nix-cmp-tmp
|
||||
emptyDir: {}
|
||||
- name: nix-cmp-nix
|
||||
emptyDir: {}
|
||||
- name: nix-cmp-home
|
||||
emptyDir: {}
|
||||
initContainers:
|
||||
- name: nix-bootstrap
|
||||
# the init container copies the whole nix store and profiles into the
|
||||
# temporary volume and makes sure the permissions are correct
|
||||
command:
|
||||
- 'sh'
|
||||
- '-c'
|
||||
- 'cp -a /nix/* /nixvol && chown -R 999 /nixvol/*'
|
||||
image: nixos/nix:latest
|
||||
# the image will always be updated at init step, so the one in the
|
||||
# extraContainers must have the policy of Never to always be the same
|
||||
# exact image.
|
||||
imagePullPolicy: Always
|
||||
volumeMounts:
|
||||
- mountPath: /nixvol
|
||||
name: nix-cmp-nix
|
||||
extraContainers:
|
||||
- name: nix-cmp-plugin
|
||||
command:
|
||||
- /var/run/argocd/argocd-cmp-server
|
||||
image: nixos/nix:latest
|
||||
imagePullPolicy: Never
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 999
|
||||
volumeMounts:
|
||||
- mountPath: /var/run/argocd
|
||||
name: var-files
|
||||
- mountPath: /home/argocd/cmp-server/plugins
|
||||
name: plugins
|
||||
- mountPath: /home/argocd/cmp-server/config/plugin.yaml
|
||||
subPath: plugin.yaml
|
||||
name: nix-cmp-config
|
||||
- mountPath: /etc/passwd
|
||||
subPath: passwd
|
||||
name: nix-cmp-config
|
||||
- mountPath: /etc/nix/nix.conf
|
||||
subPath: nix.conf
|
||||
name: nix-cmp-config
|
||||
- mountPath: /tmp
|
||||
name: nix-cmp-tmp
|
||||
- mountPath: /nix
|
||||
name: nix-cmp-nix
|
||||
- mountPath: /home/nix
|
||||
name: nix-cmp-home
|
||||
```
|
||||
|
||||
## Add the plugin ConfigMap:
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: nix-cmp-config
|
||||
namespace: argocd
|
||||
data:
|
||||
nix.conf: |
|
||||
build-users-group = nixbld
|
||||
sandbox = false
|
||||
experimental-features = nix-command flakes
|
||||
substituters = https://cache.nixos.org https://nixhelm.cachix.org
|
||||
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nixhelm.cachix.org-1:esqauAsR4opRF0UsGrA6H3gD21OrzMnBBYvJXeddjtY=
|
||||
passwd: |
|
||||
nix:x:999:30000:Nix build user 1:/home/nix:/bin/false
|
||||
root:x:0:0::/root:/bin/bash
|
||||
plugin.yaml: |
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: ConfigManagementPlugin
|
||||
metadata:
|
||||
name: nix-cmp-plugin
|
||||
spec:
|
||||
discover:
|
||||
fileName: flake.nix
|
||||
generate:
|
||||
command:
|
||||
- sh
|
||||
- "-c"
|
||||
- cat result
|
||||
init:
|
||||
command:
|
||||
- sh
|
||||
- "-c"
|
||||
- |
|
||||
export OUTPUT="${ARGOCD_ENV_NIX_OUTPUT:-kubernetesConfiguration}"
|
||||
echo -ne "Building for $OUTPUT\n" >/dev/stderr
|
||||
if [ "$PARAM_VALUES" != "" ]; then
|
||||
echo -ne "With values\n" >/dev/stderr
|
||||
echo "$PARAM_VALUES" > values.json
|
||||
nix-shell -p git --run ''git add values.json''
|
||||
fi
|
||||
if [ "$PARAM_IMPURE" == "true" ]; then
|
||||
echo -ne "With impure\n" >/dev/stderr
|
||||
IMPURE_FLAG="--impure"
|
||||
else
|
||||
IMPURE_FLAG=""
|
||||
fi
|
||||
nix build $IMPURE_FLAG ".#${OUTPUT}"
|
||||
lockRepo: true
|
||||
name: nix
|
||||
version: v1.0
|
||||
```
|
||||
|
||||
## Create a nix-based application
|
||||
|
||||
```
|
||||
argocd app create simple-nginx \
|
||||
--repo https://github.com/argoproj/argocd-example-apps \
|
||||
--path plugins/nix \
|
||||
--dest-server https://kubernetes.default.svc \
|
||||
--dest-namespace default
|
||||
```
|
|
@ -1,52 +0,0 @@
|
|||
{
|
||||
inputs.nixhelm.url = "github:farcaller/nixhelm";
|
||||
inputs.kubegen.url = "github:farcaller/nix-kube-generators";
|
||||
|
||||
outputs = { self, nixpkgs, nixhelm, kubegen, flake-utils }: flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
kubelib = kubegen.lib { inherit pkgs; };
|
||||
|
||||
addResources = yamlObjects: resources: builtins.foldl'
|
||||
(acc: y: acc ++ [ y ])
|
||||
resources
|
||||
yamlObjects;
|
||||
|
||||
# You can define k8s objects using standard nix syntax
|
||||
configMap = {
|
||||
apiVersion = "v1";
|
||||
kind = "ConfigMap";
|
||||
metadata.name = "website";
|
||||
data."index.html" = ''
|
||||
<html>
|
||||
<body>
|
||||
<h1>Hello, nix world!</h1>
|
||||
</body>
|
||||
</html>
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
packages.kubernetesConfiguration = pkgs.lib.pipe
|
||||
{
|
||||
name = "nginx";
|
||||
# nixhelm provides a repository of various public helm charts converted to nix
|
||||
chart = nixhelm.chartsDerivations.${system}.bitnami.nginx;
|
||||
namespace = "default";
|
||||
values = {
|
||||
replicaCount = 2;
|
||||
revisionHistoryLimit = 3;
|
||||
staticSiteConfigmap = configMap.metadata.name;
|
||||
};
|
||||
} [
|
||||
# lib.pipe is a handy function to run the processing over several functions in a sequence.
|
||||
# The final output must gnerate a YAML file.
|
||||
kubelib.buildHelmChart
|
||||
builtins.readFile
|
||||
kubelib.fromYAML
|
||||
(addResources [configMap])
|
||||
kubelib.mkList
|
||||
kubelib.toYAMLFile
|
||||
];
|
||||
});
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
namePrefix: pre-post-sync-
|
||||
|
||||
bases:
|
||||
- ../kustomize-guestbook
|
||||
|
||||
resources:
|
||||
- pre-sync-job.yaml
|
||||
- post-sync-job.yaml
|
|
@ -1,16 +0,0 @@
|
|||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: after
|
||||
annotations:
|
||||
argocd.argoproj.io/hook: PostSync
|
||||
argocd.argoproj.io/hook-delete-policy: HookSucceeded
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: sleep
|
||||
image: alpine:latest
|
||||
command: ["sleep", "10"]
|
||||
restartPolicy: Never
|
||||
backoffLimit: 0
|
|
@ -1,16 +0,0 @@
|
|||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: before
|
||||
annotations:
|
||||
argocd.argoproj.io/hook: PreSync
|
||||
argocd.argoproj.io/hook-delete-policy: HookSucceeded
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: sleep
|
||||
image: alpine:latest
|
||||
command: ["sleep", "10"]
|
||||
restartPolicy: Never
|
||||
backoffLimit: 0
|
|
@ -0,0 +1,4 @@
|
|||
/lib
|
||||
/.ksonnet/registries
|
||||
/app.override.yaml
|
||||
/.ks_environment
|
|
@ -0,0 +1,11 @@
|
|||
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: sock-shop
|
||||
version: 0.0.1
|
|
@ -1,14 +0,0 @@
|
|||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: carts
|
||||
labels:
|
||||
name: carts
|
||||
spec:
|
||||
ports:
|
||||
# the port that this service should serve on
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
selector:
|
||||
name: carts
|
|
@ -1,23 +0,0 @@
|
|||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: front-end-ingress
|
||||
labels:
|
||||
name: front-end
|
||||
annotations:
|
||||
ingress.kubernetes.io/proxy-body-size: 100M
|
||||
ingress.kubernetes.io/app-root: '/'
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
rules:
|
||||
- host: sockshop.apps.argoproj.io
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
service:
|
||||
name: front-end
|
||||
port:
|
||||
number: 80
|
|
@ -6,9 +6,10 @@ metadata:
|
|||
labels:
|
||||
name: front-end
|
||||
spec:
|
||||
type: ClusterIP
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 8079
|
||||
nodePort: 30001
|
||||
selector:
|
||||
name: front-end
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
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
|
||||
"carts-db-dep": {},
|
||||
"carts-db-svc": {},
|
||||
"carts-dep": {},
|
||||
"catalogue-db-dep": {},
|
||||
"catalogue-db-svc": {},
|
||||
"catalogue-dep": {},
|
||||
"catalogue-svc": {},
|
||||
"front-end-dep": {},
|
||||
"front-end-svc": {},
|
||||
"orders-db-dep": {},
|
||||
"orders-db-svc": {},
|
||||
"orders-dep": {},
|
||||
"orders-svc": {},
|
||||
"payment-dep": {},
|
||||
"payment-svc": {},
|
||||
"queue-master-dep": {},
|
||||
"queue-master-svc": {},
|
||||
"rabbitmq-dep": {},
|
||||
"rabbitmq-svc": {},
|
||||
"session-db-dep": {},
|
||||
"session-db-svc": {},
|
||||
"shipping-dep": {},
|
||||
"shipping-svc": {},
|
||||
"user-db-dep": {},
|
||||
"user-db-svc": {},
|
||||
"user-dep": {},
|
||||
"user-svc": {},
|
||||
},
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
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
Loading…
Reference in New Issue