Skip to content

Commit

Permalink
docs/user/aws/images: Dia source for UPI arch diagram
Browse files Browse the repository at this point in the history
Dia is from Stephen Cuppett, replacing the PNG he'd submitted via
39a926a (Adding initial user doc/guide & materials for UPI AWS
installation, 2019-03-12, openshift#1408).

We aren't using the full file with all the layers yet, but I'm
building it anyway because folks without Dia may still want to look at
it ;).

SVGs generated with:

  $ dia --version
  Dia version 0.97.3, compiled 18:02:21 Feb 11 2017

relink-dia.py embeds the referenced icons in the SVG with def and use
[1,2] to avoid icon URIs like:

  file:///.../openshift/installer/docs/user/aws/images/./AWS-Architecture-Icons_SVG/Light-BG/_General%20AWS/AWS-General_AWS-Cloud_light-bg.svg

Ideally Dia would have a way to do this sort of thing automatically
with a command-line switch, but if it does, I can't find it.

[1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/def
[2]: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/use
  • Loading branch information
wking committed Apr 5, 2019
1 parent 13909b5 commit 0e4b044
Show file tree
Hide file tree
Showing 8 changed files with 596 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/user/aws/images/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
AWS-Architecture-Icons_SVG*
__MACOSX
20 changes: 20 additions & 0 deletions docs/user/aws/images/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
all: install_upi.svg install_upi_vpc.svg

install_upi.svg: install_upi.dia relink-dia.py AWS-Architecture-Icons_SVG/.touch
dia --export $@ $<
./relink-dia.py $@

install_upi_vpc.svg: install_upi.dia relink-dia.py AWS-Architecture-Icons_SVG/.touch
dia -L 'Availability Zones,VPC,Subnets,Route53 (Private)' --export $@ $<
./relink-dia.py $@

# URI from https://aws.amazon.com/architecture/icons/
AWS-Architecture-Icons_SVG.zip:
curl https://d1.awsstatic.com/webteam/architecture-icons/AWS-Architecture-Icons_SVG_20190131.f8dacae00681382ab91d59994de429d6e9a680bc.zip >$@

AWS-Architecture-Icons_SVG/.touch: AWS-Architecture-Icons_SVG.zip
unzip -o $<
touch $@

clean:
rm -rf install_upi*.svg AWS-Architecture-Icons_SVG* __MACOSX
Binary file added docs/user/aws/images/install_upi.dia
Binary file not shown.
330 changes: 330 additions & 0 deletions docs/user/aws/images/install_upi.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/user/aws/images/install_upi_vpc.png
Binary file not shown.
194 changes: 194 additions & 0 deletions docs/user/aws/images/install_upi_vpc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions docs/user/aws/images/relink-dia.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env python3
#
# Replace file:///... references with relative links and add the targets to Git.

import base64
import os
import sys
import urllib.parse
import xml.etree.ElementTree


def slug(uri):
return os.path.basename(uri)


def get_def(path):
tree = xml.etree.ElementTree.parse(path)
root = tree.getroot()
root.set('id', slug(path))
return root


def relink(path):
images = set()
tree = xml.etree.ElementTree.parse(path)
root = tree.getroot()
parents = {c: p for p in tree.getiterator() for c in p}
defs = xml.etree.ElementTree.Element('{http://www.w3.org/2000/svg}defs')
root.insert(0, defs)
for image in list(root.findall('{http://www.w3.org/2000/svg}image')):
uri = urllib.parse.unquote(image.get('{http://www.w3.org/1999/xlink}href')).split('/./', 1)[-1]
if uri not in images:
defs.append(get_def(path=uri))
images.add(uri)
parent = parents[image]
parent_index = list(parent).index(image)
parent.remove(image)
attrib = dict(image.items())
attrib['{http://www.w3.org/1999/xlink}href'] = '#' + slug(uri)
parent.insert(
parent_index,
xml.etree.ElementTree.Element('{http://www.w3.org/2000/svg}use', attrib=attrib))
tree.write(path)


for path in sys.argv[1:]:
relink(path=path)
4 changes: 3 additions & 1 deletion docs/user/aws/install_upi.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ VPC configuration and a CloudFormation template is provided [here](../../../upi/

A created VPC via the template or manually should approximate a setup similar to this:

![Example VPC Architecture Diagram](images/install_upi_vpc.png)
<div style="text-align:center">
<img src="images/install_upi_vpc.svg" width="100%" />
</div>

## Create DNS entries and Load Balancers for Control Plane Components

Expand Down

0 comments on commit 0e4b044

Please sign in to comment.