Skip to content

Commit f2fdcb4

Browse files
authored
Merge pull request #5 from commitdev/fixes-to-get-pipeline-working
A bunch of small fixes to get the pipeline running
2 parents 522e9fa + 9ae6886 commit f2fdcb4

8 files changed

Lines changed: 26 additions & 19 deletions

File tree

.circleci/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,15 @@ $ aws eks list-clusters --query "clusters"
1313

1414
- AWS_ACCESS_KEY_ID # AWS access key for the circleci user - this should be in AWS secret manager
1515
- AWS_SECRET_ACCESS_KEY # AWS secret for the circleci user - this should be in AWS secret manager
16-
- AWS_DEFAULT_REGION # Region of your cluster
16+
- AWS_REGION # Region of your EKS cluster
1717
- AWS_ECR_ACCOUNT_URL # {awsAccountNum}.dkr.ecr.{region}.amazonaws.com
1818
- AWS_ECR_REPO_NAME # The ECR repository name to write images to
1919
- PRODUCTION_EKS_CLUSTER_NAME # The name of the production EKS cluster to deploy into
2020
- STAGING_EKS_CLUSTER_NAME # The name of the staging EKS cluster to deploy into
21+
- AWS_CLUSTER_AUTH_ROLE_ARN_STAGING # The ARN of the role to assume that allows access to the EK cluster. Most likely ends with `kubernetes-admin-staging`
22+
- AWS_CLUSTER_AUTH_ROLE_ARN_PRODUCTION # The ARN of the role to assume that allows access to the EKS cluster. Same as above but for production
23+
- SLACK_WEBHOOK # Webhook for slack notifications. Must be specified, but doesn't need to be set to a real value
24+
- CIRCLECI_API_KEY # Needed for the queueing orb. You can generate this in the project settings in CircleCI. It needs the `status` scope.
2125

2226

2327
## Deployment Process

.circleci/config.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ jobs:
193193
- version-tag/get
194194
- run: *install-binaries
195195
- aws-cli/install
196-
- aws-cli/setup
196+
- aws-cli/setup:
197+
aws-region: AWS_REGION
197198
- aws-eks/update-kubeconfig-with-authenticator:
198199
cluster-name: << parameters.cluster-name >>
199200
cluster-authentication-role-arn: << parameters.cluster-authentication-role-arn >>
@@ -204,6 +205,7 @@ jobs:
204205
- run:
205206
name: Deploy
206207
command: |
208+
kubectl create namespace << parameters.namespace >> || echo "Namespace already exists"
207209
cd kubernetes/overlays/<< parameters.config-environment >>
208210
IMAGE=${AWS_ECR_ACCOUNT_URL}/<< parameters.repo >>
209211
kustomize edit set image fake-image=${IMAGE}:${VERSION_TAG}
@@ -233,8 +235,8 @@ workflows:
233235
cluster-name: "${STAGING_EKS_CLUSTER_NAME}"
234236
config-environment: "staging"
235237
cluster-authentication-role-arn: "${AWS_CLUSTER_AUTH_ROLE_ARN_STAGING}"
236-
region: "${AWS_DEFAULT_REGION}"
237-
namespace: "${CIRCLE_BRANCH}"
238+
region: "${AWS_REGION}"
239+
namespace: "${AWS_ECR_REPO_NAME}"
238240
tag: "${VERSION_TAG}"
239241
requires:
240242
- build_and_push
@@ -255,8 +257,8 @@ workflows:
255257
cluster-name: "${PRODUCTION_EKS_CLUSTER_NAME}"
256258
config-environment: "production"
257259
cluster-authentication-role-arn: "${AWS_CLUSTER_AUTH_ROLE_ARN_PRODUCTION}"
258-
region: "${AWS_DEFAULT_REGION}"
259-
namespace: "${CIRCLE_BRANCH}"
260+
region: "${AWS_REGION}"
261+
namespace: "${AWS_ECR_REPO_NAME}"
260262
tag: "${VERSION_TAG}"
261263
requires:
262264
- queue/block_workflow

kubernetes/base/deployment.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,19 @@ spec:
3333
initialDelaySeconds: 5
3434
periodSeconds: 10
3535
timeoutSeconds: 2
36+
ports:
37+
- containerPort: 80
38+
name: http
3639
envFrom:
3740
- configMapRef:
3841
name: <% .Name %>-config
3942
env:
40-
- name: POD_NAME
41-
valueFrom:
42-
fieldRef:
43-
fieldPath: metadata.name
43+
- name: SERVER_PORT
44+
value: "80"
45+
- name: POD_NAME
46+
valueFrom:
47+
fieldRef:
48+
fieldPath: metadata.name
4449
- name: DATABASE_USERNAME
4550
valueFrom:
4651
secretKeyRef:

kubernetes/base/service.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ spec:
77
- name: http
88
protocol: TCP
99
port: 80
10-
targetPort: 80
10+
targetPort: http
1111
selector:
1212
app: <% .Name %>

kubernetes/overlays/production/kustomization.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33

4-
bases:
5-
- ../../base
6-
74
patchesStrategicMerge:
85
- deployment.yml
96

107
resources:
8+
- ../../base
119
- ingress.yaml
1210
- pdb.yaml
1311

kubernetes/overlays/staging/deployment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spec:
1010
resources:
1111
requests:
1212
memory: 128Mi
13-
cpu: 0.5
13+
cpu: 0.1
1414
limits:
1515
memory: 512Mi
1616
cpu: 1.0

kubernetes/overlays/staging/kustomization.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33

4-
bases:
5-
- ../../base
6-
74
patchesStrategicMerge:
85
- deployment.yml
96

107
resources:
8+
- ../../base
119
- ingress.yml
1210

1311
configMapGenerator:

kubernetes/secrets/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Application secrets are stored in the kubernetes secrets management system, wher
1717

1818
## Adding a new secret to staging / production kuberenetes
1919
(Similar to the dev process)
20-
1. Download the `secrets.env` and `settings.ini` for the correct environment from lastpass
20+
1. Download the `secrets.env` for the correct environment from where it is stored
2121
2. Make sure your `kubectl` context is set to the proper environment
2222
3. Run `kubectl apply -k .` (Change the namespace if necessary using `-n <namespace>`)
2323

0 commit comments

Comments
 (0)