-
Notifications
You must be signed in to change notification settings - Fork 17
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
e007015
commit 3d4d12d
Showing
10 changed files
with
42 additions
and
125 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,82 +1,35 @@ | ||
import os | ||
|
||
# Define the project structure | ||
project_name = "app/media/MyHelm" | ||
directories = ["charts", "crds", "templates"] | ||
files = ["Chart.yaml", "values.yaml"] | ||
|
||
# Define default content for Chart.yaml and values.yaml | ||
chart_yaml_content = """apiVersion: v2 | ||
name: myhelm | ||
project_name = "MyHelm" | ||
base_dir = "app/media" | ||
project_path = os.path.join(base_dir, project_name) | ||
|
||
# Define directories and files | ||
dirs = [ | ||
os.path.join(project_path, "charts"), | ||
os.path.join(project_path, "crds"), | ||
os.path.join(project_path, "templates", "web"), | ||
] | ||
|
||
files = { | ||
"Chart.yaml": """apiVersion: v1 | ||
name: MyHelm | ||
description: A Helm chart for Kubernetes | ||
version: 0.1.0 | ||
""" | ||
values_yaml_content = """# Default values for myhelm. | ||
# This is a YAML-formatted file. | ||
# Declare variables to be passed into your templates. | ||
replicaCount: 1 | ||
image: | ||
repository: myimage | ||
""", | ||
"values.yaml": """image: | ||
repository: rembg | ||
tag: latest | ||
pullPolicy: IfNotPresent | ||
tag: "" | ||
service: | ||
name: myservice | ||
type: ClusterIP | ||
port: 80 | ||
""" | ||
|
||
# Create the project structure | ||
os.makedirs(project_name, exist_ok=True) | ||
|
||
for directory in directories: | ||
os.makedirs(os.path.join(project_name, directory), exist_ok=True) | ||
|
||
for file in files: | ||
file_path = os.path.join(project_name, file) | ||
with open(file_path, 'w') as f: | ||
if file == "Chart.yaml": | ||
f.write(chart_yaml_content) | ||
elif file == "values.yaml": | ||
f.write(values_yaml_content) | ||
|
||
# Create a basic GitHub Actions workflow file | ||
github_actions_dir = os.path.join(project_name, ".github/workflows") | ||
os.makedirs(github_actions_dir, exist_ok=True) | ||
with open(os.path.join(github_actions_dir, "ci.yml"), 'w') as f: | ||
f.write("""name: CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
push: true | ||
tags: myimage:latest | ||
""") | ||
""", | ||
} | ||
|
||
# Create project structure | ||
os.makedirs(project_path, exist_ok=True) | ||
for d in dirs: | ||
os.makedirs(d, exist_ok=True) | ||
|
||
# Create files with default content | ||
for file_name, content in files.items(): | ||
with open(os.path.join(project_path, file_name), 'w') as f: | ||
f.write(content) |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
apiVersion: v2 | ||
name: myhelm | ||
apiVersion: v1 | ||
name: MyHelm | ||
description: A Helm chart for Kubernetes | ||
version: 0.1.0 |
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,4 @@ | ||
# Default values for myhelm. | ||
# This is a YAML-formatted file. | ||
# Declare variables to be passed into your templates. | ||
replicaCount: 1 | ||
image: | ||
repository: myimage | ||
repository: rembg | ||
tag: latest | ||
pullPolicy: IfNotPresent | ||
tag: "" | ||
service: | ||
name: myservice | ||
type: ClusterIP | ||
port: 80 |
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 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