Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs/user/aws/images: Dia source for UPI arch diagram #1525

Merged
merged 1 commit into from
Apr 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we document how to build it / or a small script rather than add make for consistency?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we document how to build it / or a small script rather than add make for consistency?

We could, but it's going to take more space than the Makefile (e.g. we'd have to write our own code or text about checking for a pre-existing icon zip, unpacking the zip, etc. I don't expect a huge contributor base feeding diagram changes (although I guess you never know), so I'm ok with it how it stands, but am also happy to add docs (CONTRIBUTING.md? docs/user/aws/images/README.md? A Makefile header comment?) that say:

To rebuild the *.svg, run make in this directory.


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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you think will be worth it to add a note somewhere to say dia is a pre-req which can be installed using OS pkg tools - brew, apt, yum, dnf etc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you think will be worth it to add a note somewhere to say dia is a pre-req which can be installed using OS pkg tools - brew, apt, yum, dnf etc

Won't folks without it get a useful "command not found" error already? And I'd be surprised if all that many people were bumping the .dia source. So I'm currently leaning towards "punt". But I'd be fine landing docs if someone else wrote them up and they looked like they wouldn't go stale quickly ;).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

happy to add some notes (but will be in a week time once i'm back online)

./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