mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
58 lines
1.3 KiB
Plaintext
58 lines
1.3 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * operators/operator_sdk/java/osdk-java-tutorial.adoc
|
|
|
|
:_content-type: PROCEDURE
|
|
[id="osdk-java-create-api-controller_{context}"]
|
|
= Creating an API and controller
|
|
|
|
Use the Operator SDK CLI to create a custom resource definition (CRD) API and controller.
|
|
|
|
.Procedure
|
|
|
|
. Run the following command to create an API:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ operator-sdk create api \
|
|
--plugins=quarkus \ <1>
|
|
--group=cache \ <2>
|
|
--version=v1 \ <3>
|
|
--kind=Memcached <4>
|
|
----
|
|
<1> Set the plug-in flag to `quarkus`.
|
|
<2> Set the group flag to `cache`.
|
|
<3> Set the version flag to `v1`.
|
|
<4> Set the kind flag to `Memcached`.
|
|
|
|
.Verification
|
|
|
|
. Run the `tree` command to view the file structure:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ tree
|
|
----
|
|
+
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
.
|
|
├── Makefile
|
|
├── PROJECT
|
|
├── pom.xml
|
|
└── src
|
|
└── main
|
|
├── java
|
|
│ └── com
|
|
│ └── example
|
|
│ ├── Memcached.java
|
|
│ ├── MemcachedReconciler.java
|
|
│ ├── MemcachedSpec.java
|
|
│ └── MemcachedStatus.java
|
|
└── resources
|
|
└── application.properties
|
|
|
|
6 directories, 8 files
|
|
----
|