-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f3ef750
commit 814507b
Showing
101 changed files
with
7,315 additions
and
1,223 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,12 +1,26 @@ | ||
### Description | ||
< Insert text describing your change > | ||
## What type of PR is this? (check all applicable) | ||
|
||
### Motivation | ||
< Why is this change necessary? Is it a bug fix or new feature? > | ||
- [ ] Refactor | ||
- [ ] Feature | ||
- [ ] Bug Fix | ||
- [ ] Optimization | ||
- [ ] Documentation Update | ||
|
||
< Please link any relevant issues or PRs > | ||
## Summary | ||
|
||
### Testing | ||
< If you haven't already, [install](https://pre-commit.com/#install) and [use](https://pre-commit.com/#usage) `pre-commit` > | ||
## Description of Changes | ||
|
||
< Provide proof of testing the changes (screenshots, output, etc) > | ||
## Related Tickets & Documents | ||
- Related Issue # | ||
- Closes # | ||
|
||
## Testing | ||
_Describe how the feature has been tested, including both automated and manual testing strategies. Include screenshots or example output if applicable_ | ||
|
||
## Checklist | ||
|
||
- [ ] Ran `make` (with [pre-commit](https://pre-commit.com/#usage) installed) | ||
- [ ] Tested and added to automated tests (if applicable) | ||
- [ ] Documentation updated (READMEs, public, internal) | ||
|
||
## Notes & Other Considerations |
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 |
---|---|---|
|
@@ -4,7 +4,6 @@ on: | |
branches: | ||
- 'main' | ||
paths: | ||
- "infrastructure.tf" | ||
- 'infrastructure/**' | ||
jobs: | ||
change-test: | ||
|
@@ -20,29 +19,25 @@ jobs: | |
COMPARTMENT_OCID: ${{ secrets.COMPARTMENT_OCID }} | ||
ZONE_DNS_SUFFIX: ${{ secrets.ZONE_DNS_SUFFIX }} | ||
CLUSTER_NAME: change-test | ||
USE_EXISTING_TAGS: true | ||
TAG_NAMESPACE: openshift-cicd | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set NOW env variable | ||
run: echo "NOW=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV | ||
- name: Set env variables | ||
run: | | ||
echo "NOW=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV | ||
echo "PKG_VERSION=$(make version)" >> $GITHUB_ENV | ||
- name: Create Terraform ZIP | ||
run: | | ||
if [ -f infrastructure.tf ]; then | ||
zip infrastructure.zip infrastructure.tf | ||
elif [ -d infrastructure ]; then | ||
zip -j infrastructure.zip infrastructure/data.tf infrastructure/locals.tf infrastructure/main.tf infrastructure/output.tf infrastructure/schema.yaml infrastructure/variables.tf | ||
else | ||
echo "Could not find infrastructure.tf or infrastructure directory" | ||
exit 1 | ||
fi | ||
run: make zip | ||
|
||
- name: Create RMS Stack | ||
uses: oracle-actions/[email protected] | ||
id: create-stack | ||
with: | ||
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 }}\"}"' | ||
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 }}\"}"' | ||
query: 'data.id' | ||
|
||
- name: RMS Stack Plan Job | ||
|
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 |
---|---|---|
|
@@ -16,29 +16,25 @@ jobs: | |
COMPARTMENT_OCID: ${{ secrets.COMPARTMENT_OCID }} | ||
ZONE_DNS_SUFFIX: ${{ secrets.ZONE_DNS_SUFFIX }} | ||
CLUSTER_NAME: smoke-test-bm | ||
USE_EXISTING_TAGS: true | ||
TAG_NAMESPACE: openshift-cicd | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set NOW env variable | ||
run: echo "NOW=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV | ||
- name: Set env variables | ||
run: | | ||
echo "NOW=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV | ||
echo "PKG_VERSION=$(make version)" >> $GITHUB_ENV | ||
- name: Create Terraform ZIP | ||
run: | | ||
if [ -f infrastructure.tf ]; then | ||
zip infrastructure.zip infrastructure.tf | ||
elif [ -d infrastructure ]; then | ||
zip -j infrastructure.zip infrastructure/data.tf infrastructure/locals.tf infrastructure/main.tf infrastructure/output.tf infrastructure/schema.yaml infrastructure/variables.tf | ||
else | ||
echo "Could not find infrastructure.tf or infrastructure directory" | ||
exit 1 | ||
fi | ||
run: make zip | ||
|
||
- name: Create RMS Stack | ||
uses: oracle-actions/[email protected] | ||
id: create-stack | ||
with: | ||
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 }}\"}"' | ||
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 }}\"}"' | ||
query: 'data.id' | ||
|
||
- name: RMS Stack Plan Job | ||
|
@@ -52,7 +48,7 @@ jobs: | |
id: stack-apply-job | ||
with: | ||
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 }}' | ||
|
||
- name: Teardown BM Infrastructure | ||
uses: oracle-actions/[email protected] | ||
id: teardown-bm-infra | ||
|
@@ -64,10 +60,9 @@ jobs: | |
id: destroy-stack | ||
with: | ||
command: 'resource-manager stack delete --force --stack-id ${{ steps.create-stack.outputs.raw_output }}' | ||
|
||
|
||
smoke-test-vm-multi-ad: | ||
needs: [smoke-test-bm-single-ad] | ||
runs-on: ubuntu-latest | ||
name: Create VM cluster infrastructure in multi-ad region | ||
env: | ||
|
@@ -81,29 +76,25 @@ jobs: | |
ZONE_DNS_SUFFIX: ${{ secrets.ZONE_DNS_SUFFIX }} | ||
CLUSTER_NAME: smoke-test-vm-multi-ad | ||
MUTLI_AD_REGION: eu-frankfurt-1 | ||
USE_EXISTING_TAGS: true | ||
TAG_NAMESPACE: openshift-cicd | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set NOW env variable | ||
run: echo "NOW=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV | ||
- name: Set env variables | ||
run: | | ||
echo "NOW=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV | ||
echo "PKG_VERSION=$(make version)" >> $GITHUB_ENV | ||
- name: Create Terraform ZIP | ||
run: | | ||
if [ -f infrastructure.tf ]; then | ||
zip infrastructure.zip infrastructure.tf | ||
elif [ -d infrastructure ]; then | ||
zip -j infrastructure.zip infrastructure/data.tf infrastructure/locals.tf infrastructure/main.tf infrastructure/output.tf infrastructure/schema.yaml infrastructure/variables.tf | ||
else | ||
echo "Could not find infrastructure.tf or infrastructure directory" | ||
exit 1 | ||
fi | ||
run: make zip | ||
|
||
- name: Create RMS Stack | ||
uses: oracle-actions/[email protected] | ||
id: create-stack | ||
with: | ||
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 }}\"}"' | ||
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 }}\"}"' | ||
query: 'data.id' | ||
|
||
- name: RMS Stack Plan Job | ||
|
@@ -128,4 +119,4 @@ jobs: | |
uses: oracle-actions/[email protected] | ||
id: destroy-stack | ||
with: | ||
command: 'resource-manager stack delete --force --stack-id ${{ steps.create-stack.outputs.raw_output }}' | ||
command: 'resource-manager stack delete --force --stack-id ${{ steps.create-stack.outputs.raw_output }}' |
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 |
---|---|---|
@@ -1,10 +1,19 @@ | ||
.target | ||
.vscode/ | ||
.DS_Store | ||
.classpath | ||
.idea/ | ||
.project | ||
.settings/ | ||
target/ | ||
.DS_Store | ||
.dev | ||
.secrets | ||
.dev | ||
**/*.zip | ||
dist/ | ||
|
||
### Terraform ### | ||
# Local .terraform directories | ||
**/.terraform/* | ||
**/.terrafor* | ||
!.terraform.lock.hcl | ||
.terraform.lock.hcl |
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
This file was deleted.
Oops, something went wrong.
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,118 @@ | ||
SHELL = bash | ||
|
||
PKG_VERSION ?= v1.0.0 | ||
OCI_DRIVER_VERSION ?= v1.30.0 | ||
|
||
PRE_COMMIT := $(shell command -v pre-commit 2> /dev/null) | ||
PODMAN := $(shell command -v podman 2> /dev/null) | ||
OC := $(shell command -v oc 2> /dev/null) | ||
|
||
.PHONY: all | ||
all: pre-commit machineconfigs manifests zip | ||
|
||
.PHONY: pre-commit | ||
pre-commit: | ||
ifdef PRE_COMMIT | ||
$(info "Running pre-commit...") | ||
pre-commit run --all-files | ||
else | ||
$(warning "pre-commit not installed. Skipping...") | ||
endif | ||
|
||
.PHONY: zip | ||
zip: version checksums | ||
@echo "Packaging stacks with version ${PKG_VERSION}..." | ||
|
||
@if [ ! -d dist ]; then \ | ||
mkdir dist ; \ | ||
fi | ||
|
||
@cd terraform-stacks ; \ | ||
for stack in * ; do \ | ||
if [ -d $$stack ] && [ "$$stack" != "shared_modules" ]; then \ | ||
cd $$stack ; \ | ||
echo "Building $$stack-${PKG_VERSION}.zip" ; \ | ||
zip -FS -r -q ../../dist/$$stack-${PKG_VERSION}.zip * -x **/.terraform/\* -x \.* ; \ | ||
cd .. ; \ | ||
fi ; \ | ||
done | ||
|
||
.PHONY: manifests | ||
manifests: | ||
@echo "Creating condensed-manifest.yml..." | ||
@cat ./custom_manifests/manifests/* > custom_manifests/condensed-manifest.yml ; \ | ||
|
||
.PHONY: machineconfigs | ||
machineconfigs: | ||
ifdef PODMAN | ||
$(info Generating MachineConfigs from Butane...) | ||
|
||
@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 | ||
@echo '---' >> custom_manifests/manifests/02-machineconfig-ccm.yml | ||
@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 | ||
@echo '---' >> custom_manifests/manifests/02-machineconfig-ccm.yml | ||
|
||
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/iscsid-master.bu > custom_manifests/manifests/02-machineconfig-csi.yml | ||
@echo '---' >> custom_manifests/manifests/02-machineconfig-csi.yml | ||
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/iscsid-worker.bu >> custom_manifests/manifests/02-machineconfig-csi.yml | ||
@echo '---' >> custom_manifests/manifests/02-machineconfig-csi.yml | ||
|
||
@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 | ||
@echo '---' >> custom_manifests/manifests/03-machineconfig-consistent-device-path.yml | ||
@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 | ||
@echo '---' >> custom_manifests/manifests/03-machineconfig-consistent-device-path.yml | ||
|
||
@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 | ||
@echo '---' >> custom_manifests/manifests/05-oci-eval-user-data.yml | ||
@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 | ||
@echo '---' >> custom_manifests/manifests/05-oci-eval-user-data.yml | ||
else | ||
$(warning podman not installed. Skipping...) | ||
endif | ||
|
||
.PHONY: checksums | ||
checksums: | ||
@echo "Writing checksums..." | ||
|
||
@cd terraform-stacks ; \ | ||
for stack in * ; do \ | ||
if [ -d $$stack ] && [ "$$stack" != "shared_modules" ]; then \ | ||
cd $$stack ; \ | ||
shasum -a 256 *.tf > checksums ; \ | ||
if [ -d manifests ]; then \ | ||
shasum -a 256 manifests/* >> checksums ; \ | ||
fi ; \ | ||
cd .. ; \ | ||
fi ; \ | ||
done | ||
|
||
.PHONY: version | ||
version: | ||
@echo ${PKG_VERSION} | ||
|
||
@cd terraform-stacks ; \ | ||
for stack in * ; do \ | ||
if [ -d $$stack ] && [ "$$stack" != "shared_modules" ]; then \ | ||
cd $$stack ; \ | ||
printf "locals {\n stack_version = \"${PKG_VERSION}\"\n}\n" > version.tf ; \ | ||
cd .. ; \ | ||
fi ; \ | ||
done | ||
|
||
.PHONY: clean | ||
clean: | ||
@echo "Cleaning up..." | ||
|
||
rm -rvf dist | ||
|
||
# make update-drivers OCI_DRIVER_VERSION=v1.30.0 | ||
# Please be sure your KUBECONFIG is set to the cluster you want to modify | ||
.PHONY: update-drivers | ||
update-drivers: | ||
ifdef OC | ||
$(info "Updating OCI CCM and CSI drivers to ${OCI_DRIVER_VERSION}") | ||
oc apply -f custom_manifests/oci-ccm-csi-drivers/${OCI_DRIVER_VERSION}/01-oci-ccm.yml | ||
oc apply -f custom_manifests/oci-ccm-csi-drivers/${OCI_DRIVER_VERSION}/01-oci-csi.yml | ||
else | ||
$(warning "'oc' not installed. Cancelling driver update...") | ||
endif |
Oops, something went wrong.