Skip to content

Commit 814507b

Browse files
v1.0.0 (#55)
1 parent f3ef750 commit 814507b

File tree

101 files changed

+7315
-1223
lines changed

Some content is hidden

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

101 files changed

+7315
-1223
lines changed

.github/pull_request_template.md

+22-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
1-
### Description
2-
< Insert text describing your change >
1+
## What type of PR is this? (check all applicable)
32

4-
### Motivation
5-
< Why is this change necessary? Is it a bug fix or new feature? >
3+
- [ ] Refactor
4+
- [ ] Feature
5+
- [ ] Bug Fix
6+
- [ ] Optimization
7+
- [ ] Documentation Update
68

7-
< Please link any relevant issues or PRs >
9+
## Summary
810

9-
### Testing
10-
< If you haven't already, [install](https://pre-commit.com/#install) and [use](https://pre-commit.com/#usage) `pre-commit` >
11+
## Description of Changes
1112

12-
< Provide proof of testing the changes (screenshots, output, etc) >
13+
## Related Tickets & Documents
14+
- Related Issue #
15+
- Closes #
16+
17+
## Testing
18+
_Describe how the feature has been tested, including both automated and manual testing strategies. Include screenshots or example output if applicable_
19+
20+
## Checklist
21+
22+
- [ ] Ran `make` (with [pre-commit](https://pre-commit.com/#usage) installed)
23+
- [ ] Tested and added to automated tests (if applicable)
24+
- [ ] Documentation updated (READMEs, public, internal)
25+
26+
## Notes & Other Considerations

.github/workflows/change-test.yml

+8-13
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
branches:
55
- 'main'
66
paths:
7-
- "infrastructure.tf"
87
- 'infrastructure/**'
98
jobs:
109
change-test:
@@ -20,29 +19,25 @@ jobs:
2019
COMPARTMENT_OCID: ${{ secrets.COMPARTMENT_OCID }}
2120
ZONE_DNS_SUFFIX: ${{ secrets.ZONE_DNS_SUFFIX }}
2221
CLUSTER_NAME: change-test
22+
USE_EXISTING_TAGS: true
23+
TAG_NAMESPACE: openshift-cicd
2324
steps:
2425
- name: Checkout
2526
uses: actions/checkout@v4
2627

27-
- name: Set NOW env variable
28-
run: echo "NOW=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
28+
- name: Set env variables
29+
run: |
30+
echo "NOW=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
31+
echo "PKG_VERSION=$(make version)" >> $GITHUB_ENV
2932
3033
- name: Create Terraform ZIP
31-
run: |
32-
if [ -f infrastructure.tf ]; then
33-
zip infrastructure.zip infrastructure.tf
34-
elif [ -d infrastructure ]; then
35-
zip -j infrastructure.zip infrastructure/data.tf infrastructure/locals.tf infrastructure/main.tf infrastructure/output.tf infrastructure/schema.yaml infrastructure/variables.tf
36-
else
37-
echo "Could not find infrastructure.tf or infrastructure directory"
38-
exit 1
39-
fi
34+
run: make zip
4035

4136
- name: Create RMS Stack
4237
uses: oracle-actions/run-oci-cli-command@v1.3.2
4338
id: create-stack
4439
with:
45-
command: 'resource-manager stack create --compartment-id ${{ env.COMPARTMENT_OCID }} --display-name ${{ github.job }}-${{ env.NOW }} --config-source infrastructure.zip --variables "{\"compartment_ocid\": \"${{ env.COMPARTMENT_OCID }}\", \"cluster_name\": \"${{ env.CLUSTER_NAME }}-${{ env.NOW }}\", \"openshift_image_source_uri\": \"${{ env.OPENSHIFT_IMAGE_SOURCE_URI }}\", \"region\": \"${{ env.OCI_CLI_REGION }}\", \"tenancy_ocid\": \"${{ env.OCI_CLI_TENANCY }}\", \"zone_dns\": \"${{ env.CLUSTER_NAME }}--${{ env.NOW }}${{ env.ZONE_DNS_SUFFIX }}\"}"'
40+
command: 'resource-manager stack create --compartment-id ${{ env.COMPARTMENT_OCID }} --display-name ${{ github.job }}-${{ env.NOW }} --config-source dist/create-cluster-${{ env.PKG_VERSION }}.zip --variables "{\"use_existing_tags\": \"${{ env.USE_EXISTING_TAGS }}\", \"tag_namespace_name\": \"${{ env.TAG_NAMESPACE }}\", \"compartment_ocid\": \"${{ env.COMPARTMENT_OCID }}\", \"cluster_name\": \"${{ env.CLUSTER_NAME }}-${{ env.NOW }}\", \"openshift_image_source_uri\": \"${{ env.OPENSHIFT_IMAGE_SOURCE_URI }}\", \"region\": \"${{ env.OCI_CLI_REGION }}\", \"tenancy_ocid\": \"${{ env.OCI_CLI_TENANCY }}\", \"zone_dns\": \"${{ env.CLUSTER_NAME }}--${{ env.NOW }}${{ env.ZONE_DNS_SUFFIX }}\"}"'
4641
query: 'data.id'
4742

4843
- name: RMS Stack Plan Job

.github/workflows/smoke-test.yml

+19-28
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,25 @@ jobs:
1616
COMPARTMENT_OCID: ${{ secrets.COMPARTMENT_OCID }}
1717
ZONE_DNS_SUFFIX: ${{ secrets.ZONE_DNS_SUFFIX }}
1818
CLUSTER_NAME: smoke-test-bm
19+
USE_EXISTING_TAGS: true
20+
TAG_NAMESPACE: openshift-cicd
1921
steps:
2022
- name: Checkout
2123
uses: actions/checkout@v4
2224

23-
- name: Set NOW env variable
24-
run: echo "NOW=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
25+
- name: Set env variables
26+
run: |
27+
echo "NOW=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
28+
echo "PKG_VERSION=$(make version)" >> $GITHUB_ENV
2529
2630
- name: Create Terraform ZIP
27-
run: |
28-
if [ -f infrastructure.tf ]; then
29-
zip infrastructure.zip infrastructure.tf
30-
elif [ -d infrastructure ]; then
31-
zip -j infrastructure.zip infrastructure/data.tf infrastructure/locals.tf infrastructure/main.tf infrastructure/output.tf infrastructure/schema.yaml infrastructure/variables.tf
32-
else
33-
echo "Could not find infrastructure.tf or infrastructure directory"
34-
exit 1
35-
fi
31+
run: make zip
3632

3733
- name: Create RMS Stack
3834
uses: oracle-actions/run-oci-cli-command@v1.3.2
3935
id: create-stack
4036
with:
41-
command: 'resource-manager stack create --compartment-id ${{ env.COMPARTMENT_OCID }} --display-name ${{ github.job }}-${{ env.NOW }} --config-source infrastructure.zip --variables "{\"compartment_ocid\": \"${{ env.COMPARTMENT_OCID }}\", \"cluster_name\": \"${{ env.CLUSTER_NAME }}-${{ env.NOW }}\", \"control_plane_shape\": \"BM.Standard3.64\", \"control_plane_ocpu\": \"64\", \"control_plane_memory\": \"1024\", \"compute_shape\": \"BM.Standard3.64\", \"compute_ocpu\": \"64\", \"compute_memory\": \"1024\", \"openshift_image_source_uri\": \"${{ env.OPENSHIFT_IMAGE_SOURCE_URI }}\", \"region\": \"${{ env.OCI_CLI_REGION }}\", \"tenancy_ocid\": \"${{ env.OCI_CLI_TENANCY }}\", \"zone_dns\": \"${{ env.CLUSTER_NAME }}-${{ env.NOW }}${{ env.ZONE_DNS_SUFFIX }}\"}"'
37+
command: 'resource-manager stack create --compartment-id ${{ env.COMPARTMENT_OCID }} --display-name ${{ github.job }}-${{ env.NOW }} --config-source dist/create-cluster-${{ env.PKG_VERSION }}.zip --variables "{\"use_existing_tags\": \"${{ env.USE_EXISTING_TAGS }}\", \"tag_namespace_name\": \"${{ env.TAG_NAMESPACE }}\", \"compartment_ocid\": \"${{ env.COMPARTMENT_OCID }}\", \"cluster_name\": \"${{ env.CLUSTER_NAME }}-${{ env.NOW }}\", \"control_plane_shape\": \"BM.Standard3.64\", \"control_plane_ocpu\": \"64\", \"control_plane_memory\": \"1024\", \"compute_shape\": \"BM.Standard3.64\", \"compute_ocpu\": \"64\", \"compute_memory\": \"1024\", \"openshift_image_source_uri\": \"${{ env.OPENSHIFT_IMAGE_SOURCE_URI }}\", \"region\": \"${{ env.OCI_CLI_REGION }}\", \"tenancy_ocid\": \"${{ env.OCI_CLI_TENANCY }}\", \"zone_dns\": \"${{ env.CLUSTER_NAME }}-${{ env.NOW }}${{ env.ZONE_DNS_SUFFIX }}\"}"'
4238
query: 'data.id'
4339

4440
- name: RMS Stack Plan Job
@@ -52,7 +48,7 @@ jobs:
5248
id: stack-apply-job
5349
with:
5450
command: 'resource-manager job create-apply-job --wait-for-state SUCCEEDED --max-wait-seconds 2400 --execution-plan-strategy AUTO_APPROVED --stack-id ${{ steps.create-stack.outputs.raw_output }}'
55-
51+
5652
- name: Teardown BM Infrastructure
5753
uses: oracle-actions/run-oci-cli-command@v1.3.2
5854
id: teardown-bm-infra
@@ -64,10 +60,9 @@ jobs:
6460
id: destroy-stack
6561
with:
6662
command: 'resource-manager stack delete --force --stack-id ${{ steps.create-stack.outputs.raw_output }}'
67-
63+
6864

6965
smoke-test-vm-multi-ad:
70-
needs: [smoke-test-bm-single-ad]
7166
runs-on: ubuntu-latest
7267
name: Create VM cluster infrastructure in multi-ad region
7368
env:
@@ -81,29 +76,25 @@ jobs:
8176
ZONE_DNS_SUFFIX: ${{ secrets.ZONE_DNS_SUFFIX }}
8277
CLUSTER_NAME: smoke-test-vm-multi-ad
8378
MUTLI_AD_REGION: eu-frankfurt-1
79+
USE_EXISTING_TAGS: true
80+
TAG_NAMESPACE: openshift-cicd
8481
steps:
8582
- name: Checkout
8683
uses: actions/checkout@v4
8784

88-
- name: Set NOW env variable
89-
run: echo "NOW=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
85+
- name: Set env variables
86+
run: |
87+
echo "NOW=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
88+
echo "PKG_VERSION=$(make version)" >> $GITHUB_ENV
9089
9190
- name: Create Terraform ZIP
92-
run: |
93-
if [ -f infrastructure.tf ]; then
94-
zip infrastructure.zip infrastructure.tf
95-
elif [ -d infrastructure ]; then
96-
zip -j infrastructure.zip infrastructure/data.tf infrastructure/locals.tf infrastructure/main.tf infrastructure/output.tf infrastructure/schema.yaml infrastructure/variables.tf
97-
else
98-
echo "Could not find infrastructure.tf or infrastructure directory"
99-
exit 1
100-
fi
91+
run: make zip
10192

10293
- name: Create RMS Stack
10394
uses: oracle-actions/run-oci-cli-command@v1.3.2
10495
id: create-stack
10596
with:
106-
command: 'resource-manager stack create --compartment-id ${{ env.COMPARTMENT_OCID }} --display-name ${{ github.job }}-${{ env.NOW }} --config-source infrastructure.zip --variables "{\"compartment_ocid\": \"${{ env.COMPARTMENT_OCID }}\", \"cluster_name\": \"${{ env.CLUSTER_NAME }}-${{ env.NOW }}\", \"openshift_image_source_uri\": \"${{ env.OPENSHIFT_IMAGE_SOURCE_URI }}\", \"region\": \"${{ env.MUTLI_AD_REGION }}\", \"tenancy_ocid\": \"${{ env.OCI_CLI_TENANCY }}\", \"zone_dns\": \"${{ env.CLUSTER_NAME }}-${{ env.NOW }}${{ env.ZONE_DNS_SUFFIX }}\"}"'
97+
command: 'resource-manager stack create --compartment-id ${{ env.COMPARTMENT_OCID }} --display-name ${{ github.job }}-${{ env.NOW }} --config-source dist/create-cluster-${{ env.PKG_VERSION }}.zip --variables "{\"use_existing_tags\": \"${{ env.USE_EXISTING_TAGS }}\", \"tag_namespace_name\": \"${{ env.TAG_NAMESPACE }}\", \"compartment_ocid\": \"${{ env.COMPARTMENT_OCID }}\", \"cluster_name\": \"${{ env.CLUSTER_NAME }}-${{ env.NOW }}\", \"openshift_image_source_uri\": \"${{ env.OPENSHIFT_IMAGE_SOURCE_URI }}\", \"region\": \"${{ env.MUTLI_AD_REGION }}\", \"tenancy_ocid\": \"${{ env.OCI_CLI_TENANCY }}\", \"zone_dns\": \"${{ env.CLUSTER_NAME }}-${{ env.NOW }}${{ env.ZONE_DNS_SUFFIX }}\"}"'
10798
query: 'data.id'
10899

109100
- name: RMS Stack Plan Job
@@ -128,4 +119,4 @@ jobs:
128119
uses: oracle-actions/run-oci-cli-command@v1.3.2
129120
id: destroy-stack
130121
with:
131-
command: 'resource-manager stack delete --force --stack-id ${{ steps.create-stack.outputs.raw_output }}'
122+
command: 'resource-manager stack delete --force --stack-id ${{ steps.create-stack.outputs.raw_output }}'

.gitignore

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1+
.target
2+
.vscode/
3+
.DS_Store
4+
.classpath
15
.idea/
6+
.project
7+
.settings/
8+
target/
29
.DS_Store
3-
.dev
410
.secrets
11+
.dev
12+
**/*.zip
13+
dist/
514

615
### Terraform ###
716
# Local .terraform directories
817
**/.terraform/*
918
**/.terrafor*
10-
!.terraform.lock.hcl
19+
.terraform.lock.hcl

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v4.6.0
7+
rev: v5.0.0
88
hooks:
99
- id: check-yaml
1010
args: [--allow-multiple-documents]
@@ -14,7 +14,7 @@ repos:
1414
- id: check-merge-conflict
1515
- id: check-symlinks
1616
- repo: https://github.com/antonbabenko/pre-commit-terraform
17-
rev: v1.89.0
17+
rev: v1.96.1
1818
hooks:
1919
- id: terraform_tflint
2020
- id: terraform_fmt

.terraform.lock.hcl

-47
This file was deleted.

Makefile

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
SHELL = bash
2+
3+
PKG_VERSION ?= v1.0.0
4+
OCI_DRIVER_VERSION ?= v1.30.0
5+
6+
PRE_COMMIT := $(shell command -v pre-commit 2> /dev/null)
7+
PODMAN := $(shell command -v podman 2> /dev/null)
8+
OC := $(shell command -v oc 2> /dev/null)
9+
10+
.PHONY: all
11+
all: pre-commit machineconfigs manifests zip
12+
13+
.PHONY: pre-commit
14+
pre-commit:
15+
ifdef PRE_COMMIT
16+
$(info "Running pre-commit...")
17+
pre-commit run --all-files
18+
else
19+
$(warning "pre-commit not installed. Skipping...")
20+
endif
21+
22+
.PHONY: zip
23+
zip: version checksums
24+
@echo "Packaging stacks with version ${PKG_VERSION}..."
25+
26+
@if [ ! -d dist ]; then \
27+
mkdir dist ; \
28+
fi
29+
30+
@cd terraform-stacks ; \
31+
for stack in * ; do \
32+
if [ -d $$stack ] && [ "$$stack" != "shared_modules" ]; then \
33+
cd $$stack ; \
34+
echo "Building $$stack-${PKG_VERSION}.zip" ; \
35+
zip -FS -r -q ../../dist/$$stack-${PKG_VERSION}.zip * -x **/.terraform/\* -x \.* ; \
36+
cd .. ; \
37+
fi ; \
38+
done
39+
40+
.PHONY: manifests
41+
manifests:
42+
@echo "Creating condensed-manifest.yml..."
43+
@cat ./custom_manifests/manifests/* > custom_manifests/condensed-manifest.yml ; \
44+
45+
.PHONY: machineconfigs
46+
machineconfigs:
47+
ifdef PODMAN
48+
$(info Generating MachineConfigs from Butane...)
49+
50+
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/oci-kubelet-providerid-master.bu > custom_manifests/manifests/02-machineconfig-ccm.yml
51+
@echo '---' >> custom_manifests/manifests/02-machineconfig-ccm.yml
52+
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/oci-kubelet-providerid-worker.bu >> custom_manifests/manifests/02-machineconfig-ccm.yml
53+
@echo '---' >> custom_manifests/manifests/02-machineconfig-ccm.yml
54+
55+
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/iscsid-master.bu > custom_manifests/manifests/02-machineconfig-csi.yml
56+
@echo '---' >> custom_manifests/manifests/02-machineconfig-csi.yml
57+
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/iscsid-worker.bu >> custom_manifests/manifests/02-machineconfig-csi.yml
58+
@echo '---' >> custom_manifests/manifests/02-machineconfig-csi.yml
59+
60+
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/oci-add-consistent-device-path-master.bu > custom_manifests/manifests/03-machineconfig-consistent-device-path.yml
61+
@echo '---' >> custom_manifests/manifests/03-machineconfig-consistent-device-path.yml
62+
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/oci-add-consistent-device-path-worker.bu >> custom_manifests/manifests/03-machineconfig-consistent-device-path.yml
63+
@echo '---' >> custom_manifests/manifests/03-machineconfig-consistent-device-path.yml
64+
65+
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/oci-eval-user-data-master.bu > custom_manifests/manifests/05-oci-eval-user-data.yml
66+
@echo '---' >> custom_manifests/manifests/05-oci-eval-user-data.yml
67+
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/oci-eval-user-data-worker.bu >> custom_manifests/manifests/05-oci-eval-user-data.yml
68+
@echo '---' >> custom_manifests/manifests/05-oci-eval-user-data.yml
69+
else
70+
$(warning podman not installed. Skipping...)
71+
endif
72+
73+
.PHONY: checksums
74+
checksums:
75+
@echo "Writing checksums..."
76+
77+
@cd terraform-stacks ; \
78+
for stack in * ; do \
79+
if [ -d $$stack ] && [ "$$stack" != "shared_modules" ]; then \
80+
cd $$stack ; \
81+
shasum -a 256 *.tf > checksums ; \
82+
if [ -d manifests ]; then \
83+
shasum -a 256 manifests/* >> checksums ; \
84+
fi ; \
85+
cd .. ; \
86+
fi ; \
87+
done
88+
89+
.PHONY: version
90+
version:
91+
@echo ${PKG_VERSION}
92+
93+
@cd terraform-stacks ; \
94+
for stack in * ; do \
95+
if [ -d $$stack ] && [ "$$stack" != "shared_modules" ]; then \
96+
cd $$stack ; \
97+
printf "locals {\n stack_version = \"${PKG_VERSION}\"\n}\n" > version.tf ; \
98+
cd .. ; \
99+
fi ; \
100+
done
101+
102+
.PHONY: clean
103+
clean:
104+
@echo "Cleaning up..."
105+
106+
rm -rvf dist
107+
108+
# make update-drivers OCI_DRIVER_VERSION=v1.30.0
109+
# Please be sure your KUBECONFIG is set to the cluster you want to modify
110+
.PHONY: update-drivers
111+
update-drivers:
112+
ifdef OC
113+
$(info "Updating OCI CCM and CSI drivers to ${OCI_DRIVER_VERSION}")
114+
oc apply -f custom_manifests/oci-ccm-csi-drivers/${OCI_DRIVER_VERSION}/01-oci-ccm.yml
115+
oc apply -f custom_manifests/oci-ccm-csi-drivers/${OCI_DRIVER_VERSION}/01-oci-csi.yml
116+
else
117+
$(warning "'oc' not installed. Cancelling driver update...")
118+
endif

0 commit comments

Comments
 (0)