-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: New Namespace testing (DO NOT MERGE)
- Loading branch information
1 parent
b0a61a1
commit 11329e0
Showing
11 changed files
with
245 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
namespaces/live-2.cloud-platform.service.justice.gov.uk/jacksapp-test/00-namespace.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: jacksapp-test | ||
labels: | ||
cloud-platform.justice.gov.uk/is-production: "false" | ||
cloud-platform.justice.gov.uk/environment-name: "test" | ||
pod-security.kubernetes.io/enforce: restricted | ||
annotations: | ||
cloud-platform.justice.gov.uk/business-unit: "Platforms" | ||
cloud-platform.justice.gov.uk/slack-channel: "cloud-platform" | ||
cloud-platform.justice.gov.uk/application: "jack kube learning" | ||
cloud-platform.justice.gov.uk/owner: "Cloud Platform: [email protected]" | ||
cloud-platform.justice.gov.uk/source-code: "https://github.com/ministryofjustice/cloud-platform-helloworld-ruby-app" | ||
cloud-platform.justice.gov.uk/team-name: "webops" | ||
cloud-platform.justice.gov.uk/review-after: "2022-06-15" |
13 changes: 13 additions & 0 deletions
13
namespaces/live-2.cloud-platform.service.justice.gov.uk/jacksapp-test/01-rbac.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
kind: RoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: jacksapp-dev-admin | ||
namespace: jacksapp-test | ||
subjects: | ||
- kind: Group | ||
name: "github:webops" | ||
apiGroup: rbac.authorization.k8s.io | ||
roleRef: | ||
kind: ClusterRole | ||
name: admin | ||
apiGroup: rbac.authorization.k8s.io |
14 changes: 14 additions & 0 deletions
14
namespaces/live-2.cloud-platform.service.justice.gov.uk/jacksapp-test/02-limitrange.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: v1 | ||
kind: LimitRange | ||
metadata: | ||
name: limitrange | ||
namespace: jacksapp-test | ||
spec: | ||
limits: | ||
- default: | ||
cpu: 1000m | ||
memory: 1000Mi | ||
defaultRequest: | ||
cpu: 10m | ||
memory: 100Mi | ||
type: Container |
8 changes: 8 additions & 0 deletions
8
namespaces/live-2.cloud-platform.service.justice.gov.uk/jacksapp-test/03-resourcequota.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: ResourceQuota | ||
metadata: | ||
name: namespace-quota | ||
namespace: jacksapp-test | ||
spec: | ||
hard: | ||
pods: "50" |
27 changes: 27 additions & 0 deletions
27
namespaces/live-2.cloud-platform.service.justice.gov.uk/jacksapp-test/04-networkpolicy.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: jacksapp-test | ||
spec: | ||
podSelector: {} | ||
policyTypes: | ||
- Ingress | ||
ingress: | ||
- from: | ||
- podSelector: {} | ||
--- | ||
kind: NetworkPolicy | ||
apiVersion: networking.k8s.io/v1 | ||
metadata: | ||
name: allow-ingress-controllers | ||
namespace: jacksapp-test | ||
spec: | ||
podSelector: {} | ||
policyTypes: | ||
- Ingress | ||
ingress: | ||
- from: | ||
- namespaceSelector: | ||
matchLabels: | ||
component: ingress-controllers |
38 changes: 38 additions & 0 deletions
38
namespaces/live-2.cloud-platform.service.justice.gov.uk/jacksapp-test/resources/ecr.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Make sure that you use the latest version of the module by changing the | ||
* `ref=` value in the `source` attribute to the latest version listed on the | ||
* releases page of this repository. | ||
* | ||
*/ | ||
module "ecr_credentials" { | ||
source = "github.com/ministryofjustice/cloud-platform-terraform-ecr-credentials?ref=5.1.1" | ||
team_name = var.team_name | ||
repo_name = "${var.namespace}-live-2-ecr" | ||
|
||
/* | ||
By default scan_on_push is set to true. When this is enabled then all images pushed to the repo are scanned for any security | ||
/ software vulnerabilities in your image and the results can be viewed in the console. For further details, please see: | ||
https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html | ||
To disable 'scan_on_push', set it to false as below: | ||
scan_on_push = "false" | ||
*/ | ||
|
||
# Uncomment and provide repository names to create github actions secrets | ||
# containing the ECR name, AWS access key, and AWS secret key, for use in | ||
# github actions CI/CD pipelines | ||
# github_repositories = ["my-repo"] | ||
} | ||
|
||
resource "kubernetes_secret" "ecr_credentials" { | ||
metadata { | ||
name = "ecr-repo-${var.namespace}-live-2" | ||
namespace = var.namespace | ||
} | ||
|
||
data = { | ||
access_key_id = module.ecr_credentials.access_key_id | ||
secret_access_key = module.ecr_credentials.secret_access_key | ||
repo_arn = module.ecr_credentials.repo_arn | ||
repo_url = module.ecr_credentials.repo_url | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
namespaces/live-2.cloud-platform.service.justice.gov.uk/jacksapp-test/resources/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
terraform { | ||
backend "s3" { | ||
} | ||
} | ||
|
||
provider "aws" { | ||
region = "eu-west-2" | ||
} | ||
|
||
provider "aws" { | ||
alias = "london" | ||
region = "eu-west-2" | ||
} | ||
|
||
provider "aws" { | ||
alias = "ireland" | ||
region = "eu-west-1" | ||
} | ||
|
||
provider "github" { | ||
token = var.github_token | ||
owner = var.github_owner | ||
} |
25 changes: 25 additions & 0 deletions
25
namespaces/live-2.cloud-platform.service.justice.gov.uk/jacksapp-test/resources/route53.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
resource "aws_route53_zone" "route53_zone" { | ||
name = "jacksapp-devs.service.justice.gov.uk" | ||
|
||
tags = { | ||
team_name = var.team_name | ||
business-unit = var.business_unit | ||
application = var.application | ||
is-production = var.is_production | ||
environment-name = var.environment | ||
owner = var.team_name | ||
infrastructure-support = var.infrastructure_support | ||
namespace = var.namespace | ||
} | ||
} | ||
|
||
resource "kubernetes_secret" "route53_zone_sec" { | ||
metadata { | ||
name = "jacksapp-route53-zone-output" | ||
namespace = var.namespace | ||
} | ||
|
||
data = { | ||
zone_id = aws_route53_zone.route53_zone.zone_id | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...es/live-2.cloud-platform.service.justice.gov.uk/jacksapp-test/resources/serviceaccount.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module "serviceaccount" { | ||
source = "github.com/ministryofjustice/cloud-platform-terraform-serviceaccount?ref=1.0.0" | ||
|
||
namespace = var.namespace | ||
kubernetes_cluster = var.kubernetes_cluster | ||
|
||
# Uncomment and provide repository names to create github actions secrets | ||
# containing the ca.crt and token for use in github actions CI/CD pipelines | ||
# github_repositories = [""] | ||
} |
54 changes: 54 additions & 0 deletions
54
namespaces/live-2.cloud-platform.service.justice.gov.uk/jacksapp-test/resources/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
variable "vpc_name" { | ||
} | ||
|
||
|
||
variable "kubernetes_cluster" { | ||
} | ||
|
||
variable "application" { | ||
description = "Name of Application you are deploying" | ||
default = "jack kube learning" | ||
} | ||
|
||
variable "namespace" { | ||
default = "jacksapp-test" | ||
} | ||
|
||
variable "business_unit" { | ||
description = "Area of the MOJ responsible for the service." | ||
default = "Platforms" | ||
} | ||
|
||
variable "team_name" { | ||
description = "The name of your development team" | ||
default = "webops" | ||
} | ||
|
||
variable "environment" { | ||
description = "The type of environment you're deploying to." | ||
default = "development" | ||
} | ||
|
||
variable "infrastructure_support" { | ||
description = "The team responsible for managing the infrastructure. Should be of the form team-email." | ||
default = "[email protected]" | ||
} | ||
|
||
variable "is_production" { | ||
default = "false" | ||
} | ||
|
||
variable "slack_channel" { | ||
description = "Team slack channel to use if we need to contact your team" | ||
default = "cloud-platform" | ||
} | ||
|
||
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" | ||
default = "ministryofjustice" | ||
} | ||
|
||
variable "github_token" { | ||
description = "Required by the Github Terraform provider" | ||
default = "" | ||
} |
17 changes: 17 additions & 0 deletions
17
namespaces/live-2.cloud-platform.service.justice.gov.uk/jacksapp-test/resources/versions.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.27.0" | ||
} | ||
github = { | ||
source = "integrations/github" | ||
version = "~> 5.17.0" | ||
} | ||
kubernetes = { | ||
source = "hashicorp/kubernetes" | ||
version = "~> 2.18.0" | ||
} | ||
} | ||
} |