Skip to content

Commit

Permalink
add raw flag for GitHub download links
Browse files Browse the repository at this point in the history
  • Loading branch information
clasohm committed Sep 8, 2015
1 parent bb3e20e commit d093fe0
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 40 deletions.
4 changes: 2 additions & 2 deletions cmd/mungedocs/example_syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var exampleMungeTagRE = regexp.MustCompile(beginMungeTag(fmt.Sprintf("%s %s", ex
// bar:
// ```
//
// [Download example](../../examples/guestbook/frontend-controller.yaml)
// [Download example](../../examples/guestbook/frontend-controller.yaml?raw=true)
// <!-- END MUNGE: EXAMPLE -->
func syncExamples(filePath string, mlines mungeLines) (mungeLines, error) {
var err error
Expand Down Expand Up @@ -108,7 +108,7 @@ func exampleContent(filePath, linkPath, fileType string) (mungeLines, error) {

// remove leading and trailing spaces and newlines
trimmedFileContent := strings.TrimSpace(string(dat))
content := fmt.Sprintf("\n```%s\n%s\n```\n\n[Download example](%s)", fileType, trimmedFileContent, fileRel)
content := fmt.Sprintf("\n```%s\n%s\n```\n\n[Download example](%s?raw=true)", fileType, trimmedFileContent, fileRel)
out := getMungeLines(content)
return out, nil
}
4 changes: 2 additions & 2 deletions cmd/mungedocs/example_syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ spec:
{"", ""},
{
"<!-- BEGIN MUNGE: EXAMPLE testdata/pod.yaml -->\n<!-- END MUNGE: EXAMPLE testdata/pod.yaml -->\n",
"<!-- BEGIN MUNGE: EXAMPLE testdata/pod.yaml -->\n\n```yaml\n" + podExample + "```\n\n[Download example](testdata/pod.yaml)\n<!-- END MUNGE: EXAMPLE testdata/pod.yaml -->\n",
"<!-- BEGIN MUNGE: EXAMPLE testdata/pod.yaml -->\n\n```yaml\n" + podExample + "```\n\n[Download example](testdata/pod.yaml?raw=true)\n<!-- END MUNGE: EXAMPLE testdata/pod.yaml -->\n",
},
{
"<!-- BEGIN MUNGE: EXAMPLE ../mungedocs/testdata/pod.yaml -->\n<!-- END MUNGE: EXAMPLE ../mungedocs/testdata/pod.yaml -->\n",
"<!-- BEGIN MUNGE: EXAMPLE ../mungedocs/testdata/pod.yaml -->\n\n```yaml\n" + podExample + "```\n\n[Download example](../mungedocs/testdata/pod.yaml)\n<!-- END MUNGE: EXAMPLE ../mungedocs/testdata/pod.yaml -->\n",
"<!-- BEGIN MUNGE: EXAMPLE ../mungedocs/testdata/pod.yaml -->\n\n```yaml\n" + podExample + "```\n\n[Download example](../mungedocs/testdata/pod.yaml?raw=true)\n<!-- END MUNGE: EXAMPLE ../mungedocs/testdata/pod.yaml -->\n",
},
}
repoRoot = ""
Expand Down
2 changes: 1 addition & 1 deletion docs/admin/namespaces/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Use the file [`namespace-dev.json`](namespace-dev.json) which describes a develo
}
```

[Download example](namespace-dev.json)
[Download example](namespace-dev.json?raw=true)
<!-- END MUNGE: EXAMPLE namespace-dev.json -->

Create the development namespace using kubectl.
Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started-guides/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ spec:
'for ((i = 0; ; i++)); do echo "$i: $(date)"; sleep 1; done']
```

[Download example](../../examples/blog-logging/counter-pod.yaml)
[Download example](../../examples/blog-logging/counter-pod.yaml?raw=true)
<!-- END MUNGE: EXAMPLE ../../examples/blog-logging/counter-pod.yaml -->

This pod specification has one container which runs a bash script when the container is born. This script simply writes out the value of a counter and the date once per second and runs indefinitely. Let’s create the pod in the default
Expand Down Expand Up @@ -192,7 +192,7 @@ spec:
path: /var/lib/docker/containers
```
[Download example](../../cluster/saltbase/salt/fluentd-gcp/fluentd-gcp.yaml)
[Download example](../../cluster/saltbase/salt/fluentd-gcp/fluentd-gcp.yaml?raw=true)
<!-- END MUNGE: EXAMPLE ../../cluster/saltbase/salt/fluentd-gcp/fluentd-gcp.yaml -->
This pod specification maps the directory on the host containing the Docker log files, `/var/lib/docker/containers`, to a directory inside the container which has the same path. The pod runs one image, `gcr.io/google_containers/fluentd-gcp:1.6`, which is configured to collect the Docker log files from the logs directory and ingest them into Google Cloud Logging. One instance of this pod runs on each node of the cluster. Kubernetes will notice if this pod fails and automatically restart it.
Expand Down
4 changes: 2 additions & 2 deletions docs/user-guide/downward-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ spec:
restartPolicy: Never
```
[Download example](downward-api/dapi-pod.yaml)
[Download example](downward-api/dapi-pod.yaml?raw=true)
<!-- END MUNGE: EXAMPLE downward-api/dapi-pod.yaml -->
Expand Down Expand Up @@ -178,7 +178,7 @@ spec:
fieldPath: metadata.annotations
```

[Download example](downward-api/volume/dapi-volume.yaml)
[Download example](downward-api/volume/dapi-volume.yaml?raw=true)
<!-- END MUNGE: EXAMPLE downward-api/volume/dapi-volume.yaml -->

Some more thorough examples:
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ spec:
'for ((i = 0; ; i++)); do echo "$i: $(date)"; sleep 1; done']
```

[Download example](../../examples/blog-logging/counter-pod.yaml)
[Download example](../../examples/blog-logging/counter-pod.yaml?raw=true)
<!-- END MUNGE: EXAMPLE ../../examples/blog-logging/counter-pod.yaml -->

we can run the pod:
Expand Down
4 changes: 2 additions & 2 deletions docs/user-guide/simple-yaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ spec:
- containerPort: 80
```
[Download example](pod.yaml)
[Download example](pod.yaml?raw=true)
<!-- END MUNGE: EXAMPLE pod.yaml -->
You can see your cluster's pods:
Expand Down Expand Up @@ -116,7 +116,7 @@ spec:
- containerPort: 80
```
[Download example](replication.yaml)
[Download example](replication.yaml?raw=true)
<!-- END MUNGE: EXAMPLE replication.yaml -->
To delete the replication controller (and the pods it created):
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/walkthrough/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ spec:
emptyDir: {}
```
[Download example](pod-redis.yaml)
[Download example](pod-redis.yaml?raw=true)
<!-- END MUNGE: EXAMPLE pod-redis.yaml -->
Notes:
Expand Down
8 changes: 4 additions & 4 deletions docs/user-guide/walkthrough/k8s201.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ spec:
- containerPort: 80
```
[Download example](pod-nginx-with-label.yaml)
[Download example](pod-nginx-with-label.yaml?raw=true)
<!-- END MUNGE: EXAMPLE pod-nginx-with-label.yaml -->
Create the labeled pod ([pod-nginx-with-label.yaml](pod-nginx-with-label.yaml)):
Expand Down Expand Up @@ -142,7 +142,7 @@ spec:
- containerPort: 80
```
[Download example](replication-controller.yaml)
[Download example](replication-controller.yaml?raw=true)
<!-- END MUNGE: EXAMPLE replication-controller.yaml -->
#### Replication Controller Management
Expand Down Expand Up @@ -195,7 +195,7 @@ spec:
app: nginx
```
[Download example](service.yaml)
[Download example](service.yaml?raw=true)
<!-- END MUNGE: EXAMPLE service.yaml -->
#### Service Management
Expand Down Expand Up @@ -311,7 +311,7 @@ spec:
- containerPort: 80
```
[Download example](pod-with-http-healthcheck.yaml)
[Download example](pod-with-http-healthcheck.yaml?raw=true)
<!-- END MUNGE: EXAMPLE pod-with-http-healthcheck.yaml -->
For more information about health checking, see [Container Probes](../pod-states.md#container-probes).
Expand Down
6 changes: 3 additions & 3 deletions examples/cassandra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ spec:
emptyDir: {}
```
[Download example](cassandra-controller.yaml)
[Download example](cassandra-controller.yaml?raw=true)
<!-- END MUNGE: EXAMPLE cassandra-controller.yaml -->
There are a few things to note in this description. First is that we are running the ```kubernetes/cassandra``` image. This is a standard Cassandra installation on top of Debian. However it also adds a custom [```SeedProvider```](https://svn.apache.org/repos/asf/cassandra/trunk/src/java/org/apache/cassandra/locator/SeedProvider.java) to Cassandra. In Cassandra, a ```SeedProvider``` bootstraps the gossip protocol that Cassandra uses to find other nodes. The ```KubernetesSeedProvider``` discovers the Kubernetes API Server using the built in Kubernetes discovery service, and then uses the Kubernetes API to find new nodes (more on this later)
Expand Down Expand Up @@ -131,7 +131,7 @@ spec:
name: cassandra
```

[Download example](cassandra-service.yaml)
[Download example](cassandra-service.yaml?raw=true)
<!-- END MUNGE: EXAMPLE cassandra-service.yaml -->

The important thing to note here is the ```selector```. It is a query over labels, that identifies the set of _Pods_ contained by the _Service_. In this case the selector is ```name=cassandra```. If you look back at the Pod specification above, you'll see that the pod has the corresponding label, so it will be selected for membership in this Service.
Expand Down Expand Up @@ -241,7 +241,7 @@ spec:
emptyDir: {}
```

[Download example](cassandra-controller.yaml)
[Download example](cassandra-controller.yaml?raw=true)
<!-- END MUNGE: EXAMPLE cassandra-controller.yaml -->

Most of this replication controller definition is identical to the Cassandra pod definition above, it simply gives the replication controller a recipe to use when it creates new Cassandra pods. The other differentiating parts are the ```selector``` attribute which contains the controller's selector query, and the ```replicas``` attribute which specifies the desired number of replicas, in this case 1.
Expand Down
10 changes: 5 additions & 5 deletions examples/celery-rabbitmq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ spec:
component: rabbitmq
```
[Download example](rabbitmq-service.yaml)
[Download example](rabbitmq-service.yaml?raw=true)
<!-- END MUNGE: EXAMPLE rabbitmq-service.yaml -->
To start the service, run:
Expand Down Expand Up @@ -126,7 +126,7 @@ spec:
cpu: 100m
```
[Download example](rabbitmq-controller.yaml)
[Download example](rabbitmq-controller.yaml?raw=true)
<!-- END MUNGE: EXAMPLE rabbitmq-controller.yaml -->
Running `$ kubectl create -f examples/celery-rabbitmq/rabbitmq-controller.yaml` brings up a replication controller that ensures one pod exists which is running a RabbitMQ instance.
Expand Down Expand Up @@ -167,7 +167,7 @@ spec:
cpu: 100m
```

[Download example](celery-controller.yaml)
[Download example](celery-controller.yaml?raw=true)
<!-- END MUNGE: EXAMPLE celery-controller.yaml -->

There are several things to point out here...
Expand Down Expand Up @@ -238,7 +238,7 @@ spec:
type: LoadBalancer
```

[Download example](flower-service.yaml)
[Download example](flower-service.yaml?raw=true)
<!-- END MUNGE: EXAMPLE flower-service.yaml -->

It is marked as external (LoadBalanced). However on many platforms you will have to add an explicit firewall rule to open port 5555.
Expand Down Expand Up @@ -279,7 +279,7 @@ spec:
cpu: 100m
```

[Download example](flower-controller.yaml)
[Download example](flower-controller.yaml?raw=true)
<!-- END MUNGE: EXAMPLE flower-controller.yaml -->

This will bring up a new pod with Flower installed and port 5555 (Flower's default port) exposed through the service endpoint. This image uses the following command to start Flower:
Expand Down
12 changes: 6 additions & 6 deletions examples/guestbook/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ spec:
- containerPort: 6379
```
[Download example](redis-master-controller.yaml)
[Download example](redis-master-controller.yaml?raw=true)
<!-- END MUNGE: EXAMPLE redis-master-controller.yaml -->
Change to the `<kubernetes>/examples/guestbook` directory if you're not already there. Create the redis master pod in your Kubernetes cluster by running:
Expand Down Expand Up @@ -221,7 +221,7 @@ spec:
name: redis-master
```

[Download example](redis-master-service.yaml)
[Download example](redis-master-service.yaml?raw=true)
<!-- END MUNGE: EXAMPLE redis-master-service.yaml -->

Create the service by running:
Expand Down Expand Up @@ -296,7 +296,7 @@ spec:
- containerPort: 6379
```

[Download example](redis-slave-controller.yaml)
[Download example](redis-slave-controller.yaml?raw=true)
<!-- END MUNGE: EXAMPLE redis-slave-controller.yaml -->

and create the replication controller by running:
Expand Down Expand Up @@ -347,7 +347,7 @@ spec:
name: redis-slave
```

[Download example](redis-slave-service.yaml)
[Download example](redis-slave-service.yaml?raw=true)
<!-- END MUNGE: EXAMPLE redis-slave-service.yaml -->

This time the selector for the service is `name=redis-slave`, because that identifies the pods running redis slaves. It may also be helpful to set labels on your service itself as we've done here to make it easy to locate them with the `kubectl get services -l "label=value"` command.
Expand Down Expand Up @@ -398,7 +398,7 @@ spec:
- containerPort: 80
```

[Download example](frontend-controller.yaml)
[Download example](frontend-controller.yaml?raw=true)
<!-- END MUNGE: EXAMPLE frontend-controller.yaml -->

Using this file, you can turn up your frontend with:
Expand Down Expand Up @@ -501,7 +501,7 @@ spec:
name: frontend
```

[Download example](frontend-service.yaml)
[Download example](frontend-service.yaml?raw=true)
<!-- END MUNGE: EXAMPLE frontend-service.yaml -->

#### Using 'type: LoadBalancer' for the frontend service (cloud-provider-specific)
Expand Down
4 changes: 2 additions & 2 deletions examples/hazelcast/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ spec:
name: hazelcast
```
[Download example](hazelcast-service.yaml)
[Download example](hazelcast-service.yaml?raw=true)
<!-- END MUNGE: EXAMPLE hazelcast-service.yaml -->
The important thing to note here is the `selector`. It is a query over labels, that identifies the set of _Pods_ contained by the _Service_. In this case the selector is `name: hazelcast`. If you look at the Replication Controller specification below, you'll see that the pod has the corresponding label, so it will be selected for membership in this Service.
Expand Down Expand Up @@ -138,7 +138,7 @@ spec:
name: hazelcast
```

[Download example](hazelcast-controller.yaml)
[Download example](hazelcast-controller.yaml?raw=true)
<!-- END MUNGE: EXAMPLE hazelcast-controller.yaml -->

There are a few things to note in this description. First is that we are running the `quay.io/pires/hazelcast-kubernetes` image, tag `0.5`. This is a `busybox` installation with JRE 8 Update 45. However it also adds a custom [`application`](https://github.com/pires/hazelcast-kubernetes-bootstrapper) that finds any Hazelcast nodes in the cluster and bootstraps an Hazelcast instance accordingly. The `HazelcastDiscoveryController` discovers the Kubernetes API Server using the built in Kubernetes discovery service, and then uses the Kubernetes API to find new nodes (more on this later).
Expand Down
8 changes: 4 additions & 4 deletions examples/mysql-wordpress-pd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ spec:
fsType: ext4
```
[Download example](mysql.yaml)
[Download example](mysql.yaml?raw=true)
<!-- END MUNGE: EXAMPLE mysql.yaml -->
Note that we've defined a volume mount for `/var/lib/mysql`, and specified a volume that uses the persistent disk (`mysql-disk`) that you created.
Expand Down Expand Up @@ -186,7 +186,7 @@ spec:
name: mysql
```

[Download example](mysql-service.yaml)
[Download example](mysql-service.yaml?raw=true)
<!-- END MUNGE: EXAMPLE mysql-service.yaml -->

Start the service like this:
Expand Down Expand Up @@ -241,7 +241,7 @@ spec:
fsType: ext4
```

[Download example](wordpress.yaml)
[Download example](wordpress.yaml?raw=true)
<!-- END MUNGE: EXAMPLE wordpress.yaml -->

Create the pod:
Expand Down Expand Up @@ -282,7 +282,7 @@ spec:
type: LoadBalancer
```

[Download example](wordpress-service.yaml)
[Download example](wordpress-service.yaml?raw=true)
<!-- END MUNGE: EXAMPLE wordpress-service.yaml -->

Note the `type: LoadBalancer` setting. This will set up the wordpress service behind an external IP.
Expand Down
6 changes: 3 additions & 3 deletions examples/phabricator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ To start Phabricator server use the file [`examples/phabricator/phabricator-cont
}
```

[Download example](phabricator-controller.json)
[Download example](phabricator-controller.json?raw=true)
<!-- END MUNGE: EXAMPLE phabricator-controller.json -->

Create the phabricator pod in your Kubernetes cluster by running:
Expand Down Expand Up @@ -188,7 +188,7 @@ To automate this process and make sure that a proper host is authorized even if
}
```

[Download example](authenticator-controller.json)
[Download example](authenticator-controller.json?raw=true)
<!-- END MUNGE: EXAMPLE authenticator-controller.json -->

To create the pod run:
Expand Down Expand Up @@ -237,7 +237,7 @@ Use the file [`examples/phabricator/phabricator-service.json`](phabricator-servi
}
```

[Download example](phabricator-service.json)
[Download example](phabricator-service.json?raw=true)
<!-- END MUNGE: EXAMPLE phabricator-service.json -->

To create the service run:
Expand Down

0 comments on commit d093fe0

Please sign in to comment.