Skip to content

Commit

Permalink
pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
seemywingz committed Sep 12, 2024
1 parent 63f10e4 commit 3195d8e
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 20 deletions.
73 changes: 73 additions & 0 deletions pages/how-to/set-up/micro-service copy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
title: Setting Up a Micro Service
description: Deploying a Micro Service with Plural
---


# Set Up
This example will deploy the [Plural CD Demo](https://github.com/pluralsh/plrl-cd-demo) App

#### Add the Application Repository
* In your _Infra_ repo, add the `GitRepository` CRD
* `/app/repositories/cd-demo.yaml`
```yaml
apiVersion: deployments.plural.sh/v1alpha1
kind: GitRepository
metadata:
name: cd-demo
spec:
url: https://github.com/pluralsh/plrl-cd-demo.git
```
* The Plural repositories Service Deployment watches for changes in `/app/repositories` and will sync it to the management cluster
* The status `Pullable` means the Repository is ready to be used.
![import-git-status](/images/how-to/import-git-status.png)
* Setup a Dev and Prod ServiceDeployment using the Added Repo
```yaml
apiVersion: deployments.plural.sh/v1alpha1
kind: ServiceDeployment
metadata:
name: cd-demo-dev
namespace: infra
spec:
namespace: cd-demo
git:
folder: helm
ref: main
repositoryRef:
kind: GitRepository
name: cd-demo
namespace: infra
helm:
version: "x.x.x"
release: cd-demo-dev
values:
image:
repository: ghcr.io/pluralsh/plrl-cd-test
pullPolicy: IfNotPresent
tag: "sha-783cc0c"
ingress:
enabled: true
className: nginx
annotations:
cert-manager.io/cluster-issuer: letsencrypt-staging
hosts:
- host: cd-demo.plrl.livingroom.cloud
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: cd-demo-dev
port:
number: 80
tls:
- secretName: cd-demo-tls
hosts:
- cd-demo.plrl.livingroom.cloud
clusterRef:
kind: Cluster
name: plrl-how-to-workload-00-dev
namespace: infra
```
* You should be able to see the service and all its components running
![](/images/how-to/micro-service.png)
11 changes: 9 additions & 2 deletions pages/how-to/set-up/micro-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Deploying a Micro Service with Plural


# Set Up
For this example we will deploy the [Plural CD Demo](https://github.com/pluralsh/plrl-cd-demo) App
This example will deploy the [Plural CD Demo](https://github.com/pluralsh/plrl-cd-demo) App

#### Add the Application Repository
* In your _Infra_ repo, add the `GitRepository` CRD
Expand Down Expand Up @@ -55,6 +55,11 @@ spec:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: cd-demo-dev
port:
number: 80
tls:
- secretName: cd-demo-tls
hosts:
Expand All @@ -63,4 +68,6 @@ spec:
kind: Cluster
name: plrl-how-to-workload-00-dev
namespace: infra
```
```
* You should be able to see the service and all its components running
![](/images/how-to/micro-service.png)
67 changes: 49 additions & 18 deletions pages/how-to/set-up/pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,58 @@ description: Using Plural Deploy Pipelines

#### Ensure your _[app.plural.sh](https://app.plural.sh/profile/me)_ User has `admin` permissions

```sh
plural login
```

# Set Up
Set Up a dev -> staging -> prod pipeline

include creation of the rest of the cluster fleet with stacks
This example will setup pipelines to deploy the [Plural CD Demo](https://github.com/pluralsh/plrl-cd-demo)

include CRDs
* We'll Create a Prod Cluster to promote the _cd-demo_ application to
* We'll follow the [steps for creating a new cluster](/how-to/set-up/workload-cluster), but select the `prd` tier
* Merge the changes from the PR Automation and Approve the Stack changes
* Once the cluster is created successfully we can create the prod service deployment

use the prior microservice

# Troubleshooting
#### Get Kubeconfig for the MGMT Cluster
```sh
plural wkspace kube-init
* Create a Pipeline.yaml in your _infra_ repo:
```yaml
apiVersion: deployments.plural.sh/v1alpha1
kind: Pipeline
metadata:
name: cd-demo
namespace: infra
spec:
stages:
- name: dev
services:
- serviceRef:
name: cd-demo-dev
namespace: cd-demo
- name: prod
services:
- serviceRef:
name: cd-demo
namespace: cd-demo
criteria:
serviceRef:
name: cd-demo
namespace: cd-demo
secrets:
- version
edges:
- from: dev
to: prod
gates:
- name: approval-gate
type: APPROVAL
---
apiVersion: deployments.plural.sh/v1alpha1
kind: PipelineContext
metadata:
name: cd-demo-context
spec:
pipelineRef:
name: cd-demo
namespace: infra
context:
version: 6.5.4
```

Use `kubectl` with the newly added kube context
The key namespaces to check are:
* plrl-console
* plrl-deploy-operator
* plrl-runtime
* Apply the yaml to your Management Cluster
* `kubectl -n infra apply -f pipline.ymal`
Binary file added public/images/how-to/micro-service.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/NavData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ const rootNavData: NavMenu = deepFreeze([
title: 'Micro Service',
href: '/how-to/set-up/micro-service',
},
{
title: 'Pipelines',
href: '/how-to/set-up/pipelines',
},
],
},
],
Expand Down

0 comments on commit 3195d8e

Please sign in to comment.