new version with the scale Up option
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 59s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 59s
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -54,7 +54,7 @@ ROOT_URLCONF = 'django_code.urls'
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [],
|
||||
'DIRS': ["/code/django_code/templates"],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
|
||||
@@ -47,7 +47,7 @@ urlpatterns = [
|
||||
path('kubernetes_connection/nodes/', kubernetes_connection.nodes),
|
||||
path('kubernetes_connection/backup_job/', kubernetes_connection.backup_job),
|
||||
path('kubernetes_connection/backup_job_yaml/', kubernetes_connection.backup_job_yaml),
|
||||
|
||||
path('kubernetes_connection/scale_up/<str:namespace_name>/<str:deploy_name>', kubernetes_connection.scale_up),
|
||||
# path('bookstack/', docker_connection.apps.hello),
|
||||
# path('test/', docker_connection.apps.http_call_test),
|
||||
# path('proxmox/', docker_connection.apps.proxmox),
|
||||
|
||||
Binary file not shown.
@@ -15,6 +15,14 @@ import yaml
|
||||
def hello(request):
|
||||
return HttpResponse('<h1>Hello k8s!</h1>')
|
||||
|
||||
def scale_up(request,namespace_name,deploy_name):
|
||||
config.load_kube_config(config_file='/code/kubeconfig')
|
||||
api = client.AppsV1Api()
|
||||
deployment = api.read_namespaced_deployment(name=deploy_name, namespace=namespace_name)
|
||||
deployment.spec.replicas = 2
|
||||
resp = api.patch_namespaced_deployment(
|
||||
name=deploy_name, namespace=namespace_name, body=deployment);
|
||||
return HttpResponse('<h1>Scaled up !</h1>')
|
||||
|
||||
def nodes(request):
|
||||
config.load_kube_config(config_file='/code/kubeconfig')
|
||||
|
||||
Binary file not shown.
@@ -2,9 +2,26 @@ from django.apps import AppConfig
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import render
|
||||
from django.shortcuts import redirect
|
||||
import time
|
||||
import random
|
||||
#from django.template.loader import render_to_string
|
||||
from django.template import loader
|
||||
#import time
|
||||
#import random
|
||||
|
||||
def hello(request):
|
||||
return HttpResponse('<h1>Hello onenote! <h1>')
|
||||
# htmlContent = '
|
||||
#<!DOCTYPE html>
|
||||
#<html lang="en">
|
||||
#<body>
|
||||
#<strong>Hello World from const</strong>
|
||||
#</body>
|
||||
#</html>
|
||||
#'
|
||||
# response = "coucou"
|
||||
# context = {'response': HttpResponse(response)}
|
||||
# return HttpResponse(htmlContent)
|
||||
# return HttpResponse('<h1>Hello onenote! <h1>')
|
||||
# return render(request, 'hello.html', context)
|
||||
|
||||
template = loader.get_template('onenote/hello.html')
|
||||
# template = loader.get_template('onenote/Roser.mht')
|
||||
return HttpResponse(template.render())
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<body>
|
||||
<strong>Hello World</strong>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<body>
|
||||
<strong>Hello World template</strong>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user