diff --git a/stack_orchestrator/data/container-build/cerc-laconic-registry-cli/demo-records/demo-record-9.yml b/stack_orchestrator/data/container-build/cerc-laconic-registry-cli/demo-records/demo-record-9.yml index 415e5c74..a6c7a078 100644 --- a/stack_orchestrator/data/container-build/cerc-laconic-registry-cli/demo-records/demo-record-9.yml +++ b/stack_orchestrator/data/container-build/cerc-laconic-registry-cli/demo-records/demo-record-9.yml @@ -7,9 +7,9 @@ record: env: ENV_VAR_A: A ENV_VAR_B: B - crn: - - crn://foo.bar - - crn://bar.baz + lrn: + - lrn://foo.bar + - lrn://bar.baz meta: foo: bar tags: diff --git a/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py b/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py index ba01c9e5..9031e798 100644 --- a/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py +++ b/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py @@ -66,8 +66,8 @@ def process_app_deployment_request( fqdn = f"{requested_name}.{default_dns_suffix}" # 3. check ownership of existing dnsrecord vs this request - dns_crn = f"{dns_record_namespace}/{fqdn}" - dns_record = laconic.get_record(dns_crn) + dns_lrn = f"{dns_record_namespace}/{fqdn}" + dns_record = laconic.get_record(dns_lrn) if dns_record: matched_owner = match_owner(app_deployment_request, dns_record) if not matched_owner and dns_record.attributes.request: @@ -77,9 +77,9 @@ def process_app_deployment_request( logger.log(f"Matched DnsRecord ownership: {matched_owner}") else: raise Exception("Unable to confirm ownership of DnsRecord %s for request %s" % - (dns_crn, app_deployment_request.id)) + (dns_lrn, app_deployment_request.id)) elif "preexisting" == fqdn_policy: - raise Exception(f"No pre-existing DnsRecord {dns_crn} could be found for request {app_deployment_request.id}.") + raise Exception(f"No pre-existing DnsRecord {dns_lrn} could be found for request {app_deployment_request.id}.") # 4. get build and runtime config from request env_filename = None @@ -90,14 +90,14 @@ def process_app_deployment_request( file.write("%s=%s\n" % (k, shlex.quote(str(v)))) # 5. determine new or existing deployment - # a. check for deployment crn - app_deployment_crn = f"{deployment_record_namespace}/{fqdn}" + # a. check for deployment lrn + app_deployment_lrn = f"{deployment_record_namespace}/{fqdn}" if app_deployment_request.attributes.deployment: - app_deployment_crn = app_deployment_request.attributes.deployment - if not app_deployment_crn.startswith(deployment_record_namespace): + app_deployment_lrn = app_deployment_request.attributes.deployment + if not app_deployment_lrn.startswith(deployment_record_namespace): raise Exception("Deployment CRN %s is not in a supported namespace" % app_deployment_request.attributes.deployment) - deployment_record = laconic.get_record(app_deployment_crn) + deployment_record = laconic.get_record(app_deployment_lrn) deployment_dir = os.path.join(deployment_parent_dir, fqdn) # At present we use this to generate a unique but stable ID for the app's host container # TODO: implement support to derive this transparently from the already-unique deployment id @@ -109,7 +109,7 @@ def process_app_deployment_request( if not os.path.exists(deployment_dir): if deployment_record: raise Exception("Deployment record %s exists, but not deployment dir %s. Please remove name." % - (app_deployment_crn, deployment_dir)) + (app_deployment_lrn, deployment_dir)) logger.log(f"Creating webapp deployment in: {deployment_dir} with container id: {deployment_container_tag}") deploy_webapp.create_deployment(ctx, deployment_dir, deployment_container_tag, f"https://{fqdn}", kube_config, image_registry, env_filename) @@ -173,9 +173,9 @@ def process_app_deployment_request( laconic, app, deployment_record, - app_deployment_crn, + app_deployment_lrn, dns_record, - dns_crn, + dns_lrn, deployment_dir, app_deployment_request, logger @@ -214,8 +214,8 @@ def dump_known_requests(filename, requests, status="SEEN"): @click.option("--only-update-state", help="Only update the state file, don't process any requests anything.", is_flag=True) @click.option("--dns-suffix", help="DNS domain to use eg, laconic.servesthe.world") @click.option("--fqdn-policy", help="How to handle requests with an FQDN: prohibit, allow, preexisting", default="prohibit") -@click.option("--record-namespace-dns", help="eg, crn://laconic/dns") -@click.option("--record-namespace-deployments", help="eg, crn://laconic/deployments") +@click.option("--record-namespace-dns", help="eg, lrn://laconic/dns") +@click.option("--record-namespace-deployments", help="eg, lrn://laconic/deployments") @click.option("--dry-run", help="Don't do anything, just report what would be done.", is_flag=True) @click.option("--include-tags", help="Only include requests with matching tags (comma-separated).", default="") @click.option("--exclude-tags", help="Exclude requests with matching tags (comma-separated).", default="") diff --git a/stack_orchestrator/deploy/webapp/util.py b/stack_orchestrator/deploy/webapp/util.py index efd50162..cc476656 100644 --- a/stack_orchestrator/deploy/webapp/util.py +++ b/stack_orchestrator/deploy/webapp/util.py @@ -112,13 +112,13 @@ class LaconicRegistryClient: return results - def is_crn(self, name_or_id: str): + def is_lrn(self, name_or_id: str): if name_or_id: - return str(name_or_id).startswith("crn://") + return str(name_or_id).startswith("lrn://") return False def is_id(self, name_or_id: str): - return not self.is_crn(name_or_id) + return not self.is_lrn(name_or_id) def _add_to_cache(self, records): if not records: @@ -127,8 +127,8 @@ class LaconicRegistryClient: for p in records: self.cache["name_or_id"][p.id] = p if p.names: - for crn in p.names: - self.cache["name_or_id"][crn] = p + for lrn in p.names: + self.cache["name_or_id"][lrn] = p if p.attributes.type not in self.cache: self.cache[p.attributes.type] = [] self.cache[p.attributes.type].append(p) @@ -158,7 +158,7 @@ class LaconicRegistryClient: if name_or_id in self.cache.name_or_id: return self.cache.name_or_id[name_or_id] - if self.is_crn(name_or_id): + if self.is_lrn(name_or_id): return self.resolve(name_or_id) args = [ @@ -335,9 +335,9 @@ def deploy_to_k8s(deploy_record, deployment_dir, logger): def publish_deployment(laconic: LaconicRegistryClient, app_record, deploy_record, - deployment_crn, + deployment_lrn, dns_record, - dns_crn, + dns_lrn, deployment_dir, app_deployment_request=None, logger=None): @@ -372,7 +372,7 @@ def publish_deployment(laconic: LaconicRegistryClient, if logger: logger.log("Publishing DnsRecord.") - dns_id = laconic.publish(new_dns_record, [dns_crn]) + dns_id = laconic.publish(new_dns_record, [dns_lrn]) new_deployment_record = { "record": { @@ -393,7 +393,7 @@ def publish_deployment(laconic: LaconicRegistryClient, if logger: logger.log("Publishing ApplicationDeploymentRecord.") - deployment_id = laconic.publish(new_deployment_record, [deployment_crn]) + deployment_id = laconic.publish(new_deployment_record, [deployment_lrn]) return {"dns": dns_id, "deployment": deployment_id} @@ -402,7 +402,7 @@ def hostname_for_deployment_request(app_deployment_request, laconic): if not dns_name: app = laconic.get_record(app_deployment_request.attributes.application, require=True) dns_name = generate_hostname_for_app(app) - elif dns_name.startswith("crn://"): + elif dns_name.startswith("lrn://"): record = laconic.get_record(dns_name, require=True) dns_name = record.attributes.name return dns_name