mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CKS Enhancements: * Ability to specify different compute or service offerings for different types of CKS cluster nodes – worker, master or etcd * Ability to use CKS ready custom templates for CKS cluster nodes * Add and Remove external nodes to and from a kubernetes cluster Co-authored-by: nvazquez <nicovazquez90@gmail.com> * Update remove node timeout global setting * CKS/NSX : Missing variables in worker nodes * CKS: Fix ISO attach logic * CKS: Fix ISO attach logic * address comment * Fix Port - Node mapping when cluster is scaled in the presence of external node(s) * CKS: Externalize control and worker node setup wait time and installation attempts * Fix logger * Add missing headers and fix end of line on files * CKS Mark Nodes for Manual Upgrade and Filter Nodes to add to CKS cluster from the same network * Add support to deploy CKS cluster nodes on hosts dedicated to a domain --------- Co-authored-by: Pearl Dsilva <pearl1594@gmail.com> * Support unstacked ETCD --------- Co-authored-by: nvazquez <nicovazquez90@gmail.com> * Fix CKS cluster scaling and minor UI improvement * Reuse k8s cluster public IP for etcd nodes and rename etcd nodes * Fix DNS resolver issue * Update UDP active monitor to ICMP * Add hypervisor type to CKS cluster creation to fix CKS cluster creation when External hosts added * Fix build * Fix logger * Modify hypervisor param description in the create CKS cluster API * CKS delete fails when external nodes are present * CKS delete fails when external nodes are present * address comment * Improve network rules cleanup on failure adding external nodes to CKS cluster * UI: Fix etcd template was not honoured * UI: Fix etcd template was not honoured * Refactor * CKS: Exclude etcd nodes when calculating port numbers * Fix network cleanup in case of CKS cluster failure * Externalize retries and inverval for NSX segment deletion * Fix CKS scaling when external node(s) present in the cluster * CKS: Fix port numbers displayed against ETCD nodes * Add node version details to every node of k8s cluster - as we now support manual upgrade * Add node version details to every node of k8s cluster - as we now support manual upgrade * update column name * CKS: Exclude etcd nodes when calculating port numbers * update param name * update param * UI: Fix CKS cluster creation templates listing for non admins * CKS: Prevent etcd node start port number to coincide with k8s cluster start port numbers * CKS: Set default kubernetes cluster node version to the kubernetes cluster version on upgrade * CKS: Set default kubernetes cluster node version to the kubernetes cluster version on upgrade * consolidate query * Fix upgrade logic --------- Co-authored-by: nvazquez <nicovazquez90@gmail.com> * Fix CKS cluster version upgrade * CKS: Fix etcd port numbers being skipped * Fix CKS cluster with etcd nodes on VPC * Move schema and upgrade for 4.20 * Fix logger * Fix after rebasing * Add support for using different CNI plugins with CKS * Add support for using different CNI plugins with CKS * remove unused import * Add UI support and list cni config API * necessary UI changes * add license * changes to support external cni * UI changes * Fix NPE on restarting VPC with additional public IPs * fix merge conflict * add asnumber to create k8s svc layer * support cni framework to use as-numbers * update code * condition to ignore undefined jinja template variables * CKS: Do not pass AS number when network ID is passed * Fix deletion of Userdata / CNI Configuration in projects * CKS: Add CNI configuration details to the response and UI * Explicit events for registering cni configuration * Add Delete cni configuration API * Fix CKS deployment when using VPC tiers with custom ACLs * Fix DNS list on VR * CKS: Use Network offering of the network passed during CKS cluster creation to get the AS number * CKS cluster with guest IP * Fix: Use control node guest IP as join IP for external nodes addition * Fix DNS resolver issue * Improve etcd indexing - start from 1 * CKS: Add external node to a CKS cluster deployed with etcd node(s) successfully * CKS: Add external node to a CKS cluster deployed with etcd node(s) successfully * simplify logic * Tweak setup-kube-system script for baremetal external nodes * Consider cordoned nodes while getting ready nodes * Fix CKS cluster scale calculations * Set token TTL to 0 (no expire) for external etcd * Fix missing quotes * Fix build * Revert PR 9133 * Add calico commands for ens35 interface * Address review comments: plan CKS cluster deployment based on the node type * Add qemu-guest-agent dependency for kvm based templates * Add marvin test for CKS clusters with different offerings per node type * Remove test tag * Add marvin test and fix update template for cks and since annotations * Fix marvin test for adding and removing external nodes * Fix since version on API params * Address review comments * Fix unit test * Address review comments * UI: Make CKS public templates visible to non-admins on CKS cluster creation * Fix linter * Fix merge error * Fix positional parameters on the create kubernetes ISO script and make the ETCD version optional * fix etcd port displayed * Further improvements to CKS (#118) * Multiple nics support on Ubuntu template * Multiple nics support on Ubuntu template * supports allocating IP to the nic when VM is added to another network - no delay * Add option to select DNS or VR IP as resolver on VPC creation * Add API param and UI to select option * Add column on vpc and pass the value on the databags for CsDhcp.py to fix accordingly * Externalize the CKS Configuration, so that end users can tweak the configuration before deploying the cluster * Add new directory to c8 packaging for CKS config * Remove k8s configuration from resources and make it configurable * Revert "Remove k8s configuration from resources and make it configurable" This reverts commit d5997033ebe4ba559e6478a64578b894f8e7d3db. * copy conf to mgmt server and consume them from there * Remove node from cluster * Add missing /opt/bin directory requrired by external nodes * Login to a specific Project view * add indents * Fix CKS HA clusters * Fix build --------- Co-authored-by: Nicolas Vazquez <nicovazquez90@gmail.com> * Add missing headers * Fix linter * Address more review comments * Fix unit test * Fix scaling case for the same offering * Revert "Login to a specific Project view" This reverts commit 95e37563f48573780b07a038a7f48c0bc04e9b64. * Revert "Fix CKS HA clusters" (#120) This reverts commit 8dac16aa359faa6500ea1e1ce548169cfd08331a. * Apply suggestions from code review about user data Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com> * Update api/src/main/java/org/apache/cloudstack/api/command/user/userdata/BaseRegisterUserDataCmd.java Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com> * Refactor column names and schema path * Fix scaling for non existing previous offering per node type * Update node offering entry if there was an existing offering but a global service offering has been provided on scale --------- Co-authored-by: Pearl Dsilva <pearl1594@gmail.com> Co-authored-by: Daan Hoogland <daan@onecht.net> Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com>
410 lines
12 KiB
Python
410 lines
12 KiB
Python
#!/cygdrive/c/Python27
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
# or more contributor license agreements. See the NOTICE file
|
|
# distributed with this work for additional information
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
# to you under the Apache License, Version 2.0 (the
|
|
# "License"); you may not use this file except in compliance
|
|
# with the License. You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing,
|
|
# software distributed under the License is distributed on an
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
# KIND, either express or implied. See the License for the
|
|
# specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
import os.path
|
|
import sys
|
|
from xml.dom import minidom
|
|
from xml.parsers.expat import ExpatError
|
|
import difflib
|
|
|
|
|
|
ROOT_ADMIN = 'r'
|
|
|
|
user_to_func = {
|
|
ROOT_ADMIN: 'populateForApi',
|
|
}
|
|
|
|
|
|
user_to_cns = {
|
|
ROOT_ADMIN: 'allCommandNames',
|
|
}
|
|
|
|
|
|
dirname_to_user = {
|
|
'apis': ROOT_ADMIN,
|
|
}
|
|
|
|
|
|
dirname_to_dirname = {
|
|
'apis': 'apis',
|
|
}
|
|
|
|
|
|
known_categories = {
|
|
'Cisco' : 'External Device',
|
|
'SystemVm': 'System VM',
|
|
'VirtualMachine': 'Virtual Machine',
|
|
'VM': 'Virtual Machine',
|
|
'Vnf': 'Virtual Network Functions',
|
|
'VnfTemplate': 'Virtual Network Functions',
|
|
'GuestSubnet': 'Routing',
|
|
'HypervisorGuestOsNames': 'Guest OS',
|
|
'Domain': 'Domain',
|
|
'Template': 'Template',
|
|
'Iso': 'ISO',
|
|
'Volume': 'Volume',
|
|
'Vlan': 'VLAN',
|
|
'IpAddress': 'Address',
|
|
'PortForwarding': 'Firewall',
|
|
'Firewall': 'Firewall',
|
|
'StaticNat': 'NAT',
|
|
'IpForwarding': 'NAT',
|
|
'Host': 'Host',
|
|
'HostTags': 'Host',
|
|
'OutOfBandManagement': 'Out-of-band Management',
|
|
'Cluster': 'Cluster',
|
|
'Account': 'Account',
|
|
'Role': 'Role',
|
|
'Snapshot': 'Snapshot',
|
|
'User': 'User',
|
|
'UserData': 'User Data',
|
|
'Os': 'Guest OS',
|
|
'ServiceOffering': 'Service Offering',
|
|
'DiskOffering': 'Disk Offering',
|
|
'LoadBalancer': 'Load Balancer',
|
|
'SslCert': 'SSL Certificates',
|
|
'Router': 'Router',
|
|
'Configuration': 'Configuration',
|
|
'Capabilities': 'Configuration',
|
|
'Pod': 'Pod',
|
|
'ManagementNetworkIpRange': 'Pod',
|
|
'PublicIpRange': 'Network',
|
|
'Zone': 'Zone',
|
|
'Vmware' : 'Zone',
|
|
'NetworkOffering': 'Network Offering',
|
|
'NetworkACL': 'Network ACL',
|
|
'NetworkAclItem': 'Network ACL',
|
|
'Network': 'Network',
|
|
'CiscoNexus': 'Network',
|
|
'OpenDaylight': 'Network',
|
|
'createServiceInstance': 'Network',
|
|
'addGloboDnsHost': 'Network',
|
|
'TungstenFabric': 'Tungsten',
|
|
'listNsxControllers': 'NSX',
|
|
'addNsxController': 'NSX',
|
|
'deleteNsxController': 'NSX',
|
|
'Vpn': 'VPN',
|
|
'Limit': 'Resource Limit',
|
|
'Netscaler': 'Netscaler',
|
|
'NetscalerControlCenter': 'Netscaler',
|
|
'NetscalerLoadBalancer': 'Netscaler',
|
|
'SolidFire': 'SolidFire',
|
|
'PaloAlto': 'Palo Alto',
|
|
'ResourceCount': 'Limit',
|
|
'CloudIdentifier': 'Cloud Identifier',
|
|
'InstanceGroup': 'VM Group',
|
|
'StorageMaintenance': 'Storage Pool',
|
|
'StoragePool': 'Storage Pool',
|
|
'StorageProvider': 'Storage Pool',
|
|
'StorageScope' : 'Storage Pool',
|
|
'updateStorageCapabilities' : 'Storage Pool',
|
|
'SecurityGroup': 'Security Group',
|
|
'SSH': 'SSH',
|
|
'AsyncJob': 'Async job',
|
|
'Certificate': 'Certificate',
|
|
'Hypervisor': 'Configuration',
|
|
'Alert': 'Alert',
|
|
'Event': 'Event',
|
|
'login': 'Authentication',
|
|
'logout': 'Authentication',
|
|
'saml': 'Authentication',
|
|
'getSPMetadata': 'Authentication',
|
|
'listIdps': 'Authentication',
|
|
'authorizeSamlSso': 'Authentication',
|
|
'listSamlAuthorization': 'Authentication',
|
|
'oauthlogin': 'Authentication',
|
|
'deleteOauthProvider': 'Oauth',
|
|
'listOauthProvider': 'Oauth',
|
|
'registerOauthProvider': 'Oauth',
|
|
'updateOauthProvider': 'Oauth',
|
|
'quota': 'Quota',
|
|
'emailTemplate': 'Quota',
|
|
'Capacity': 'System Capacity',
|
|
'NetworkDevice': 'Network Device',
|
|
'ExternalLoadBalancer': 'Ext Load Balancer',
|
|
'ExternalFirewall': 'Ext Firewall',
|
|
'Usage': 'Usage',
|
|
'TrafficMonitor': 'Network',
|
|
'TrafficType': 'Network',
|
|
'Product': 'Product',
|
|
'LB': 'Load Balancer',
|
|
'ldap': 'LDAP',
|
|
'Ldap': 'LDAP',
|
|
'Swift': 'Image Store',
|
|
'S3' : 'S3',
|
|
'SecondaryStorage': 'Image Store',
|
|
'Project': 'Project',
|
|
'Lun': 'Storage',
|
|
'Pool': 'Pool',
|
|
'VPC': 'VPC',
|
|
'VPCOffering': 'VPC Offering',
|
|
'PrivateGateway': 'VPC',
|
|
'migrateVpc': 'VPC',
|
|
'Simulator': 'simulator',
|
|
'StaticRoute': 'VPC',
|
|
'Tags': 'Resource tags',
|
|
'Icon': 'Resource Icon',
|
|
'NiciraNvpDevice': 'Nicira NVP',
|
|
'BrocadeVcsDevice': 'Brocade VCS',
|
|
'BigSwitchBcfDevice': 'BigSwitch BCF',
|
|
'AutoScale': 'AutoScale',
|
|
'Counter': 'AutoScale',
|
|
'Condition': 'AutoScale',
|
|
'Api': 'API Discovery',
|
|
'ApiLimit': 'Configuration',
|
|
'Region': 'Region',
|
|
'Detail': 'Resource metadata',
|
|
'addIpToNic': 'Nic',
|
|
'removeIpFromNic': 'Nic',
|
|
'updateVmNicIp': 'Nic',
|
|
'listNics':'Nic',
|
|
'AffinityGroup': 'Affinity Group',
|
|
'ImageStore': 'Image Store',
|
|
'addImageStore': 'Image Store',
|
|
'listImageStore': 'Image Store',
|
|
'deleteImageStore': 'Image Store',
|
|
'createSecondaryStagingStore': 'Image Store',
|
|
'deleteSecondaryStagingStore': 'Image Store',
|
|
'listSecondaryStagingStores': 'Image Store',
|
|
'updateImageStore': 'Image Store',
|
|
'downloadImageStoreObject': 'Image Store',
|
|
'InternalLoadBalancer': 'Internal LB',
|
|
'DeploymentPlanners': 'Configuration',
|
|
'ObjectStore': 'Image Store',
|
|
'PortableIp': 'Portable IP',
|
|
'dedicateHost': 'Dedicate Resources',
|
|
'releaseDedicatedHost': 'Dedicate Resources',
|
|
'Baremetal' : 'Baremetal',
|
|
'UCS' : 'UCS',
|
|
'Ucs' : 'UCS',
|
|
'CacheStores' : 'Cache Stores',
|
|
'CacheStore' : 'Cache Store',
|
|
'OvsElement' : 'Ovs Element',
|
|
'StratosphereSsp' : 'Misc Network Service Providers',
|
|
'Metrics' : 'Metrics',
|
|
'listClustersMetrics': 'Cluster',
|
|
'VpnUser': 'VPN',
|
|
'listZonesMetrics': 'Metrics',
|
|
'Infrastructure' : 'Metrics',
|
|
'listRegisteredServicePackages': 'Load Balancer',
|
|
'listNsVpx' : 'Load Balancer',
|
|
'destroyNsVPx': 'Load Balancer',
|
|
'deployNetscalerVpx' : 'Load Balancer',
|
|
'stopNetScalerVpx' : 'Load Balancer',
|
|
'deleteServicePackageOffering' : 'Load Balancer',
|
|
'destroyNsVpx' : 'Load Balancer',
|
|
'startNsVpx' : 'Load Balancer',
|
|
'listAnnotations' : 'Annotations',
|
|
'addAnnotation' : 'Annotations',
|
|
'removeAnnotation' : 'Annotations',
|
|
'updateAnnotationVisibility' : 'Annotations',
|
|
'CA': 'Certificate',
|
|
'listElastistorInterface': 'Misc',
|
|
'cloudian': 'Cloudian',
|
|
'Sioc' : 'Sioc',
|
|
'Diagnostics': 'Diagnostics',
|
|
'Management': 'Management',
|
|
'Backup' : 'Backup and Recovery',
|
|
'Restore' : 'Backup and Recovery',
|
|
'UnmanagedInstance': 'Virtual Machine',
|
|
'KubernetesSupportedVersion': 'Kubernetes Service',
|
|
'KubernetesCluster': 'Kubernetes Service',
|
|
'Rolling': 'Rolling Maintenance',
|
|
'importVsphereStoragePolicies' : 'vSphere storage policies',
|
|
'listVsphereStoragePolicies' : 'vSphere storage policies',
|
|
'ConsoleEndpoint': 'Console Endpoint',
|
|
'importVm': 'Virtual Machine',
|
|
'revertToVMSnapshot': 'Virtual Machine',
|
|
'listQuarantinedIp': 'IP Quarantine',
|
|
'updateQuarantinedIp': 'IP Quarantine',
|
|
'removeQuarantinedIp': 'IP Quarantine',
|
|
'Shutdown': 'Maintenance',
|
|
'Maintenance': 'Maintenance',
|
|
'addObjectStoragePool': 'Object Store',
|
|
'listObjectStoragePools': 'Object Store',
|
|
'deleteObjectStoragePool': 'Object Store',
|
|
'updateObjectStoragePool': 'Object Store',
|
|
'createBucket': 'Object Store',
|
|
'updateBucket': 'Object Store',
|
|
'deleteBucket': 'Object Store',
|
|
'listBuckets': 'Object Store',
|
|
'listVmsForImport': 'Virtual Machine',
|
|
'SharedFS': 'Shared FileSystem',
|
|
'SharedFileSystem': 'Shared FileSystem',
|
|
'Webhook': 'Webhook',
|
|
'Webhooks': 'Webhook',
|
|
'purgeExpungedResources': 'Resource',
|
|
'forgotPassword': 'Authentication',
|
|
'resetPassword': 'Authentication',
|
|
'BgpPeer': 'BGP Peer',
|
|
'createASNRange': 'AS Number Range',
|
|
'listASNRange': 'AS Number Range',
|
|
'deleteASNRange': 'AS Number Range',
|
|
'listASNumbers': 'AS Number',
|
|
'releaseASNumber': 'AS Number',
|
|
'addNodesToKubernetesCluster': 'Kubernetes Service',
|
|
'removeNodesFromKubernetesCluster': 'Kubernetes Service',
|
|
'configureStorageAccess': 'Storage Access Groups',
|
|
'listStorageAccessGroups': 'Storage Access Groups'
|
|
}
|
|
|
|
|
|
categories = {}
|
|
|
|
|
|
def choose_category(fn):
|
|
possible_known_categories = []
|
|
for k, v in known_categories.items():
|
|
if k in fn:
|
|
possible_known_categories.append(k)
|
|
|
|
if len(possible_known_categories) > 0:
|
|
close_matches = difflib.get_close_matches(fn, possible_known_categories, n=1, cutoff=0.1)
|
|
if len(close_matches) > 0:
|
|
return known_categories[close_matches[0]]
|
|
else:
|
|
return known_categories[possible_known_categories[0]]
|
|
raise Exception('Need to add a category for %s to %s:known_categories' %
|
|
(fn, __file__))
|
|
|
|
|
|
for f in sys.argv:
|
|
dirname, fn = os.path.split(f)
|
|
if not fn.endswith('.xml'):
|
|
continue
|
|
if fn.endswith('Summary.xml') and fn != 'quotaSummary.xml':
|
|
continue
|
|
if fn.endswith('SummarySorted.xml'):
|
|
continue
|
|
if fn == 'alert_types.xml':
|
|
continue
|
|
if dirname.startswith('./'):
|
|
dirname = dirname[2:]
|
|
try:
|
|
with open(f) as data:
|
|
dom = minidom.parse(data)
|
|
name = dom.getElementsByTagName('name')[0].firstChild.data
|
|
isAsync = dom.getElementsByTagName('isAsync')[0].firstChild.data
|
|
isDeprecated = dom.getElementsByTagName('isDeprecated')[0].firstChild.data
|
|
category = choose_category(fn)
|
|
if category not in categories:
|
|
categories[category] = []
|
|
categories[category].append({
|
|
'name': name,
|
|
'dirname': dirname_to_dirname[dirname],
|
|
'async': isAsync == 'true',
|
|
'deprecated': isDeprecated == 'true',
|
|
'user': dirname_to_user[dirname],
|
|
})
|
|
except ExpatError as e:
|
|
pass
|
|
except IndexError as e:
|
|
print(fn)
|
|
|
|
|
|
def xml_for(command):
|
|
name = command['name']
|
|
isAsync = command['async'] and ' (A)' or ''
|
|
isDeprecated = command['deprecated'] and ' (D)' or ''
|
|
dirname = command['dirname']
|
|
return '''<xsl:if test="name=\'%(name)s\'">
|
|
<li><a href="%(dirname)s/%(name)s.html"><xsl:value-of select="name"/>%(isAsync)s %(isDeprecated)s</a></li>
|
|
</xsl:if>
|
|
''' % locals()
|
|
|
|
|
|
def write_xml(out, user):
|
|
with open(out, 'w') as f:
|
|
cat_strings = []
|
|
for category in categories.keys():
|
|
strings = []
|
|
for command in categories[category]:
|
|
if command['user'] == user:
|
|
strings.append(xml_for(command))
|
|
if strings:
|
|
all_strings = ''.join(strings)
|
|
cat_strings.append((len(strings), category, all_strings))
|
|
|
|
cat_strings.sort(reverse=True)
|
|
|
|
i = 0
|
|
for _1, category, all_strings in cat_strings:
|
|
if i == 0:
|
|
f.write('<div class="apismallsections">\n')
|
|
f.write('''<div class="apismallbullet_box">
|
|
<h5>%(category)s</h5>
|
|
<ul>
|
|
<xsl:for-each select="commands/command">
|
|
%(all_strings)s
|
|
</xsl:for-each>
|
|
</ul>
|
|
</div>
|
|
|
|
''' % locals())
|
|
if i == 3:
|
|
f.write('</div>\n')
|
|
i = 0
|
|
else:
|
|
i += 1
|
|
if i != 0:
|
|
f.write('</div>\n')
|
|
|
|
|
|
def java_for(command, user):
|
|
name = command['name']
|
|
cns = user_to_cns[user]
|
|
return '''%(cns)s.add("%(name)s");
|
|
''' % locals()
|
|
|
|
|
|
def java_for_user(user):
|
|
strings = []
|
|
for category in categories.keys():
|
|
for command in categories[category]:
|
|
if command['user'] == user:
|
|
strings.append(java_for(command, user))
|
|
func = user_to_func[user]
|
|
all_strings = ''.join(strings)
|
|
return '''
|
|
public void %(func)s() {
|
|
%(all_strings)s
|
|
}
|
|
''' % locals()
|
|
|
|
|
|
def write_java(out):
|
|
with open(out, 'w') as f:
|
|
f.write('''/* Generated using gen_toc.py. Do not edit. */
|
|
|
|
import java.util.HashSet;
|
|
import java.util.Set;
|
|
|
|
public class XmlToHtmlConverterData {
|
|
Set<String> allCommandNames = new HashSet<String>();
|
|
''')
|
|
f.write(java_for_user(ROOT_ADMIN) + "\n")
|
|
|
|
f.write('''
|
|
}
|
|
|
|
''')
|
|
|
|
|
|
write_xml('generatetoc_include.xsl', ROOT_ADMIN)
|
|
write_java('XmlToHtmlConverterData.java')
|