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

[Blueprint 02-At scale] Migration to helm-openldap/openldap-stack-ha (part I) #140

Merged
merged 41 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
2461d52
Addressing #72
carlosrodlop May 15, 2024
81d56f5
Adding main for ci
carlosrodlop May 15, 2024
7b03742
fix line
carlosrodlop May 15, 2024
152f194
terraform-docs: automated action
github-actions[bot] May 15, 2024
87acb13
Update blueprints/02-at-scale/README.md
carlosrodlop May 15, 2024
812eb76
Update blueprints/02-at-scale/README.md
carlosrodlop May 15, 2024
2057eb3
terraform-docs: automated action
github-actions[bot] May 15, 2024
f507f8b
Update blueprints/02-at-scale/outputs.tf
carlosrodlop May 15, 2024
a8f8311
Update blueprints/02-at-scale/outputs.tf
carlosrodlop May 15, 2024
b0ccb68
Update blueprints/02-at-scale/outputs.tf
carlosrodlop May 15, 2024
3094544
Update blueprints/02-at-scale/outputs.tf
carlosrodlop May 15, 2024
643bcfc
terraform-docs: automated action
github-actions[bot] May 15, 2024
3c5d134
Update blueprints/02-at-scale/main.tf
carlosrodlop May 15, 2024
0072ba3
Preparing bundle
carlosrodlop May 15, 2024
44d2178
Removing old secret hardcoded in the file
carlosrodlop May 15, 2024
8da46a7
Replacing osixia-openldap by openldap-stack
carlosrodlop May 15, 2024
4457a03
Merge branch 'ldap' of github.com:cloudbees/terraform-aws-cloudbees-c…
carlosrodlop May 15, 2024
ea28c16
Removing osixia-ldap
carlosrodlop May 19, 2024
2112e4b
Casc. Test ldap password
carlosrodlop May 19, 2024
b3670a0
casc test
carlosrodlop May 19, 2024
2956470
Casc: Adding Ldap configuration for Example Org
carlosrodlop May 20, 2024
26061e0
Casc - refactor names
carlosrodlop May 20, 2024
7f54859
Adding notes on users and groups configuration
carlosrodlop May 20, 2024
929d7c2
Reformat names on secrets
carlosrodlop May 20, 2024
34933e0
Prepare secrets to be templating
carlosrodlop May 20, 2024
4eb885d
Template secrets
carlosrodlop May 20, 2024
59713f4
Casc: enabling Rbac configuraion
carlosrodlop May 20, 2024
ed31b61
Setting ldap branch
carlosrodlop May 20, 2024
5f42e79
Secrets passed as String not as file path
carlosrodlop May 20, 2024
08234dd
Update blueprints/02-at-scale/k8s/openldap-stack-values.yml
carlosrodlop May 20, 2024
fea0242
Update variables.tf
carlosrodlop May 20, 2024
4c563f2
Update blueprints/02-at-scale/k8s/openldap-stack-values.yml
carlosrodlop May 20, 2024
179df16
Replace to ACME Coorporation
carlosrodlop May 21, 2024
f71506a
Merge branch 'ldap' of github.com:cloudbees/terraform-aws-cloudbees-c…
carlosrodlop May 21, 2024
6814aac
Replacing by global password
carlosrodlop May 21, 2024
3397e61
typo and disabling phpldapadmin
carlosrodlop May 21, 2024
fe66954
typo
carlosrodlop May 21, 2024
bc021d3
Moving to local.global_pass_jsonpath
carlosrodlop May 21, 2024
ff8388c
Merge branch 'develop' into ldap
carlosrodlop May 21, 2024
e092815
terraform-docs: automated action
github-actions[bot] May 21, 2024
e9bbc45
terraform-docs: automated action
github-actions[bot] May 21, 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
40 changes: 0 additions & 40 deletions .cloudbees/workflows/ldap-dh.yaml

This file was deleted.

39 changes: 0 additions & 39 deletions .cloudbees/workflows/ldap-gh.yaml

This file was deleted.

90 changes: 0 additions & 90 deletions .docker/ldap/data.ldif

This file was deleted.

10 changes: 0 additions & 10 deletions .docker/ldap/openldap.Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion blueprints/02-at-scale/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ Once you have familiarized yourself with [CloudBees CI blueprint add-on: Get sta
|------|-------------|------|---------|:--------:|
| hosted_zone | Amazon Route 53 hosted zone. CloudBees CI applications are configured to use subdomains in this hosted zone. | `string` | n/a | yes |
| trial_license | CloudBees CI trial license details for evaluation. | `map(string)` | n/a | yes |
| grafana_admin_password | Grafana admin password. | `string` | `"change.me"` | no |
| suffix | Unique suffix to assign to all resources. When adding the suffix, changes are required in CloudBees CI for the validation phase. | `string` | `""` | no |
| tags | Tags to apply to resources. | `map(string)` | `{}` | no |

Expand Down Expand Up @@ -86,6 +85,7 @@ Once you have familiarized yourself with [CloudBees CI blueprint add-on: Get sta
| efs_access_points | Amazon EFS access points. |
| efs_arn | Amazon EFS ARN. |
| eks_cluster_arn | Amazon EKS cluster ARN. |
| global_password | Random string that is used as the global password. |
| grafana_dashboard | Provides access to Grafana dashboards. |
| kubeconfig_add | Add kubeconfig to the local configuration to access the Kubernetes API. |
| kubeconfig_export | Export the KUBECONFIG environment variable to access the Kubernetes API. |
Expand Down
6 changes: 3 additions & 3 deletions blueprints/02-at-scale/casc/oc/variables/variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ variables:
- message: "Welcome to the CloudBees CI blueprint add-on: At scale!"
- scm_casc_mm_store: "https://github.com/cloudbees/terraform-aws-cloudbees-ci-eks-addon.git"
- casc_branch: main
- ldap_ManagerDN: "cn=admin,dc=acme,dc=org"
- ldap_ManagerDN: "cn=admin,dc=example,dc=org"
- ldap_ManagerPasswordSecret: "admin"
- ldap_RootDN: "dc=acme,dc=org"
- ldap_Server: "ldap-service.auth.svc.cluster.local"
- ldap_RootDN: "dc=example,dc=org"
- ldap_Server: "openldap-stack.auth.svc.cluster.local"
- ldap_UserSearch: "cn={0}"
#Issue #70
#- cbci_s3: "cbci-bp02-s3"
117 changes: 117 additions & 0 deletions blueprints/02-at-scale/k8s/openldap-stack-values.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Copyright (c) CloudBees, Inc.

#https://artifacthub.io/packages/helm/helm-openldap/openldap-stack-ha

global:
adminUser: "admin"
adminPassword: ${password}
configUser: "admin"
configPassword: ${password}

customLdifFiles:
00-root.ldif: |-
dn: dc=example,dc=org
o: Example, Inc
objectclass: dcObject
objectclass: organization

01-groups.ldif: |-
dn: ou=Groups,dc=example,dc=org
changetype: add
objectclass: organizationalUnit
ou: Groups

dn: cn=CI_Admins,ou=Groups,dc=example,dc=org
changetype: add
cn: CI_Admins
objectclass: groupOfUniqueNames
uniqueMember: cn=${admin_user_outputs},dc=example,dc=org
uniqueMember: cn=admin_cbci_b,dc=example,dc=org

dn: cn=Dev_Team_X,ou=Groups,dc=example,dc=org
changetype: add
cn: Dev_Team_X
objectclass: groupOfUniqueNames
uniqueMember: cn=developer_1,dc=example,dc=org
uniqueMember: cn=developer_2,dc=example,dc=org

dn: cn=Dev_Team_Y,ou=Groups,dc=example,dc=org
changetype: add
cn: Dev_Team_Y
objectclass: groupOfUniqueNames
uniqueMember: cn=developer_3,dc=example,dc=org
uniqueMember: cn=developer_4,dc=example,dc=org

02-users.ldif: |-
dn: cn=developer_1,dc=example,dc=org
changetype: add
objectclass: inetOrgPerson
cn: developer_1
givenname: developer_1
sn: Developer 1
displayname: Developer User 1
mail: developer.1@gmail.com
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure that these will are real email addresses. I will create an issue to offer a replacement here. Either custom domain, or potentially even a + address solution such as myuser+dev1@acme.org, etc.

userpassword: ${password}

dn: cn=developer_2,dc=example,dc=org
changetype: add
objectclass: inetOrgPerson
cn: developer_2
givenname: developer_2
sn: Developer 2
displayname: Developer User 2
mail: developer.2@gmail.com
userpassword: ${password}

dn: cn=developer_3,dc=example,dc=org
changetype: add
objectclass: inetOrgPerson
cn: developer_3
givenname: developer_3
sn: Developer 3
displayname: Developer User 3
mail: developer.3@gmail.com
userpassword: ${password}

dn: cn=developer_4,dc=example,dc=org
changetype: add
objectclass: inetOrgPerson
cn: developer_4
givenname: developer_4
sn: Developer 4
displayname: Developer User 4
mail: developer.4@gmail.com
userpassword: ${password}

dn: cn=${admin_user_outputs},dc=example,dc=org
changetype: add
objectclass: inetOrgPerson
cn: ${admin_user_outputs}
givenname: a${admin_user_outputs}
sn: AdminCBCIA
displayname: Admin CBCI A
mail: admin_cbci.a@gmail.com
userpassword: ${password}

dn: cn=admin_cbci_b,dc=example,dc=org
changetype: add
objectclass: inetOrgPerson
cn: admin_cbci_b
givenname: admin_cbci_b
sn: AdminCBCIB
displayname: Admin CBCI B
mail: admin_cbci_b@gmail.com
userpassword: ${password}

logLevel: debug

replicaCount: 1

replication:
enabled: false

ltb-passwd:
enabled : false

phpldapadmin:
enabled: true
3 changes: 0 additions & 3 deletions blueprints/02-at-scale/k8s/secrets-values.yml.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Copyright (c) CloudBees, Inc.

# Secret password for admin_cbci_a that belongs to the CI_Admins group (refer to .docker/ldap/data.ldif)
secJenkinsPass: "admin_pass" # Required. Do not update!

secGithubUser: "exampleUser" #Required for OC casc security.yaml
secGithubToken: "ExampleToken" #Required for OC casc security.yaml
# secLicenseCert: |
Expand Down
22 changes: 18 additions & 4 deletions blueprints/02-at-scale/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ locals {

cbci_agent_podtemplname_validation = "maven-and-go-ondemand"

global_password = random_string.global_pass_string.result
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps use a change trigger to allow someone to rotate the password every once in a while?

variable "change_trigger" {
  description = "Change this value to generate a new random string"
  default     = "initial"
}

resource "random_string" "global_pass_string" {
  length  = 16
  special = false
  upper   = true
  lower   = true

  keepers = {
    change_trigger = var.change_trigger
  }
}

Copy link
Collaborator Author

@carlosrodlop carlosrodlop May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sboardwell Thanks for your review! :)

Avoid hardcoding secrets is a must and it needs to be handle since you ran this Quickstart for the very first time (day 0). See as example the first admin secret when you make a fresh installation for Jenkins CI.

Regarding rotating secrets (although is a best practice) I believe it is something you need done once you are ready to extend from this blueprint towards your custom blueprint (day 1). There are many other things to do in that list, for example: Deploying the cluster in your own existing VPC or EKS, updating the Authentication Realm, etc.


}

resource "random_string" "global_pass_string" {
length = 16
special = false
upper = true
lower = true
}

resource "time_static" "epoch" {
Expand Down Expand Up @@ -194,7 +203,7 @@ module "eks_blueprints_addons" {
set_sensitive = [
{
name = "grafana.adminPassword"
value = var.grafana_admin_password
value = local.global_password
}
]
}
Expand Down Expand Up @@ -246,11 +255,16 @@ module "eks_blueprints_addons" {
}
#Additional Helm Releases
helm_releases = {
osixia-openldap = {
name = "osixia-openldap"
openldap-stack = {
chart = "openldap-stack-ha"
chart_version = "4.2.2"
namespace = "auth"
create_namespace = true
chart = "k8s/osixia-openldap"
repository = "https://jp-gouin.github.io/helm-openldap/"
values = [templatefile("k8s/openldap-stack-values.yml", {
password = local.global_password
admin_user_outputs = local.cbci_admin_user
})]
}
aws-node-termination-handler = {
name = "aws-node-termination-handler"
Expand Down
5 changes: 5 additions & 0 deletions blueprints/02-at-scale/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,8 @@ output "grafana_dashboard" {
description = "Provides access to Grafana dashboards."
value = "kubectl port-forward svc/kube-prometheus-stack-grafana 50002:80 -n kube-prometheus-stack"
}

output "global_password" {
description = "Random string that is used as the global password."
value = local.global_password
}
Loading
Loading