Skip to content

Commit 3bf9380

Browse files
authored
Merge pull request #13643 from adellape/osdk_ansible
Add Ansible-support to OSDK docs
2 parents a7ceb25 + 79aa6f9 commit 3bf9380

28 files changed

+1245
-89
lines changed

_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Topics:
5656
File: olm-creating-apps-from-installed-operators
5757
- Name: Getting started with the Operator SDK
5858
File: osdk-getting-started
59+
- Name: Creating Ansible-based Operators
60+
File: osdk-ansible
5961
- Name: Creating Helm-based Operators
6062
File: osdk-helm
6163
- Name: Operator SDK CLI reference
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
:relfileprefix: ../
2+
[id='osdk-ansible']
3+
= Creating Ansible-based Operators
4+
include::modules/common-attributes.adoc[]
5+
:context: osdk-ansible
6+
7+
toc::[]
8+
9+
{nbsp} +
10+
This guide outlines Ansible support in the Operator SDK and walks Operator
11+
authors through examples building and running Ansible-based Operators with the
12+
`operator-sdk` CLI tool that use Ansible playbooks and modules.
13+
14+
include::modules/osdk-ansible-support.adoc[leveloffset=+1]
15+
include::modules/osdk-ansible-custom-resource-files.adoc[leveloffset=+2]
16+
include::modules/osdk-ansible-watches-file.adoc[leveloffset=+2]
17+
include::modules/osdk-ansible-extra-variables.adoc[leveloffset=+2]
18+
include::modules/osdk-ansible-runner-directory.adoc[leveloffset=+2]
19+
20+
include::modules/osdk-installing-cli.adoc[leveloffset=+1]
21+
include::modules/osdk-building-ansible-operator.adoc[leveloffset=+1]
22+
23+
[id='osdk-ansible-k8s-module']
24+
== Managing application lifecycle using the k8s Ansible module
25+
26+
To manage the lifecycle of your application on Kubernetes using Ansible, you
27+
can use the link:https://docs.ansible.com/ansible/2.7/modules/k8s_module.html[`k8s` Ansible module].
28+
This Ansible module allows a developer to either leverage their existing
29+
Kubernetes resource files (written in YAML) or express the lifecycle management
30+
in native Ansible.
31+
32+
One of the biggest benefits of using Ansible in conjunction with existing
33+
Kubernetes resource files is the ability to use Jinja templating so that you can
34+
customize resources with the simplicity of a few variables in Ansible.
35+
36+
This section goes into detail on usage of the `k8s` Ansible module. To get
37+
started, install the module on your local workstation and test it using a
38+
playbook before moving on to using it within an Operator.
39+
40+
include::modules/osdk-ansible-k8s-module-installing.adoc[leveloffset=+2]
41+
include::modules/osdk-ansible-k8s-module-testing-locally.adoc[leveloffset=+2]
42+
include::modules/osdk-ansible-k8s-module-inside-operator.adoc[leveloffset=+2]
43+
44+
include::modules/osdk-ansible-managing-cr-status.adoc[leveloffset=+1]
45+
46+
[id='osdk-ansible-addtl-resources']
47+
== Additional resources
48+
49+
- See
50+
xref:../applications_and_projects/operators/operators-appendices.adoc#olm-operator-project-scaffolding-layout_operator-appendices[Appendices]
51+
to learn about the project directory structures created by the Operator SDK.
52+
- link:https://blog.openshift.com/reaching-for-the-stars-with-ansible-operator/[Reaching for the Stars with Ansible Operator] - Red Hat OpenShift Blog

applications_and_projects/operators/osdk-getting-started.adoc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,19 @@ accomplished using two centerpieces of the Operator Framework: the Operator SDK
1515
Operator Lifecycle Manager (OLM).
1616

1717
include::modules/osdk-operator-sdk.adoc[leveloffset=+1]
18-
include::modules/installing-operator-sdk-cli.adoc[leveloffset=+1]
18+
include::modules/osdk-installing-cli.adoc[leveloffset=+1]
1919
include::modules/building-memcached-operator-using-osdk.adoc[leveloffset=+1]
20-
.Additional resources
20+
include::modules/managing-memcached-operator-using-olm.adoc[leveloffset=+1]
21+
22+
[id='osdk-getting-started-addtl-resources']
23+
== Additional resources
24+
2125
- See
2226
xref:../applications_and_projects/operators/operators-appendices.adoc#olm-operator-project-scaffolding-layout_operator-appendices[Appendices]
2327
to learn about the project directory structures created by the Operator SDK.
2428

25-
include::modules/managing-memcached-operator-using-olm.adoc[leveloffset=+1]
26-
2729
ifdef::openshift-origin[]
30+
[id='osdk-getting-started-getting-involved']
2831
== Getting involved
2932

3033
This guide provides an effective demonstration of the value of the Operator

applications_and_projects/operators/osdk-helm.adoc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ authors through an example of building and running an Nginx Operator with the
1212
`operator-sdk` CLI tool that uses an existing Helm chart.
1313

1414
include::modules/osdk-helm-chart-support.adoc[leveloffset=+1]
15+
include::modules/osdk-installing-cli.adoc[leveloffset=+1]
16+
include::modules/osdk-building-helm-operator.adoc[leveloffset=+1]
1517

16-
See the following sections for instructions on installing the Operator SDK to
17-
build and run your own Helm-based Operator.
18+
[id='osdk-helm-addtl-resources']
19+
== Additional resources
1820

19-
include::modules/installing-operator-sdk-cli.adoc[leveloffset=+1]
20-
include::modules/building-operator-with-helm-using-osdk.adoc[leveloffset=+1]
21+
- See
22+
xref:../applications_and_projects/operators/operators-appendices.adoc#olm-operator-project-scaffolding-layout_operator-appendices[Appendices]
23+
to learn about the project directory structures created by the Operator SDK.

modules/crd-creating-custom-resources-from-file.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ spec: <5>
3636
image: my-awesome-cron-image
3737
----
3838
+
39-
<1> Specify the group name and API version (name/version) from the custom resource definition.
39+
<1> Specify the group name and API version (name/version) from the Custom Resource Definition.
4040
<2> Specify the type in the CRD.
4141
<3> Specify a name for the object.
4242
<4> Specify the

modules/crd-custom-resource-definitions.adoc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ available to all users.
3737

3838
[NOTE]
3939
====
40-
While only cluster administrators can create CRDs, developers can create the
41-
custom resource from an existing CRD if they have read and write permission to
42-
it.
40+
While only cluster administrators can create CRDs, developers can create the CR
41+
from an existing CRD if they have read and write permission to it.
4342
====

modules/node-management.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ configuration for nodes.
4343
The `bootkube` process calls the `machine-config-server` component when the
4444
{product-title} installer bootstraps the initial master node. After installation,
4545
the `machine-config-server` runs in the cluster. It reads the `machine-config`
46-
custom resource definitions (CRDs) and serves the required Ignition configurations
46+
Custom Resource Definitions (CRDs) and serves the required Ignition configurations
4747
to new nodes when they join the cluster.
4848
////
4949

modules/nodes-pods-disabling-features-list.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ see the link:https://github.com/kubernetes/community/blob/master/contributors/de
4242
See Extending the Kubernetes API with Custom Resources.
4343

4444
| *CustomResourceValidation*
45-
| Enables schema-based validation on resources created from a custom resource definition.
45+
| Enables schema-based validation on resources created from a Custom Resource Definition.
4646
For more information, see Extending the Kubernetes API with Custom Resources.
4747

4848
| *Debugcontainers*

modules/nodes-pods-secrets-creating-opaque.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ data:
2626
----
2727
<1> Specifies an opaque secret.
2828

29-
. Use the following command command to create a secret object:
29+
. Use the following command to create a secret object:
3030
+
3131
[source,bash]
3232
----

modules/olm-operator-project-staffolding-layout.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ command contain the following directories and files:
2222

2323
|`cmd/`
2424
|Contains `manager/main.go` file, which is the main program of the Operator. This
25-
instantiates a new manager which registers all custom resource definitions under
25+
instantiates a new manager which registers all Custom Resource Definitions under
2626
`pkg/apis/` and starts all controllers under `pkg/controllers/`.
2727

2828
|`pkg/apis/`

0 commit comments

Comments
 (0)