-
Notifications
You must be signed in to change notification settings - Fork 0
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
76bf391
commit 2003369
Showing
33 changed files
with
1,274 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
schema_version = 1 | ||
|
||
project { | ||
copyright_holder = "Spectro Cloud" | ||
license = "Apache-2.0" | ||
copyright_year = 2024 | ||
|
||
# (OPTIONAL) A list of globs that should not have copyright/license headers. | ||
# Supports doublestar glob patterns for more flexibility in defining which | ||
# files or folders should be ignored | ||
header_ignore = [ | ||
# "vendors/**", | ||
# "**autogen**", | ||
] | ||
} |
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,9 @@ | ||
## Describe the Change | ||
|
||
This PR ..... | ||
|
||
## Checklist | ||
|
||
- [ ] README updated? | ||
|
||
- [ ] Content added contain comments that explain the purpose of the script and usage? |
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,36 @@ | ||
name: GitLeaks | ||
on: [pull_request] | ||
|
||
concurrency: | ||
group: gitleaks-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
gitleaks-scan: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: gcr.io/spectro-dev-public/bulwark/gitleaks:latest | ||
env: | ||
REPO: ${{ github.event.repository.name }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITLEAKS_CONFIG: config.toml | ||
steps: | ||
|
||
- name: run-bulwark-gitleaks-scan | ||
shell: sh | ||
env: | ||
BRANCH: ${{ github.head_ref || github.ref_name }} | ||
run: /workspace/bulwark -name CodeSASTGitLeaks -target $REPO -tags "branch:$BRANCH,options:--log-opts origin..HEAD" | ||
|
||
- name: check-result | ||
shell: sh | ||
run: | | ||
resultPath=./$REPO/gitleaks.json | ||
cat $resultPath | grep -v \"Match\"\: | grep -v \"Secret\"\: | ||
total_failed_tests=`cat $resultPath | grep \"Fingerprint\"\: | wc -l` | ||
if [ "$total_failed_tests" -gt 0 ]; then | ||
echo "GitLeaks validation check failed with above findings..." | ||
exit 1 | ||
else | ||
echo "GitLeaks validation check passed" | ||
fi |
Validating CODEOWNERS rules …
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 @@ | ||
* @spectrocloud/education-engineers |
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,5 @@ | ||
.PHONY: license | ||
|
||
license: | ||
@echo "Applying license headers..." | ||
copywrite headers |
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,2 +1,13 @@ | ||
# palette-samples | ||
A repository that contains templates, scripts, and other other useful content | ||
# Palette Samples | ||
|
||
![Spectro Cloud logo with docs inline](/static/images/spectrocloud-logo-light.svg) | ||
|
||
This repository contains a collection of patterns, code samples, and more to help you get started with Palette and VerteX. Check out the resources below to learn more. | ||
|
||
## Patterns | ||
|
||
- [Managing Cluster Profiles with Terraform](./terraform/cluster-profiles/README.md) | ||
|
||
## Contact Us | ||
|
||
If you have any questions, please reach out to us at [[email protected]](mailto:[email protected]) or join our [Slack community](https://spectrocloudcommunity.slack.com). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,12 @@ | ||
# Cluster Profile Management Patterns | ||
|
||
This folder contains examples of how to manage cluster profiles using Terraform. There are multiple ways to manage cluster profiles using Terraform. The examples in this folder are meant to be used as a starting point for managing cluster profiles using Terraform. Use these examples as a reference and modify them to suit your needs. | ||
|
||
|
||
Check out the READMEs in each folder to learn more about the different patterns. | ||
|
||
- [Basic Pattern](./basic/README.md) | ||
|
||
- [Intermediate Pattern](./cp-versions/README.md) | ||
|
||
- [Advanced Pattern](./cp-profiles-with-module/README.md) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,89 @@ | ||
# Basic Pattern | ||
|
||
The basic pattern of managing and maintain cluster profiles. Each cluster profile version is defined through the `spectrocloud_cluster_profile` resource. | ||
|
||
|
||
| Pros | | ||
| ---- | | ||
| Easy to understand | | ||
| Easy to implement | | ||
| Mimumum complexity | | ||
| Profiles are clearly defined | | ||
| Low chances of accidental changes | | ||
| YAML customization supported through dedicated `pack {}` block | | ||
|
||
| Cons | | ||
| ---- | | ||
| Requires code duplications | | ||
| Tedious to maintain | | ||
|
||
|
||
## Usage | ||
|
||
1. Create a data resource for each pack. Replace the name of the pack with the name of the pack you are adding. For example, if you are adding the `csi-aws-ebs` pack, the data resource would look like the following: | ||
|
||
```hcl | ||
data "spectrocloud_pack" "csi-aws-ebs" { | ||
name = "csi-aws-ebs" | ||
version = "1.22.0" | ||
registry_uid = data.spectrocloud_registry.public_registry.id | ||
} | ||
``` | ||
|
||
2. If adding a new pack version, add a new data resource for the pack. | ||
|
||
```hcl | ||
data "spectrocloud_pack" "csi-aws-ebs-1-24" { | ||
name = "csi-aws-ebs" | ||
version = "1.24.0" | ||
registry_uid = data.spectrocloud_registry.public_registry.id | ||
} | ||
``` | ||
|
||
|
||
3. In the cluster profile resource `spectrocloud_cluster_profile`, add a new `pack {}` block for each pack version. Assign a name and version to the cluster profile. | ||
|
||
```hcl | ||
resource "spectrocloud_cluster_profile" "aws-profile-1-0-0" { | ||
name = "tf-aws-profile" | ||
description = "A basic cluster profile for AWS" | ||
tags = concat(var.tags, ["env:aws", "version:1.0.0"]) | ||
cloud = "aws" | ||
type = "cluster" | ||
version = "1.0.0" | ||
pack { | ||
name = data.spectrocloud_pack.ubuntu-aws.name | ||
tag = data.spectrocloud_pack.ubuntu-aws.version | ||
uid = data.spectrocloud_pack.ubuntu-aws.id | ||
values = data.spectrocloud_pack.ubuntu-aws.values | ||
} | ||
pack { | ||
name = data.spectrocloud_pack.kubernetes.name | ||
tag = data.spectrocloud_pack.kubernetes.version | ||
uid = data.spectrocloud_pack.kubernetes.id | ||
values = data.spectrocloud_pack.kubernetes.values | ||
} | ||
pack { | ||
name = data.spectrocloud_pack.cni-calico.name | ||
tag = data.spectrocloud_pack.cni-calico.version | ||
uid = data.spectrocloud_pack.cni-calico.id | ||
values = data.spectrocloud_pack.cni-calico.values | ||
} | ||
pack { | ||
name = data.spectrocloud_pack.csi-aws-ebs.name | ||
tag = data.spectrocloud_pack.csi-aws-ebs.version | ||
uid = data.spectrocloud_pack.csi-aws-ebs.id | ||
values = data.spectrocloud_pack.csi-aws-ebs.values | ||
} | ||
} | ||
``` | ||
|
||
4. Repeat the above steps for each cluster profile version. | ||
|
||
|
||
5. Reference the desired cluster profile in the `spectrocloud_cluster` resource. |
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,78 @@ | ||
# Copyright (c) Spectro Cloud | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
resource "spectrocloud_cluster_profile" "aws-profile-1-0-0" { | ||
|
||
name = "tf-aws-profile" | ||
description = "A basic cluster profile for AWS" | ||
tags = concat(var.tags, ["env:aws", "version:1.0.0"]) | ||
cloud = "aws" | ||
type = "cluster" | ||
version = "1.0.0" | ||
|
||
pack { | ||
name = data.spectrocloud_pack.ubuntu-aws.name | ||
tag = data.spectrocloud_pack.ubuntu-aws.version | ||
uid = data.spectrocloud_pack.ubuntu-aws.id | ||
values = data.spectrocloud_pack.ubuntu-aws.values | ||
} | ||
|
||
pack { | ||
name = data.spectrocloud_pack.kubernetes.name | ||
tag = data.spectrocloud_pack.kubernetes.version | ||
uid = data.spectrocloud_pack.kubernetes.id | ||
values = data.spectrocloud_pack.kubernetes.values | ||
} | ||
|
||
pack { | ||
name = data.spectrocloud_pack.cni-calico.name | ||
tag = data.spectrocloud_pack.cni-calico.version | ||
uid = data.spectrocloud_pack.cni-calico.id | ||
values = data.spectrocloud_pack.cni-calico.values | ||
} | ||
|
||
pack { | ||
name = data.spectrocloud_pack.csi-aws-ebs.name | ||
tag = data.spectrocloud_pack.csi-aws-ebs.version | ||
uid = data.spectrocloud_pack.csi-aws-ebs.id | ||
values = data.spectrocloud_pack.csi-aws-ebs.values | ||
} | ||
} | ||
|
||
resource "spectrocloud_cluster_profile" "aws-profile-1-0-1" { | ||
|
||
name = "tf-aws-profile" | ||
description = "A basic cluster profile for AWS" | ||
tags = concat(var.tags, ["env:aws", "version:1.0.1"]) | ||
cloud = "aws" | ||
type = "cluster" | ||
version = "1.0.1" | ||
|
||
pack { | ||
name = data.spectrocloud_pack.ubuntu-aws.name | ||
tag = data.spectrocloud_pack.ubuntu-aws.version | ||
uid = data.spectrocloud_pack.ubuntu-aws.id | ||
values = data.spectrocloud_pack.ubuntu-aws.values | ||
} | ||
|
||
pack { | ||
name = data.spectrocloud_pack.kubernetes.name | ||
tag = data.spectrocloud_pack.kubernetes.version | ||
uid = data.spectrocloud_pack.kubernetes.id | ||
values = data.spectrocloud_pack.kubernetes.values | ||
} | ||
|
||
pack { | ||
name = data.spectrocloud_pack.cni-calico.name | ||
tag = data.spectrocloud_pack.cni-calico.version | ||
uid = data.spectrocloud_pack.cni-calico.id | ||
values = data.spectrocloud_pack.cni-calico.values | ||
} | ||
|
||
pack { | ||
name = data.spectrocloud_pack.csi-aws-ebs-1-24.name | ||
tag = data.spectrocloud_pack.csi-aws-ebs-1-24.version | ||
uid = data.spectrocloud_pack.csi-aws-ebs-1-24.id | ||
values = data.spectrocloud_pack.csi-aws-ebs-1-24.values | ||
} | ||
} |
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,37 @@ | ||
# Copyright (c) Spectro Cloud | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
data "spectrocloud_registry" "public_registry" { | ||
name = "Public Repo" | ||
} | ||
|
||
|
||
data "spectrocloud_pack" "csi-aws-ebs" { | ||
name = "csi-aws-ebs" | ||
version = "1.22.0" | ||
registry_uid = data.spectrocloud_registry.public_registry.id | ||
} | ||
|
||
data "spectrocloud_pack" "csi-aws-ebs-1-24" { | ||
name = "csi-aws-ebs" | ||
version = "1.24.0" | ||
registry_uid = data.spectrocloud_registry.public_registry.id | ||
} | ||
|
||
data "spectrocloud_pack" "cni-calico" { | ||
name = "cni-calico" | ||
version = "3.26.1" | ||
registry_uid = data.spectrocloud_registry.public_registry.id | ||
} | ||
|
||
data "spectrocloud_pack" "kubernetes" { | ||
name = "kubernetes" | ||
version = "1.27.5" | ||
registry_uid = data.spectrocloud_registry.public_registry.id | ||
} | ||
|
||
data "spectrocloud_pack" "ubuntu-aws" { | ||
name = "ubuntu-aws" | ||
version = "22.04" | ||
registry_uid = data.spectrocloud_registry.public_registry.id | ||
} |
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,12 @@ | ||
# Copyright (c) Spectro Cloud | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
variable "tags" { | ||
type = list(string) | ||
description = "The default tags to apply to Palette resources" | ||
default = [ | ||
"spectro-cloud-education", | ||
"repository:spectrocloud:tutorials", | ||
"terraform_managed:true", | ||
] | ||
} |
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,21 @@ | ||
# Copyright (c) Spectro Cloud | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
terraform { | ||
required_providers { | ||
spectrocloud = { | ||
version = ">= 0.17.2" | ||
source = "spectrocloud/spectrocloud" | ||
} | ||
local = { | ||
source = "hashicorp/local" | ||
version = ">= 2.4.0" | ||
} | ||
} | ||
|
||
required_version = ">= 1.5" | ||
} | ||
|
||
provider "spectrocloud" { | ||
project_name = "Default" | ||
} |
Oops, something went wrong.