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

Build a custom csb image with a (near) empty brokerpak #1

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
zscaler.crt
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use our hardened cloud-service-broker base image.
ARG base_image

# Builder: Build brokerpaks for use with cloud service broker.
FROM ${base_image} AS build
WORKDIR /app
ADD ./brokerpaks ./brokerpaks

ENV BUILD_ENV=development

# For local builds only, add the ZScaler CA certificate to the trust store so Docker
# can make HTTPS connections. `csb pak build` needs to do this to download binaries.
# Find your ZScaler cert with $(brew --prefix)/etc/ca-certificates/cert.pem.
# From https://help.zscaler.com/zia/adding-custom-certificate-application-specific-trust-store
ADD zscaler.crt /tmp/zscaler.crt
# Only copy Use BUILD_ENV variable within the container to copy the CA certificate into the certificate directory and update
RUN if [ "$BUILD_ENV" = "production" ] ; then echo "production env"; else echo \
"non-production env: $BUILD_ENV"; CERT_DIR=$(openssl version -d | cut -f2 -d \")/certs ; \
cp /tmp/zscaler.crt $CERT_DIR ; update-ca-certificates ; \
fi

RUN /app/csb pak build brokerpaks/empty

FROM ${base_image}

# Copy brokerpaks to final image
COPY --from=build /app/empty-1.0.0.brokerpak /app/
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Github templates
# Cloud Service Broker

This repo contains Github templates (pull request, issue, etc) for the cloud-gov organization.
This repo contains configuration, including brokerpaks, for the cloud.gov deployment of the [Cloud Service Broker](https://github.com/cloudfoundry/cloud-service-broker).

## Related projects

- https://github.com/GSA-TTS/datagov-brokerpak-smtp
- https://github.com/GSA/ttsnotify-brokerpak-sms
101 changes: 101 additions & 0 deletions brokerpaks/empty/empty.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
version: 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we going to permanently leave this brokerpak in here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, this is a test one to try to get the broker deploying. Real paks soon to come!

name: example-service
id: ca14ec08-04db-47d5-bc87-1d1d3f688037
description: a longer service description
display_name: Example Service
image_url: https://example.com/icon.jpg
documentation_url: https://example.com
provider_display_name: ""
support_url: https://example.com/support.html
tags: [gcp, example, service]
plans:
- name: example-email-plan
id: 392417e9-8e96-4073-b238-a1b711db40f5
description: Builds emails for example.com.
display_name: example.com email builder
bullets:
- information point 1
- information point 2
- some caveat here
properties:
domain: example.com
password_special_chars: '@/ \"?'
provision:
plan_inputs:
- required: true
field_name: domain
type: string
details: The domain name
user_inputs:
- required: true
field_name: username
type: string
details: The username to create
computed_inputs: []
template: |4-
variable domain {type = string}
variable username {type = string}
output email {value = "${var.username}@${var.domain}"}

template_ref: ""
outputs:
- required: true
field_name: email
type: string
details: The combined email address
templates: {}
template_refs: {}
import_inputs: []
import_parameter_mappings: []
import_parameters_to_delete: []
import_parameters_to_add: []
bind:
plan_inputs:
- required: true
field_name: password_special_chars
type: string
details: Supply your own list of special characters to use for string generation.
user_inputs: []
computed_inputs:
- name: domain
default: ${request.plan_properties["domain"]}
overwrite: true
type: ""
- name: address
default: ${instance.details["email"]}
overwrite: true
type: ""
template: |4-
variable domain {type = string}
variable address {type = string}
variable password_special_chars {type = string}

resource "random_string" "password" {
length = 16
special = true
override_special = var.password_special_chars
}

output uri {value = "smtp://${var.address}:${random_string.password.result}@smtp.${var.domain}"}

template_ref: ""
outputs:
- required: true
field_name: uri
type: string
details: The uri to use to connect to this service
templates: {}
template_refs: {}
import_inputs: []
import_parameter_mappings: []
import_parameters_to_delete: []
import_parameters_to_add: []
examples:
- name: Example
description: Examples are used for documenting your service AND as integration tests.
plan_id: 392417e9-8e96-4073-b238-a1b711db40f5
provision_params:
username: my-account
bind_params: {}
plan_updateable: false
requiredenvvars: []
15 changes: 15 additions & 0 deletions brokerpaks/empty/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
packversion: 1
name: empty
version: "0.0.1"
metadata:
author: James Hochadel
platforms:
- os: linux
arch: amd64
terraform_binaries:
- name: terraform
version: 1.7.5
source: https://github.com/hashicorp/terraform/archive/v1.7.5.zip
service_definitions:
- empty.yml
parameters: []
Loading