Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test ac #23537

Closed
wants to merge 17 commits into from
Closed

Test ac #23537

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
a958fc9
feat(workflow): add auto-approve to pull requests containing only ski…
jackstockley89 May 31, 2024
09aa8ae
Add sandbox for learning Cloud Platform for David Conneely
dconneely Jun 4, 2024
2db25ca
Update hmpps-auth domain name in variables.tf
simon-mitchell Jun 4, 2024
104b7e9
Update actual UTIAC staging rds to medium
mark-butler-solirius Jun 4, 2024
e2814c4
Merge pull request #23401 from ministryofjustice/sm-HAAR-remove-alt-f…
simon-mitchell Jun 4, 2024
dc774d2
Merge pull request #23404 from ministryofjustice/RST-6669-upgrade-sta…
mark-butler-solirius Jun 4, 2024
a6b51f0
Add preprod database secrets to production (#23403)
andrewl Jun 4, 2024
d348f01
Merge pull request #23368 from ministryofjustice/skip-file-auto-approval
mikebell Jun 4, 2024
d08fd89
Adds preprod credentials to prod (#23406)
andrewl Jun 4, 2024
031a9b0
Reset staging env to not skip and prepare production for same rds update
mark-butler-solirius Jun 4, 2024
3045f98
Empty - Commit
dconneely Jun 4, 2024
0d9be22
Merge pull request #23402 from ministryofjustice/create_davidconneely…
dconneely Jun 4, 2024
6bf3312
Merge pull request #23407 from ministryofjustice/RST-6669-upgrade-sta…
mark-butler-solirius Jun 4, 2024
8d19f61
adding copysnapshot action to specific snapshot resource
mnasr-moj Jun 4, 2024
5bf970c
Merge pull request #23408 from ministryofjustice/LAWS-3919
mnasr-moj Jun 4, 2024
6366ae4
test files for the annotations checker
Jun 11, 2024
0f33a3a
Commit changes made by code formatters
github-actions[bot] Jun 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .checksum
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#This file is used by the auto pr github action. Please commit
hmpps-prison-person-api-dev
h1:X0IPZ61bj8Dr9uOu4DfB3aEv7xVmz7HfkCOGPssMR7M=
davidconneely-sandbox-dev
h1:L0A1RdN31mV+0E28WFe3NwgXZ/SEfcq9qN6mlz7LCBM=
42 changes: 42 additions & 0 deletions .github/workflows/skip-file-auto-approval.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: skip-file-auto-approval

on:
pull_request:
paths:
- '**/APPLY_PIPELINE_SKIP_THIS_NAMESPACE'

jobs:
commit-check:
runs-on: ubuntu-latest
permissions:
pull-requests: write
env:
GITHUB_REF: §{{ github.ref }}
GITHUB_REPOSITORY: §{{ github.event.repository.name }}
FILE_NAME: "APPLY_PIPELINE_SKIP_THIS_NAMESPACE"
steps:
- name: checkout
uses: actions/checkout@v2

- id: commit-check
name: commit check
uses: docker://ministryofjustice/cloud-platform-commit-check:latest

- name: auto approve
if: ${{ steps.commit-check.outputs.approval == 'approval_not_needed' }}
uses: hmarr/auto-approve-action@v4
with:
review-message: 'Automatically approving PR for skip file'

- name: cloud platform approval needed
if: ${{ steps.commit-check.outputs.approval == 'approval_needed' }}
uses: actions/github-script@v7
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'This PR requires approval from the Cloud Platform team. Please wait for a member of the team to review.'
})
16 changes: 16 additions & 0 deletions cmd/tac/notnamespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Rolebinding
metadata:
name: "hmpps-jobs-board-dev"
labels:
cloud-platform.justice.gov.uk/is-production: "false"
cloud-platform.justice.gov.uk/environment-name: "development"
pod-security.kubernetes.io/enforce: restricted
annotations:
cloud-platform.justice.gov.uk/business-unit: "HMPPS"
cloud-platform.justice.gov.uk/slack-channel: "prison-education"
cloud-platform.justice.gov.uk/application: "Jobs Board"
cloud-platform.justice.gov.uk/owner: "Education Skills Work and Employment: [email protected]"
cloud-platform.justice.gov.uk/source-code: "https://github.com/ministryofjustice/hmpps-jobs-board-api"
cloud-platform.justice.gov.uk/team-name: "education-skills-work-employment"
cloud-platform.justice.gov.uk/review-after: ""
16 changes: 16 additions & 0 deletions cmd/tac/rightsc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Namespace
metadata:
name: "hmpps-jobs-board-dev"
labels:
cloud-platform.justice.gov.uk/is-production: "false"
cloud-platform.justice.gov.uk/environment-name: "development"
pod-security.kubernetes.io/enforce: restricted
annotations:
cloud-platform.justice.gov.uk/business-unit: "HMPPS"
cloud-platform.justice.gov.uk/slack-channel: "prison-education"
cloud-platform.justice.gov.uk/application: "Jobs Board"
cloud-platform.justice.gov.uk/owner: "Education Skills Work and Employment: [email protected]"
cloud-platform.justice.gov.uk/source-code: "https://github.com/ministryofjustice/hmpps-jobs-board-api"
cloud-platform.justice.gov.uk/team-name: "education-skills-work-employment"
cloud-platform.justice.gov.uk/review-after: ""
16 changes: 16 additions & 0 deletions cmd/tac/wrongsc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Namespace
metadata:
name: "hmpps-jobs-board-dev"
labels:
cloud-platform.justice.gov.uk/is-production: "false"
cloud-platform.justice.gov.uk/environment-name: "development"
pod-security.kubernetes.io/enforce: restricted
annotations:
cloud-platform.justice.gov.uk/business-unit: "HMPPS"
cloud-platform.justice.gov.uk/slack-channel: "prison-education"
cloud-platform.justice.gov.uk/application: "Jobs Board"
cloud-platform.justice.gov.uk/owner: "Education Skills Work and Employment: [email protected]"
cloud-platform.justice.gov.uk/source-code: "https://github.com/ministryofjustice/hmpps-jobs-board-ap"
cloud-platform.justice.gov.uk/team-name: "education-skills-work-employment"
cloud-platform.justice.gov.uk/review-after: ""
16 changes: 16 additions & 0 deletions cmd/tac/wrongteam.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Namespace
metadata:
name: "hmpps-jobs-board-dev"
labels:
cloud-platform.justice.gov.uk/is-production: "false"
cloud-platform.justice.gov.uk/environment-name: "development"
pod-security.kubernetes.io/enforce: restricted
annotations:
cloud-platform.justice.gov.uk/business-unit: "HMPPS"
cloud-platform.justice.gov.uk/slack-channel: "prison-education"
cloud-platform.justice.gov.uk/application: "Jobs Board"
cloud-platform.justice.gov.uk/owner: "Education Skills Work and Employment: [email protected]"
cloud-platform.justice.gov.uk/source-code: "https://github.com/ministryofjustice/hmpps-jobs-board-api"
cloud-platform.justice.gov.uk/team-name: "education-skills-work-employmen"
cloud-platform.justice.gov.uk/review-after: ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Namespace
metadata:
name: "davidconneely-sandbox-dev"
labels:
cloud-platform.justice.gov.uk/is-production: "false"
cloud-platform.justice.gov.uk/environment-name: "development"
pod-security.kubernetes.io/enforce: restricted
annotations:
cloud-platform.justice.gov.uk/business-unit: "LAA"
cloud-platform.justice.gov.uk/slack-channel: "dces"
cloud-platform.justice.gov.uk/application: "Sandbox for David Conneely"
cloud-platform.justice.gov.uk/owner: "DCES: [email protected]"
cloud-platform.justice.gov.uk/source-code: "https://github.com/ministryofjustice/davidconneely-sandbox"
cloud-platform.justice.gov.uk/team-name: "davidconneely-sandbox"
cloud-platform.justice.gov.uk/review-after: "2024-09-04"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: davidconneely-sandbox-dev-admin
namespace: davidconneely-sandbox-dev
subjects:
- kind: Group
name: "github:davidconneely-sandbox"
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: ClusterRole
name: admin
apiGroup: rbac.authorization.k8s.io
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: LimitRange
metadata:
name: limitrange
namespace: davidconneely-sandbox-dev
spec:
limits:
- default:
cpu: 1000m
memory: 1000Mi
defaultRequest:
cpu: 10m
memory: 100Mi
type: Container
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ResourceQuota
metadata:
name: namespace-quota
namespace: davidconneely-sandbox-dev
spec:
hard:
pods: "50"
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default
namespace: davidconneely-sandbox-dev
spec:
podSelector: {}
policyTypes:
- Ingress
ingress:
- from:
- podSelector: {}
---
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: allow-ingress-controllers
namespace: davidconneely-sandbox-dev
spec:
podSelector: {}
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelector:
matchLabels:
component: ingress-controllers
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
terraform {
backend "s3" {
}
}

provider "aws" {
region = "eu-west-2"

default_tags {
tags = {
source-code = "github.com/ministryofjustice/cloud-platform-environments"
slack-channel = var.slack_channel
}
}
}

provider "aws" {
alias = "london"
region = "eu-west-2"

default_tags {
tags = {
source-code = "github.com/ministryofjustice/cloud-platform-environments"
slack-channel = var.slack_channel
}
}
}

provider "aws" {
alias = "ireland"
region = "eu-west-1"

default_tags {
tags = {
source-code = "github.com/ministryofjustice/cloud-platform-environments"
slack-channel = var.slack_channel
}
}
}

provider "github" {
token = var.github_token
owner = var.github_owner
}

provider "kubernetes" {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
variable "vpc_name" {
description = "VPC name to create security groups in for the ElastiCache and RDS modules"
type = string
}

variable "kubernetes_cluster" {
description = "Kubernetes cluster name for references to secrets for service accounts"
type = string
}

variable "application" {
description = "Name of the application you are deploying"
type = string
default = "Sandbox for David Conneely"
}

variable "namespace" {
description = "Name of the namespace these resources are part of"
type = string
default = "davidconneely-sandbox-dev"
}

variable "business_unit" {
description = "Area of the MOJ responsible for this service"
type = string
default = "LAA"
}

variable "team_name" {
description = "Name of the development team responsible for this service"
type = string
default = "davidconneely-sandbox"
}

variable "environment" {
description = "Name of the environment type for this service"
type = string
default = "development"
}

variable "infrastructure_support" {
description = "Email address of the team responsible this service"
type = string
default = "[email protected]"
}

variable "is_production" {
description = "Whether this environment type is production or not"
type = string
default = "false"
}

variable "slack_channel" {
description = "Slack channel name for your team, if we need to contact you about this service"
type = string
default = "dces"
}

variable "github_owner" {
description = "The GitHub organization or individual user account containing the app's code repo. Used by the Github Terraform provider. See: https://user-guide.cloud-platform.service.justice.gov.uk/documentation/getting-started/ecr-setup.html#accessing-the-credentials"
type = string
default = "ministryofjustice"
}

variable "github_token" {
type = string
description = "Required by the GitHub Terraform provider"
default = ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
terraform {
required_version = ">= 1.2.5"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.67.0"
}
github = {
source = "integrations/github"
version = "~> 5.39.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "~> 2.23.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ variable "vpc_name" {
}

variable "domain" {
default = "sign-in-alt.hmpps.service.justice.gov.uk"
default = "sign-in.hmpps.service.justice.gov.uk"
}

variable "application" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module "irsa" {
role_policy_arns = {
sqs_cclf_claims = aws_iam_policy.cclf_policy.arn
rds = module.rds-instance.irsa_policy_arn
cclf_copy_snapshot = aws_iam_policy.cclf_copy_snapshot_policy.arn
}

# Tags
Expand Down Expand Up @@ -59,6 +60,36 @@ resource "aws_iam_policy" "cclf_policy" {
}
}

data "aws_iam_policy_document" "cclf_copy_snapshot_policy_document" {
# Provide list of permissions and target AWS account resources to allow access to
statement {
sid = "CCLFPolicyRDSCopySnapshotDev"
effect = "Allow"
actions = [
"rds:CopyDBSnapshot",
]
resources = [
"arn:aws:rds:eu-west-2:411213865113:snapshot:cclf-dev-for-copy-over-to-cloud-platform",
]
}

}

resource "aws_iam_policy" "cclf_copy_snapshot_policy" {
name = "cclf_copy_snapshot_policy"
policy = data.aws_iam_policy_document.cclf_copy_snapshot_policy_document.json
description = "Policy for Cloud Platform to assume role in data platform dev account for CCLF"

tags = {
business-unit = var.business_unit
application = var.application
is-production = var.is_production
environment-name = var.environment
owner = var.github_owner
infrastructure-support = var.infrastructure_support
}
}

module "service_pod" {
source = "github.com/ministryofjustice/cloud-platform-terraform-service-pod?ref=1.0.0" # use the latest release

Expand Down
Loading