Skip to content

Commit a755f07

Browse files
seansundMatthew Perrinscsantanapr
authored
OCP 4.3 support (#34)
* Adds stages-ocp4 directory and updates runTerraform.sh to apply it when cluster_type is ocp4 * Updates ocp3 deploy to use ocp43 modules * Set all modules to ocp43 version * Updates runTerraform.sh to handle vlan that doesn't end in an extra new line * Updates stages for terraform 0.12 * Updates stages to match updates to operator interface * Updates to stages from ocp4.3 testing and iks and ocp3 regression testing * Updates to cos and cloudant stages to match module interface * Applies nooperator changes to ocp4 stages * Update to scripts/destroy-services.sh - Looks up and uses service id for the delete so that the process works even if there are multiple services with the same name * Updates module version numbers to v2.2.0 to get ocp 4.3 support * Updates handling of namespaces * Adds Jenkinsfile to run pipeline and script to create required resources * Updates to create-pipeline-resources.sh - Makes executable - Adds NAMESPACE as the first arg - Sets the script to fail on error - Deletes the kustomization.yaml if everything succeeds * Updates image names in Jenkinsfile and updates create-pipeline-resources.sh script * Adds logic to remove namespace from agent name in Jenkinsfile * Updates Jenkins file to remove /bin/bash references for alpine container * Updates Jenkinsfile and configmap to put two files in one configmap * Updates variable name to release_namespaces * Updates terraform modules to tagged version to prevent in-flight changes * Updates config (temporarily) for ocp 4.3 * Updates for iks and ocp3 - testing * Adds credential*.properties to gitignore. Updates namespace variables * Updates variables for namespace stages * Update README.md Update Wording and replace with Cloud Native Toolkit * Update README.md Update team name from IBM Garage to GSE * Update the diagram for the tools * Update environment.tfvars Reset environments.tfvars file * Updates ref for stage2 modules * Updates stages for CRC * Updates Jenkins module to pass ci namespace. Updates postgres and sonarqube modules for crc * Renames catalystdashboard module to developerdashboard * Updates rbac-roles to include openshift project permissions * Bumps version of cli-tools to 0.1.4 to pick up latest IBM Cloud terraform provider * Updates argocd modules to latest version * Installing postgress in cluster for ocp4 * add postgress to crc * move postgresql into sonarqube * Removes duplicated developerdashboard stage * Updates module name within stage2-dashboard files * Adds Swagger editor stages * use default name for postgress dbname * Changes argocd ref to point to ocp43-lite branch after merging argocd content in * Updates module versions to v2.2.2 * Updates swagger module version to v2.2.3 * Updates version of postgres module to v2.2.4 for IKS and OCP 3 installs * Bumpts tekton module version to v2.2.5 * Bumps pactbroker module version to v2.2.6 * Fixes version reference in postgres module * Bumps Sonarqube module version to v2.2.7 * Bumps the Jenkins module to v2.2.8 * Bumps argocd module to v2.2.9 to fix IKS issue * Bumps Jenkins module to v2.2.10 to fix IKS issue * Bumps Dashboard module version to v2.2.11 so pact broker shows up * Bumps logdna module to v2.2.12 to address issue on IKS * Bumps sonarqube version to 2.2.13 to support inline postgres * Bumps cluster version to v2.2.14 to fix issue cleaning up configmaps * Adds Jenkins stage to ocp4 install * Bumps IBM Cloud cluster module to v2.2.15 to fix timing issue on OCP4 Co-authored-by: Matthew Perrins <[email protected]> Co-authored-by: Carlos Santana <[email protected]>
1 parent 2e87981 commit a755f07

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+889
-342
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.idea/
22
*.iml
3-
credentials.properties
3+
credentials*.properties
44

55
.bash_history
66
.terraform.d/

Jenkinsfile

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
/*
2+
* This is a Jenkins pipeline that relies on the Jenkins kubernetes plugin to dynamically provision agents for
3+
* the build containers.
4+
*
5+
* This pipeline expects three resources to be available in the namespace when it runs. See
6+
* terraform/scripts/create-pipeline-resources.sh for more information
7+
*
8+
* The cloudName variable is set dynamically based on the existance/value of env.CLOUD_NAME which allows this pipeline
9+
* to run in both Kubernetes and OpenShift environments.
10+
*/
11+
12+
def buildAgentName(String jobNameWithNamespace, String buildNumber, String namespace) {
13+
def jobName = removeNamespaceFromJobName(jobNameWithNamespace, namespace);
14+
15+
if (jobName.length() > 55) {
16+
jobName = jobName.substring(0, 55);
17+
}
18+
19+
return "a.${jobName}${buildNumber}".replaceAll('_', '-').replaceAll('/', '-').replaceAll('-.', '.');
20+
}
21+
22+
def removeNamespaceFromJobName(String jobName, String namespace) {
23+
return jobName.replaceAll(namespace + '-', '');
24+
}
25+
26+
def toolsImage="ibmgaragecloud/cli-tools:0.1.1"
27+
28+
def buildLabel = buildAgentName(env.JOB_NAME, env.BUILD_NUMBER, env.NAMESPACE);
29+
def namespace = env.NAMESPACE ?: "dev"
30+
def cloudName = env.CLOUD_NAME == "openshift" ? "openshift" : "kubernetes"
31+
def workingDir = "/home/jenkins/agent"
32+
podTemplate(
33+
label: buildLabel,
34+
cloud: cloudName,
35+
yaml: """
36+
apiVersion: v1
37+
kind: Pod
38+
spec:
39+
serviceAccountName: jenkins
40+
volumes:
41+
- name: terraform-tfvars
42+
configMap:
43+
name: terraform-tfvars
44+
containers:
45+
- name: setup-image
46+
image: alpine:3.9.5
47+
tty: true
48+
command: ["/bin/sh"]
49+
workingDir: ${workingDir}
50+
env:
51+
- name: HOME
52+
value: ${workingDir}
53+
volumeMounts:
54+
- name: terraform-tfvars
55+
mountPath: /etc/settings
56+
- name: tools-image
57+
image: ${toolsImage}
58+
tty: true
59+
command: ["/bin/bash"]
60+
workingDir: ${workingDir}/terraform
61+
env:
62+
- name: HOME
63+
value: ${workingDir}
64+
- name: IBMCLOUD_API_KEY
65+
valueFrom:
66+
secretKeyRef:
67+
name: terraform-credentials
68+
key: "ibmcloud.api.key"
69+
- name: TF_VAR_ibmcloud_api_key
70+
valueFrom:
71+
secretKeyRef:
72+
name: terraform-credentials
73+
key: "ibmcloud.api.key"
74+
- name: IAAS_CLASSIC_USERNAME
75+
valueFrom:
76+
secretKeyRef:
77+
name: terraform-credentials
78+
key: "classic.username"
79+
- name: IAAS_CLASSIC_API_KEY
80+
valueFrom:
81+
secretKeyRef:
82+
name: terraform-credentials
83+
key: "classic.api.key"
84+
"""
85+
) {
86+
node(buildLabel) {
87+
container(name: 'setup-image') {
88+
checkout scm
89+
stage('Copy settings') {
90+
sh '''
91+
set +x
92+
93+
cp -v /etc/settings/* ./terraform/settings
94+
95+
echo "*** Terraform settings copied"
96+
echo ""
97+
echo "-- environment.tfvars --"
98+
cat ./terraform/settings/environment.tfvars
99+
echo ""
100+
echo "-- vlan.tfvars --"
101+
cat ./terraform/settings/vlan.tfvars
102+
'''
103+
}
104+
}
105+
container(name: 'tools-image', shell: '/bin/bash') {
106+
stage('Provision cluster') {
107+
sh '''
108+
set +x
109+
110+
./runTerraform.sh --force
111+
'''
112+
}
113+
stage('Validate cluster') {
114+
sh '''
115+
echo "Nothing to do, yet"
116+
'''
117+
}
118+
stage('Destroy cluster') {
119+
sh '''
120+
echo "Nothing to do, yet"
121+
'''
122+
}
123+
}
124+
}
125+
}
126+

README.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# IBM Garage for Cloud & Solution Engineering
1+
# IBM Garage Solution Engineering
22
## Iteration Zero for IBM Cloud
33

4-
This repository contains infrastructure as code (IasC) scripting to create an IBM Garage for Cloud Developer Tools environment ready for cloud-native application development with IBM Cloud Kubernetes Service or Red Hat OpenShift on IBM Cloud.
4+
This repository contains infrastructure as code (IasC) scripting to create an IBM Garage Clout Native Toolkit development environment ready for cloud-native application development with IBM Cloud Kubernetes Service or Red Hat OpenShift.
55

66
### Overview
77

8-
Iteration Zero creates an IBM Garage for Cloud Developer Tools environment in IBM Cloud, complete with tools and services needed for continuous delivery of typical cloud-native applications to a [IBM Cloud Kubernetes Service](https://cloud.ibm.com/docs/containers) or [Red Hat OpenShift on IBM Cloud](https://cloud.ibm.com/docs/openshift) cluster. Typically a squad lead or lead developer would create this environment after the initial inception workshop has completed and the development team is ready to write code.
8+
Iteration Zero creates an IBM Garage Cloud Native Toolkit environment in IBM Cloud, complete with tools and services needed for continious delivery of typical cloud-native applications to a [IBM Cloud Kubernetes Service](https://cloud.ibm.com/docs/containers) or [Red Hat OpenShift on IBM Cloud](https://cloud.ibm.com/docs/openshift) cluster. Typically a squad lead or lead developer would create this environment after the initial inception workshop has completed and the development team is ready to write code.
99

10-
The objective of this environment is to reduce the amount of time and effort a team needs to spend creating and configuring their Kubernetes or OpenShift development environments. Rather than the lead having to reinvent the wheel deciding how to set up a continious development environment and perform the manual effort to create, install, and configure the cluster, tools, and services, these infrastructure as code (IasC) scripts automate the process to consistently create an environment as needed that embodies these best practices. The scripts are modular so tools can be easily disabled or added. This combindation of tools are proven in the industry to deliver real value for modern cloud-native development.
10+
The objective of this environment is to reduce the amount of time and effort a team needs to spend creating and configuring their Kubernetes or OpenShift development environments. Rather than the team having to reinvent the wheel deciding how to set up a continious development environment and perform the manual effort to create, install, and configure the cluster, tools, and services, these infrastructure as code (IasC) scripts automate the process to consistently create an environment as needed that embodies these best practices. The scripts are modular so tools can be easily disabled or added. This combindation of tools are proven in the industry to deliver real value for modern cloud-native development.
1111

1212
The Red Hat [Open Innovation Labs](https://github.com/rht-labs/labs-ci-cd) has a very similar approach to how they deliver success with OpenShift.
1313

14-
You can jump straight to the [Developers Guide](https://ibm-garage-cloud.github.io/ibm-garage-developer-guide/) if you want more detail on how the Cloud Developer Tools environment fits into the end-to-end development story.
14+
You can jump straight to the [Developers Guide](https://ibm-garage-cloud.github.io/ibm-garage-developer-guide/) if you want more detail on how the Cloud Native Toolkit fits into the end-to-end development story.
1515

1616
This repo contains Terraform resources that will create an environment containing the following development tools:
1717
- IBM Container Service cluster (3 nodes) for Kubernetes or OpenShift
@@ -22,7 +22,8 @@ This repo contains Terraform resources that will create an environment containin
2222
- [Argo CD](https://argoproj.github.io/argo-cd/)
2323
- [SonarQube](https://www.sonarqube.org/)
2424
- [Pact Broker](https://docs.pact.io/)
25-
- [Artefactory](https://jfrog.com/open-source/)
25+
- [Artifactory](https://jfrog.com/open-source/)
26+
- [Swagger Editor](https://editor.swagger.io/)
2627
- [Eclipse Che](https://www.eclipse.org/che/)
2728
- Cloud services for cloud-native applications:
2829
- [AppID Application Authentication](https://cloud.ibm.com/docs/services/appid)
@@ -34,22 +35,22 @@ This repo contains Terraform resources that will create an environment containin
3435

3536
## Developer Tools
3637

37-
This diagram illustrates the components in a Cloud Developer Tools environment:
38+
This diagram illustrates the components in a Cloud Native Toolkit environment:
3839

3940
![Provisioned environment](./docs/images/catalyst-provisioned-environment.png)
4041

4142
## Developer Guide
4243

43-
[Developer Guide](https://ibm-garage-cloud.github.io/ibm-garage-developer-guide/) explains how to use the Cloud Developer Tools environment.
44+
[Developer Guide](https://ibm-garage-cloud.github.io/ibm-garage-developer-guide/) explains how to use the Cloud Native Toolkit environment.
4445
Use it to deep dive into how to use these tools and programming models to make yourself productive with Kubernetes and OpenShift on the IBM Cloud.
4546

46-
### Create the Cloud Developer Tools environment
47+
### Install and Configure
4748

48-
Start with the [installation instructions](https://ibm-garage-cloud.github.io/ibm-garage-developer-guide/getting-started/overview) for creating the Cloud Developer Tools environment. It contains the instructions for how to setup and run the Terraform Infrastructure as Code scripts in this repo.
49+
Start with the [installation instructions](https://ibm-garage-cloud.github.io/ibm-garage-developer-guide/getting-started/overview) for creating the Cloud Native Toolkit environment. It contains the instructions for how to setup and run the Terraform Infrastructure as Code scripts in this repo.
4950

50-
### Cloud Developer Tools Dashboard
51+
### Developer Dashboard
5152

52-
[Cloud Developer Tools Dashboard](https://ibm-garage-cloud.github.io/ibm-garage-developer-guide/getting-started/dashboard/)
53+
[Developer Dashboard](https://ibm-garage-cloud.github.io/ibm-garage-developer-guide/getting-started/dashboard/)
5354
explains how to open the dashbard for using the Cloud Developer Tools environment.
5455

5556
### Destroying
@@ -59,7 +60,7 @@ The scripts that created the Cloud Developer Tools environment can also be used
5960

6061
## Summary
6162

62-
We are working to make Kubernetes and OpenShift development as easy as possible, any feedback on the use of the project will be most welcome.
63+
We are working to make Kubernetes and OpenShift development as easy as possible this toolkit adds what feels like a PaaS layer to a Kubernetes environment, any feedback on the use of the project will be most welcome.
6364

64-
Thanks IBM Garage for Cloud Team
65+
Thanks IBM Garage Solution Engineering
6566

1.89 MB
Loading

launch.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
SCRIPT_DIR="$(cd $(dirname $0); pwd -P)"
66
SRC_DIR="$(cd "${SCRIPT_DIR}/terraform" ; pwd -P)"
77

8-
DOCKER_IMAGE="garagecatalyst/ibm-garage-cli-tools:0.0.24"
8+
DOCKER_IMAGE="ibmgaragecloud/cli-tools:0.1.4"
99

1010
helpFunction()
1111
{
@@ -40,7 +40,7 @@ helpFunction()
4040
ENV="credentials"
4141

4242
function prop {
43-
grep "${1}" ${ENV}.properties|cut -d'=' -f2
43+
grep "${1}" ${ENV}.properties | cut -d'=' -f2
4444
}
4545

4646
if [[ -f "${ENV}.properties" ]]; then
@@ -62,16 +62,18 @@ SUFFIX=$(echo $(basename ${SCRIPT_DIR}) | base64 | sed -E "s/[^a-zA-Z0-9_.-]//g"
6262
CONTAINER_NAME="ibm-garage-cli-tools-${SUFFIX}"
6363

6464
echo "Cleaning up old container: ${CONTAINER_NAME}"
65-
docker kill ${CONTAINER_NAME} 1> /dev/null 2> /dev/null
66-
docker rm ${CONTAINER_NAME} 1> /dev/null 2> /dev/null
65+
66+
DOCKER_CMD="docker"
67+
${DOCKER_CMD} kill ${CONTAINER_NAME} 1> /dev/null 2> /dev/null
68+
${DOCKER_CMD} rm ${CONTAINER_NAME} 1> /dev/null 2> /dev/null
6769

6870
if [[ -n "$1" ]]; then
69-
echo "Pulling docker image: ${DOCKER_IMAGE}"
70-
docker pull "${DOCKER_IMAGE}"
71+
echo "Pulling container image: ${DOCKER_IMAGE}"
72+
${DOCKER_CMD} pull "${DOCKER_IMAGE}"
7173
fi
7274

7375
echo "Initializing container ${CONTAINER_NAME} from ${DOCKER_IMAGE}"
74-
docker run -itd --name ${CONTAINER_NAME} \
76+
${DOCKER_CMD} run -itd --name ${CONTAINER_NAME} \
7577
-v ${SRC_DIR}:/home/devops/src \
7678
-e TF_VAR_ibmcloud_api_key="${IBMCLOUD_API_KEY}" \
7779
-e IBMCLOUD_API_KEY="${IBMCLOUD_API_KEY}" \
@@ -81,4 +83,4 @@ docker run -itd --name ${CONTAINER_NAME} \
8183
${DOCKER_IMAGE}
8284

8385
echo "Attaching to running container..."
84-
docker attach ${CONTAINER_NAME}
86+
${DOCKER_CMD} attach ${CONTAINER_NAME}

0 commit comments

Comments
 (0)