refactor(structure): reorganize monorepo with projects, terraform hierarchy, and strict k8s namespace rules
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
###
|
||||
try:
|
||||
input = raw_input
|
||||
except NameError:
|
||||
pass
|
||||
|
||||
import ovh
|
||||
import json
|
||||
|
||||
# create a client using configuration from ovh.conf file
|
||||
client = ovh.Client()
|
||||
|
||||
# Request RO, /me API access
|
||||
ck = client.new_consumer_key_request()
|
||||
ck.add_recursive_rules(ovh.API_READ_ONLY, "/")
|
||||
|
||||
# Request token
|
||||
validation = ck.request()
|
||||
|
||||
print("Please visit %s to authenticate" % validation['validationUrl'])
|
||||
input("and press Enter to continue...")
|
||||
|
||||
# Print nice welcome message
|
||||
print("Welcome", client.get('/me')['firstname'])
|
||||
print("Btw, your 'consumerKey' is '%s'" % validation['consumerKey'])
|
||||
@@ -0,0 +1,46 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
'''
|
||||
List all domain relevant information to add them to Terraform
|
||||
'''
|
||||
import json
|
||||
import ovh
|
||||
import sys
|
||||
|
||||
# Instanciate an OVH Client.
|
||||
# You can generate new credentials with full access to your account on
|
||||
# the token creation page
|
||||
client = ovh.Client(
|
||||
endpoint='ovh-eu', # Endpoint of API OVH Europe (List of available endpoints)
|
||||
application_key='pSnvZrS8R4LPCLEh', # Application Key
|
||||
application_secret='CKUHMo5ZXDm8JLA6ZWWUzAolglQmvylv', # Application Secret
|
||||
consumer_key='EVBu0meA2OYvEvVWUbR0qwU2lD7uXKiM', # Consumer Key
|
||||
)
|
||||
|
||||
all_domains = client.get('/domain')
|
||||
|
||||
# Pretty print
|
||||
print("All domains: "+json.dumps(all_domains, indent=4))
|
||||
|
||||
for domain in all_domains :
|
||||
print("Looking at domain: " +domain)
|
||||
try:
|
||||
if(domain in ["moritzgraf.de"]):
|
||||
all_resources = client.get('/domain/zone/'+str(domain)+"/record")
|
||||
print("All resources:"+json.dumps(all_resources,indent=4))
|
||||
for resource in all_resources:
|
||||
try:
|
||||
record_details = client.get('/domain/zone/'+str(domain)+"/record/"+str(resource))
|
||||
if(record_details["subDomain"] and record_details["subDomain"] in ["git","auth","prometheus","alertmanager",
|
||||
"chat","mqtt", "cloud","monitoring","smtp","pop3","imap","jaeger","ldap","code","hub","grafana",
|
||||
"tt-rss","phpmyadmin","phppgadmin","www","terraformtest","rstudio","code" ]):
|
||||
#print("Domain"+str(record_details["zone"])+"Subdomain:"+str(record_details["subDomain"]))
|
||||
print("terraform import 'ovh_domain_zone_record.moritzgraf_subdomains[\""+record_details["subDomain"]+"\"]' "+ str(record_details["id"])+"."+str(record_details["zone"]))
|
||||
except Exception as e:
|
||||
print("Somthing did not work for domain:"+str(record_details))
|
||||
print(e)
|
||||
# print("###details###"+str(record_details))
|
||||
else:
|
||||
print("Domain "+str(domain)+" not on whitelist, ignoring")
|
||||
except Exception as e:
|
||||
print("Somthing did not work for domain:"+domain)
|
||||
print(e)
|
||||
@@ -0,0 +1,13 @@
|
||||
; THIS FILE IS FOR MANUALLY CHECKING THE API
|
||||
; TO BE USED WITH ovh_dev.py
|
||||
[default]
|
||||
; general configuration: default endpoint
|
||||
endpoint=ovh-eu
|
||||
|
||||
[ovh-eu]
|
||||
; configuration specific to 'ovh-eu' endpoint
|
||||
application_key=pSnvZrS8R4LPCLEh
|
||||
application_secret=CKUHMo5ZXDm8JLA6ZWWUzAolglQmvylv
|
||||
; uncomment following line when writing a script application
|
||||
; with a single consumer key.
|
||||
;consumer_key=eNrAf7toCYw6u8vIyRcHNFp4KqyYW0Tp
|
||||
Reference in New Issue
Block a user