From 0fdccdfddf1bb0b2063e33371bf9097244e19a97 Mon Sep 17 00:00:00 2001 From: Alex Dellapenta Date: Tue, 3 Dec 2024 15:45:27 -0700 Subject: [PATCH] Rm Hybrid Helm & Java Operators from OSDK docs --- _topic_maps/_topic_map.yml | 15 -- _topic_maps/_topic_map_osd.yml | 15 -- _topic_maps/_topic_map_rosa.yml | 15 -- .../osdk-updating-v125-to-v128.adoc | 23 +-- modules/osdk-bundle-operator.adoc | 1 - modules/osdk-common-prereqs.adoc | 19 --- modules/osdk-create-project.adoc | 21 --- modules/osdk-deploy-olm.adoc | 6 - modules/osdk-hh-create-cr.adoc | 157 ----------------- modules/osdk-hh-create-go-api.adoc | 36 ---- modules/osdk-hh-create-helm-api.adoc | 34 ---- modules/osdk-hh-create-project.adoc | 38 ----- modules/osdk-hh-defining-go-api.adoc | 66 ------- modules/osdk-hh-helm-api-logic.adoc | 23 --- modules/osdk-hh-helm-reconciler.adoc | 38 ----- modules/osdk-hh-implement-controller.adoc | 13 -- modules/osdk-hh-main-go.adoc | 79 --------- modules/osdk-hh-project-layout.adoc | 65 ------- modules/osdk-hh-rbac.adoc | 132 -------------- ...osdk-java-controller-labels-memcached.adoc | 19 --- ...-java-controller-memcached-deployment.adoc | 49 ------ .../osdk-java-controller-reconcile-loop.adoc | 74 -------- modules/osdk-java-create-api-controller.adoc | 57 ------- modules/osdk-java-create-cr.adoc | 23 --- modules/osdk-java-define-api.adoc | 70 -------- modules/osdk-java-generate-crd.adoc | 66 ------- modules/osdk-java-implement-controller.adoc | 161 ------------------ modules/osdk-java-project-layout.adoc | 37 ---- modules/osdk-project-file.adoc | 20 --- modules/osdk-quickstart.adoc | 33 ---- modules/osdk-run-deployment.adoc | 99 ----------- modules/osdk-run-locally.adoc | 108 +----------- modules/osdk-run-operator.adoc | 7 - modules/osdk-updating-128-to-131.adoc | 20 +-- modules/osdk-updating-131-to-1361.adoc | 22 +-- operators/index.adoc | 3 +- .../osdk-hybrid-helm-updating-projects.adoc | 24 --- .../operator_sdk/helm/osdk-hybrid-helm.adoc | 72 -------- operators/operator_sdk/java/_attributes | 1 - operators/operator_sdk/java/images | 1 - operators/operator_sdk/java/modules | 1 - .../java/osdk-java-project-layout.adoc | 15 -- .../java/osdk-java-quickstart.adoc | 29 ---- .../operator_sdk/java/osdk-java-tutorial.adoc | 87 ---------- .../java/osdk-java-updating-projects.adoc | 21 --- operators/operator_sdk/java/snippets | 1 - snippets/osdk-deprecation.adoc | 6 - 47 files changed, 9 insertions(+), 1913 deletions(-) delete mode 100644 modules/osdk-hh-create-cr.adoc delete mode 100644 modules/osdk-hh-create-go-api.adoc delete mode 100644 modules/osdk-hh-create-helm-api.adoc delete mode 100644 modules/osdk-hh-create-project.adoc delete mode 100644 modules/osdk-hh-defining-go-api.adoc delete mode 100644 modules/osdk-hh-helm-api-logic.adoc delete mode 100644 modules/osdk-hh-helm-reconciler.adoc delete mode 100644 modules/osdk-hh-implement-controller.adoc delete mode 100644 modules/osdk-hh-main-go.adoc delete mode 100644 modules/osdk-hh-project-layout.adoc delete mode 100644 modules/osdk-hh-rbac.adoc delete mode 100644 modules/osdk-java-controller-labels-memcached.adoc delete mode 100644 modules/osdk-java-controller-memcached-deployment.adoc delete mode 100644 modules/osdk-java-controller-reconcile-loop.adoc delete mode 100644 modules/osdk-java-create-api-controller.adoc delete mode 100644 modules/osdk-java-create-cr.adoc delete mode 100644 modules/osdk-java-define-api.adoc delete mode 100644 modules/osdk-java-generate-crd.adoc delete mode 100644 modules/osdk-java-implement-controller.adoc delete mode 100644 modules/osdk-java-project-layout.adoc delete mode 100644 operators/operator_sdk/helm/osdk-hybrid-helm-updating-projects.adoc delete mode 100644 operators/operator_sdk/helm/osdk-hybrid-helm.adoc delete mode 120000 operators/operator_sdk/java/_attributes delete mode 120000 operators/operator_sdk/java/images delete mode 120000 operators/operator_sdk/java/modules delete mode 100644 operators/operator_sdk/java/osdk-java-project-layout.adoc delete mode 100644 operators/operator_sdk/java/osdk-java-quickstart.adoc delete mode 100644 operators/operator_sdk/java/osdk-java-tutorial.adoc delete mode 100644 operators/operator_sdk/java/osdk-java-updating-projects.adoc delete mode 120000 operators/operator_sdk/java/snippets diff --git a/_topic_maps/_topic_map.yml b/_topic_maps/_topic_map.yml index 939fd0e1cb..27153f2fa3 100644 --- a/_topic_maps/_topic_map.yml +++ b/_topic_maps/_topic_map.yml @@ -2008,21 +2008,6 @@ Topics: File: osdk-helm-updating-projects - Name: Helm support File: osdk-helm-support - - Name: Hybrid Helm Operator - File: osdk-hybrid-helm - - Name: Updating Hybrid Helm-based projects - File: osdk-hybrid-helm-updating-projects - - Name: Java-based Operators - Dir: java - Topics: - - Name: Getting started - File: osdk-java-quickstart - - Name: Tutorial - File: osdk-java-tutorial - - Name: Project layout - File: osdk-java-project-layout - - Name: Updating Java-based projects - File: osdk-java-updating-projects - Name: Defining cluster service versions (CSVs) File: osdk-generating-csvs - Name: Working with bundle images diff --git a/_topic_maps/_topic_map_osd.yml b/_topic_maps/_topic_map_osd.yml index d610d4f33a..35eda57f37 100644 --- a/_topic_maps/_topic_map_osd.yml +++ b/_topic_maps/_topic_map_osd.yml @@ -779,21 +779,6 @@ Topics: File: osdk-helm-updating-projects - Name: Helm support File: osdk-helm-support -# - Name: Hybrid Helm Operator <= Tech Preview -# File: osdk-hybrid-helm -# - Name: Updating Hybrid Helm-based projects <= Tech Preview -# File: osdk-hybrid-helm-updating-projects -# - Name: Java-based Operators <= Tech Preview -# Dir: java -# Topics: -# - Name: Getting started -# File: osdk-java-quickstart -# - Name: Tutorial -# File: osdk-java-tutorial -# - Name: Project layout -# File: osdk-java-project-layout -# - Name: Updating Java-based projects -# File: osdk-java-updating-projects - Name: Defining cluster service versions (CSVs) File: osdk-generating-csvs - Name: Working with bundle images diff --git a/_topic_maps/_topic_map_rosa.yml b/_topic_maps/_topic_map_rosa.yml index 9b9596b1c1..8cc0aaeef5 100644 --- a/_topic_maps/_topic_map_rosa.yml +++ b/_topic_maps/_topic_map_rosa.yml @@ -1023,21 +1023,6 @@ Topics: File: osdk-helm-updating-projects - Name: Helm support File: osdk-helm-support -# - Name: Hybrid Helm Operator <= Tech Preview -# File: osdk-hybrid-helm -# - Name: Updating Hybrid Helm-based projects <= Tech Preview -# File: osdk-hybrid-helm-updating-projects -# - Name: Java-based Operators <= Tech Preview -# Dir: java -# Topics: -# - Name: Getting started -# File: osdk-java-quickstart -# - Name: Tutorial -# File: osdk-java-tutorial -# - Name: Project layout -# File: osdk-java-project-layout -# - Name: Updating Java-based projects -# File: osdk-java-updating-projects - Name: Defining cluster service versions (CSVs) File: osdk-generating-csvs - Name: Working with bundle images diff --git a/_unused_topics/osdk-updating-v125-to-v128.adoc b/_unused_topics/osdk-updating-v125-to-v128.adoc index 1ee8e317e2..1bbbe0a635 100644 --- a/_unused_topics/osdk-updating-v125-to-v128.adoc +++ b/_unused_topics/osdk-updating-v125-to-v128.adoc @@ -3,8 +3,7 @@ // * operators/operator_sdk/golang/osdk-golang-updating-projects.adoc // * operators/operator_sdk/ansible/osdk-ansible-updating-projects.adoc // * operators/operator_sdk/helm/osdk-helm-updating-projects.adoc -// * operators/operator_sdk/helm/osdk-hybrid-helm-updating-projects.adoc -// * operators/operator_sdk/java/osdk-java-updating-projects.adoc +// * operators/operator_sdk/helm/ ifeval::["{context}" == "osdk-golang-updating-projects"] :golang: @@ -18,14 +17,6 @@ ifeval::["{context}" == "osdk-helm-updating-projects"] :helm: :type: Helm endif::[] -ifeval::["{context}" == "osdk-hybrid-helm-updating-projects"] -:hybrid: -:type: Hybrid Helm -endif::[] -ifeval::["{context}" == "osdk-java-updating-projects"] -:java: -:type: Java -endif::[] :_mod-docs-content-type: PROCEDURE [id="osdk-upgrading-projects_{context}"] @@ -40,7 +31,7 @@ The following procedure updates an existing {type}-based Operator project for co .Procedure -ifdef::helm,hybrid,java[] +ifdef::helm[] * Find the `ose-kube-rbac-proxy` pull spec in the following files, and update the image tag to `v4.14`: endif::[] ifdef::ansible,golang[] @@ -136,12 +127,4 @@ endif::[] ifeval::["{context}" == "osdk-helm-updating-projects"] :!helm: :!type: -endif::[] -ifeval::["{context}" == "osdk-hybrid-helm-updating-projects"] -:!hybrid: -:!type: -endif::[] -ifeval::["{context}" == "osdk-java-updating-projects"] -:!java: -:!type: -endif::[] +endif::[] \ No newline at end of file diff --git a/modules/osdk-bundle-operator.adoc b/modules/osdk-bundle-operator.adoc index 15fdada31c..d27dbcdfdd 100644 --- a/modules/osdk-bundle-operator.adoc +++ b/modules/osdk-bundle-operator.adoc @@ -1,7 +1,6 @@ // Module included in the following assemblies: // // * operators/operator_sdk/golang/osdk-golang-tutorial.adoc -// * operators/operator_sdk/java/osdk-java-tutorial.adoc // * operators/operator_sdk/ansible/osdk-ansible-tutorial.adoc // * operators/operator_sdk/helm/osdk-helm-tutorial.adoc // * operators/operator_sdk/osdk-working-bundle-images.adoc diff --git a/modules/osdk-common-prereqs.adoc b/modules/osdk-common-prereqs.adoc index ddb14007af..a02d83933e 100644 --- a/modules/osdk-common-prereqs.adoc +++ b/modules/osdk-common-prereqs.adoc @@ -6,10 +6,7 @@ // * operators/operator_sdk/ansible/osdk-ansible-tutorial.adoc // * operators/operator_sdk/helm/osdk-helm-quickstart.adoc // * operators/operator_sdk/helm/osdk-helm-tutorial.adoc -// * operators/operator_sdk/helm/osdk-hybrid-helm.adoc // * operators/operator_sdk/osdk-working-bundle-images.adoc -// * operators/operator_sdk/java/osdk-java-quickstart.adoc -// * operators/operator_sdk/java/osdk-java-tutorial.adoc ifeval::["{context}" == "osdk-ansible-quickstart"] :ansible: @@ -23,12 +20,6 @@ endif::[] ifeval::["{context}" == "osdk-golang-tutorial"] :golang: endif::[] -ifeval::["{context}" == "osdk-java-quickstart"] -:java: -endif::[] -ifeval::["{context}" == "osdk-java-tutorial"] -:java: -endif::[] [id="osdk-common-prereqs_{context}"] = Prerequisites @@ -45,10 +36,6 @@ ifdef::ansible[] * link:https://www.python.org/downloads/[Python] 3.9+ * link:https://pypi.org/project/kubernetes/[Python Kubernetes client] endif::[] -ifdef::java[] -* link:https://java.com/en/download/help/download_options.html[Java] 11+ -* link:https://maven.apache.org/install.html[Maven] 3.6.3+ -endif::[] ifndef::openshift-dedicated,openshift-rosa[] * Logged into an {product-title} {product-version} cluster with `oc` with an account that has `cluster-admin` permissions endif::openshift-dedicated,openshift-rosa[] @@ -69,9 +56,3 @@ endif::[] ifeval::["{context}" == "osdk-golang-tutorial"] :!golang: endif::[] -ifeval::["{context}" == "osdk-java-quickstart"] -:!java: -endif::[] -ifeval::["{context}" == "osdk-java-tutorial"] -:!java: -endif::[] diff --git a/modules/osdk-create-project.adoc b/modules/osdk-create-project.adoc index b2fec6c03c..cbff19fe7a 100644 --- a/modules/osdk-create-project.adoc +++ b/modules/osdk-create-project.adoc @@ -19,11 +19,6 @@ ifeval::["{context}" == "osdk-helm-tutorial"] :type: Helm :app: nginx endif::[] -ifeval::["{context}" == "osdk-java-tutorial"] -:java: -:type: Java -:app: memcached -endif::[] :_mod-docs-content-type: PROCEDURE [id="osdk-create-project_{context}"] @@ -63,9 +58,6 @@ endif::[] ifdef::helm[] with the `helm` plugin endif::[] -ifdef::java[] -with the `quarkus` plugin -endif::[] to initialize the project: + [source,terminal,subs="attributes+"] @@ -109,14 +101,6 @@ The `init` command creates the `nginx-operator` project specifically for watchin . For Helm-based projects, the `init` command generates the RBAC rules in the `config/rbac/role.yaml` file based on the resources that would be deployed by the default manifest for the chart. Verify that the rules generated in this file meet the permission requirements of the Operator. endif::[] -ifdef::java[] ----- -$ operator-sdk init \ - --plugins=quarkus \ - --domain=example.com \ - --project-name=memcached-operator ----- -endif::[] ifeval::["{context}" == "osdk-golang-tutorial"] :!golang: @@ -133,8 +117,3 @@ ifeval::["{context}" == "osdk-helm-tutorial"] :!type: :!app: endif::[] -ifeval::["{context}" == "osdk-java-tutorial"] -:!java: -:!type: -:!app: -endif::[] \ No newline at end of file diff --git a/modules/osdk-deploy-olm.adoc b/modules/osdk-deploy-olm.adoc index ee5084d5bf..9fb528129f 100644 --- a/modules/osdk-deploy-olm.adoc +++ b/modules/osdk-deploy-olm.adoc @@ -11,9 +11,6 @@ endif::[] ifeval::["{context}" == "osdk-working-bundle-images"] :golang: endif::[] -ifeval::["{context}" == "osdk-java-tutorial"] -:java: -endif::[] :_mod-docs-content-type: PROCEDURE [id="osdk-deploy-olm_{context}"] @@ -70,7 +67,4 @@ ifeval::["{context}" == "osdk-golang-tutorial"] endif::[] ifeval::["{context}" == "osdk-working-bundle-images"] :!golang: -endif::[] -ifeval::["{context}" == "osdk-java-tutorial"] -:!java: endif::[] \ No newline at end of file diff --git a/modules/osdk-hh-create-cr.adoc b/modules/osdk-hh-create-cr.adoc deleted file mode 100644 index 6e2706bfc7..0000000000 --- a/modules/osdk-hh-create-cr.adoc +++ /dev/null @@ -1,157 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/helm/osdk-hybrid-helm.adoc - -:_mod-docs-content-type: PROCEDURE -[id="osdk-hh-create-cr_{context}"] -= Creating custom resources - -After your Operator is installed, you can test it by creating custom resources (CRs) that are now provided on the cluster by the Operator. - -.Procedure - -. Change to the namespace where your Operator is installed: -+ -[source,terminal] ----- -$ oc project -system ----- - -. Update the sample `Memcached` CR manifest at the `config/samples/cache_v1_memcached.yaml` file by updating the `replicaCount` field to `3`: -+ -.Example `config/samples/cache_v1_memcached.yaml` file -[%collapsible] -==== -[source,yaml] ----- -apiVersion: cache.my.domain/v1 -kind: Memcached -metadata: - name: memcached-sample -spec: - # Default values copied from /helm-charts/memcached/values.yaml - affinity: {} - autoscaling: - enabled: false - maxReplicas: 100 - minReplicas: 1 - targetCPUUtilizationPercentage: 80 - fullnameOverride: "" - image: - pullPolicy: IfNotPresent - repository: nginx - tag: "" - imagePullSecrets: [] - ingress: - annotations: {} - className: "" - enabled: false - hosts: - - host: chart-example.local - paths: - - path: / - pathType: ImplementationSpecific - tls: [] - nameOverride: "" - nodeSelector: {} - podAnnotations: {} - podSecurityContext: {} - replicaCount: 3 - resources: {} - securityContext: {} - service: - port: 80 - type: ClusterIP - serviceAccount: - annotations: {} - create: true - name: "" - tolerations: [] ----- -==== - -. Create the `Memcached` CR: -+ -[source,terminal] ----- -$ oc apply -f config/samples/cache_v1_memcached.yaml ----- - -. Ensure that the Memcached Operator creates the deployment for the sample CR with the correct size: -+ -[source,terminal] ----- -$ oc get pods ----- -+ -.Example output -[source,terminal] ----- -NAME READY STATUS RESTARTS AGE -memcached-sample-6fd7c98d8-7dqdr 1/1 Running 0 18m -memcached-sample-6fd7c98d8-g5k7v 1/1 Running 0 18m -memcached-sample-6fd7c98d8-m7vn7 1/1 Running 0 18m ----- - -. Update the sample `MemcachedBackup` CR manifest at the `config/samples/cache_v1_memcachedbackup.yaml` file by updating the `size` to `2`: -+ -.Example `config/samples/cache_v1_memcachedbackup.yaml` file -[%collapsible] -==== -[source,yaml] ----- -apiVersion: cache.my.domain/v1 -kind: MemcachedBackup -metadata: - name: memcachedbackup-sample -spec: - size: 2 ----- -==== - -. Create the `MemcachedBackup` CR: -+ -[source,terminal] ----- -$ oc apply -f config/samples/cache_v1_memcachedbackup.yaml ----- - -. Ensure that the count of `memcachedbackup` pods is the same as specified in the CR: -+ -[source,terminal] ----- -$ oc get pods ----- -+ -.Example output -[source,terminal] ----- -NAME READY STATUS RESTARTS AGE -memcachedbackup-sample-8649699989-4bbzg 1/1 Running 0 22m -memcachedbackup-sample-8649699989-mq6mx 1/1 Running 0 22m ----- - -. You can update the `spec` in each of the above CRs, and then apply them again. The controller reconciles again and ensures that the size of the pods is as specified in the `spec` of the respective CRs. - -. Clean up the resources that have been created as part of this tutorial: - -.. Delete the `Memcached` resource: -+ -[source,terminal] ----- -$ oc delete -f config/samples/cache_v1_memcached.yaml ----- - -.. Delete the `MemcachedBackup` resource: -+ -[source,terminal] ----- -$ oc delete -f config/samples/cache_v1_memcachedbackup.yaml ----- - -.. If you used the `make deploy` command to test the Operator, run the following command: -+ -[source,terminal] ----- -$ make undeploy ----- diff --git a/modules/osdk-hh-create-go-api.adoc b/modules/osdk-hh-create-go-api.adoc deleted file mode 100644 index e09f106a62..0000000000 --- a/modules/osdk-hh-create-go-api.adoc +++ /dev/null @@ -1,36 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/helm/osdk-hybrid-helm.adoc - -:_mod-docs-content-type: PROCEDURE -[id="osdk-hh-create-go-api_{context}"] -= Creating a Go API - -Use the Operator SDK CLI to create a Go API. - -.Procedure - -. Run the following command to create a Go API with group `cache`, version `v1`, and kind `MemcachedBackup`: -+ -[source,terminal] ----- -$ operator-sdk create api \ - --group=cache \ - --version v1 \ - --kind MemcachedBackup \ - --resource \ - --controller \ - --plugins=go/v4 ----- - -. When prompted, enter `y` for creating both resource and controller: -+ -[source,terminal] ----- -$ Create Resource [y/n] -y -Create Controller [y/n] -y ----- - -This procedure generates the `MemcachedBackup` resource API at `api/v1/memcachedbackup_types.go` and the controller at `controllers/memcachedbackup_controller.go`. diff --git a/modules/osdk-hh-create-helm-api.adoc b/modules/osdk-hh-create-helm-api.adoc deleted file mode 100644 index 776299bbf3..0000000000 --- a/modules/osdk-hh-create-helm-api.adoc +++ /dev/null @@ -1,34 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/helm/osdk-hybrid-helm.adoc - -:_mod-docs-content-type: PROCEDURE -[id="osdk-hh-create-helm-api_{context}"] -= Creating a Helm API - -Use the Operator SDK CLI to create a Helm API. - -.Procedure - -* Run the following command to create a Helm API with group `cache`, version `v1`, and kind `Memcached`: -+ -[source,terminal] ----- -$ operator-sdk create api \ - --plugins helm.sdk.operatorframework.io/v1 \ - --group cache \ - --version v1 \ - --kind Memcached ----- - -[NOTE] -==== -This procedure also configures your Operator project to watch the `Memcached` resource with API version `v1` and scaffolds a boilerplate Helm chart. Instead of creating the project from the boilerplate Helm chart scaffolded by the Operator SDK, you can alternatively use an existing chart from your local file system or remote chart repository. - -For more details and examples for creating Helm API based on existing or new charts, run the following command: - -[source,terminal] ----- -$ operator-sdk create api --plugins helm.sdk.operatorframework.io/v1 --help ----- -==== diff --git a/modules/osdk-hh-create-project.adoc b/modules/osdk-hh-create-project.adoc deleted file mode 100644 index d3541e2a58..0000000000 --- a/modules/osdk-hh-create-project.adoc +++ /dev/null @@ -1,38 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/helm/osdk-hybrid-helm.adoc - -:_mod-docs-content-type: PROCEDURE -[id="osdk-hh-create-project_{context}"] -= Creating a project - -Use the Operator SDK CLI to create a project called `memcached-operator`. - -.Procedure - -. Create a directory for the project: -+ -[source,terminal] ----- -$ mkdir -p $HOME/github.com/example/memcached-operator ----- - -. Change to the directory: -+ -[source,terminal] ----- -$ cd $HOME/github.com/example/memcached-operator ----- - -. Run the `operator-sdk init` command to initialize the project. This example uses a domain of `my.domain` so that all API groups are `.my.domain`: -+ -[source,terminal] ----- -$ operator-sdk init \ - --plugins=hybrid.helm.sdk.operatorframework.io \ - --project-version="3" \ - --domain my.domain \ - --repo=github.com/example/memcached-operator ----- -+ -The `init` command generates the RBAC rules in the `config/rbac/role.yaml` file based on the resources that would be deployed by the chart's default manifests. Verify that the rules generated in the `config/rbac/role.yaml` file meet your Operator's permission requirements. diff --git a/modules/osdk-hh-defining-go-api.adoc b/modules/osdk-hh-defining-go-api.adoc deleted file mode 100644 index ff50be3741..0000000000 --- a/modules/osdk-hh-defining-go-api.adoc +++ /dev/null @@ -1,66 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/helm/osdk-hybrid-helm.adoc - -:_mod-docs-content-type: PROCEDURE -[id="osdk-hh-defining-go-api_{context}"] -= Defining the API - -Define the API for the `MemcachedBackup` custom resource (CR). - -Represent this Go API by defining the `MemcachedBackup` type, which will have a `MemcachedBackupSpec.Size` field to set the quantity of Memcached backup instances (CRs) to be deployed, and a `MemcachedBackupStatus.Nodes` field to store a CR's pod names. - -[NOTE] -==== -The `Node` field is used to illustrate an example of a `Status` field. -==== - -.Procedure - -. Define the API for the `MemcachedBackup` CR by modifying the Go type definitions in the `api/v1/memcachedbackup_types.go` file to have the following `spec` and `status`: -+ -.Example `api/v1/memcachedbackup_types.go` file -[%collapsible] -==== -[source,golang] ----- -// MemcachedBackupSpec defines the desired state of MemcachedBackup -type MemcachedBackupSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file - - //+kubebuilder:validation:Minimum=0 - // Size is the size of the memcached deployment - Size int32 `json:"size"` -} - -// MemcachedBackupStatus defines the observed state of MemcachedBackup -type MemcachedBackupStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file - // Nodes are the names of the memcached pods - Nodes []string `json:"nodes"` -} ----- -==== - -. Update the generated code for the resource type: -+ -[source,terminal] ----- -$ make generate ----- -+ -[TIP] -==== -After you modify a `*_types.go` file, you must run the `make generate` command to update the generated code for that resource type. -==== - -. After the API is defined with `spec` and `status` fields and CRD validation markers, generate and update the CRD manifests: -+ -[source,terminal] ----- -$ make manifests ----- - -This Makefile target invokes the `controller-gen` utility to generate the CRD manifests in the `config/crd/bases/cache.my.domain_memcachedbackups.yaml` file. diff --git a/modules/osdk-hh-helm-api-logic.adoc b/modules/osdk-hh-helm-api-logic.adoc deleted file mode 100644 index cfa3f703b6..0000000000 --- a/modules/osdk-hh-helm-api-logic.adoc +++ /dev/null @@ -1,23 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/helm/osdk-hybrid-helm.adoc - -:_mod-docs-content-type: CONCEPT -[id="osdk-hh-helm-api-logic_{context}"] -= Operator logic for the Helm API - -By default, your scaffolded Operator project watches `Memcached` resource events as shown in the `watches.yaml` file and executes Helm releases using the specified chart. - -.Example `watches.yaml` file -[%collapsible] -==== -[source,yaml] ----- -# Use the 'create api' subcommand to add watches to this file. -- group: cache.my.domain - version: v1 - kind: Memcached - chart: helm-charts/memcached -#+kubebuilder:scaffold:watch ----- -==== diff --git a/modules/osdk-hh-helm-reconciler.adoc b/modules/osdk-hh-helm-reconciler.adoc deleted file mode 100644 index c637f0f15f..0000000000 --- a/modules/osdk-hh-helm-reconciler.adoc +++ /dev/null @@ -1,38 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/helm/osdk-hybrid-helm.adoc - -:_mod-docs-content-type: CONCEPT -[id="osdk-hh-helm-reconciler_{context}"] -= Custom Helm reconciler configurations using provided library APIs - -A disadvantage of existing Helm-based Operators is the inability to configure the Helm reconciler, because it is abstracted from users. For a Helm-based Operator to reach the Seamless Upgrades capability (level II and later) that reuses an already existing Helm chart, a hybrid between the Go and Helm Operator types adds value. - -The APIs provided in the link:https://github.com/operator-framework/helm-operator-plugins[`helm-operator-plugins`] library allow Operator authors to make the following configurations: - -* Customize value mapping based on cluster state -* Execute code in specific events by configuring the reconciler's event recorder -* Customize the reconciler's logger -* Setup `Install`, `Upgrade`, and `Uninstall` annotations to enable Helm's actions to be configured based on the annotations found in custom resources watched by the reconciler -* Configure the reconciler to run with `Pre` and `Post` hooks - -The above configurations to the reconciler can be done in the `main.go` file: - -[%collapsible] -==== -.Example `main.go` file -[source,golang] ----- -// Operator's main.go -// With the help of helpers provided in the library, the reconciler can be -// configured here before starting the controller with this reconciler. -reconciler := reconciler.New( - reconciler.WithChart(*chart), - reconciler.WithGroupVersionKind(gvk), -) - -if err := reconciler.SetupWithManager(mgr); err != nil { - panic(fmt.Sprintf("unable to create reconciler: %s", err)) -} ----- -==== diff --git a/modules/osdk-hh-implement-controller.adoc b/modules/osdk-hh-implement-controller.adoc deleted file mode 100644 index e025d59757..0000000000 --- a/modules/osdk-hh-implement-controller.adoc +++ /dev/null @@ -1,13 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/helm/osdk-hybrid-helm.adoc - -:_mod-docs-content-type: CONCEPT -[id="osdk-hh-implement-controller_{context}"] -= Controller implementation - -The controller in this tutorial performs the following actions: - -* Create a `Memcached` deployment if it does not exist. -* Ensure that the deployment size is the same as specified by the `Memcached` CR spec. -* Update the `Memcached` CR status with the names of the `memcached` pods. diff --git a/modules/osdk-hh-main-go.adoc b/modules/osdk-hh-main-go.adoc deleted file mode 100644 index 727c0a3cb4..0000000000 --- a/modules/osdk-hh-main-go.adoc +++ /dev/null @@ -1,79 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/helm/osdk-hybrid-helm.adoc - -:_mod-docs-content-type: CONCEPT -[id="osdk-hh-main-go_{context}"] -= Differences in main.go - -For standard Go-based Operators and the Hybrid Helm Operator, the `main.go` file handles the scaffolding the initialization and running of the link:https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/manager#Manager[`Manager`] program for the Go API. For the Hybrid Helm Operator, however, the `main.go` file also exposes the logic for loading the `watches.yaml` file and configuring the Helm reconciler. - -.Example `main.go` file -[%collapsible] -==== -[source,terminal] ----- -... - for _, w := range ws { - // Register controller with the factory - reconcilePeriod := defaultReconcilePeriod - if w.ReconcilePeriod != nil { - reconcilePeriod = w.ReconcilePeriod.Duration - } - - maxConcurrentReconciles := defaultMaxConcurrentReconciles - if w.MaxConcurrentReconciles != nil { - maxConcurrentReconciles = *w.MaxConcurrentReconciles - } - - r, err := reconciler.New( - reconciler.WithChart(*w.Chart), - reconciler.WithGroupVersionKind(w.GroupVersionKind), - reconciler.WithOverrideValues(w.OverrideValues), - reconciler.SkipDependentWatches(w.WatchDependentResources != nil && !*w.WatchDependentResources), - reconciler.WithMaxConcurrentReconciles(maxConcurrentReconciles), - reconciler.WithReconcilePeriod(reconcilePeriod), - reconciler.WithInstallAnnotations(annotation.DefaultInstallAnnotations...), - reconciler.WithUpgradeAnnotations(annotation.DefaultUpgradeAnnotations...), - reconciler.WithUninstallAnnotations(annotation.DefaultUninstallAnnotations...), - ) -... ----- -==== - -The manager is initialized with both `Helm` and `Go` reconcilers: - -.Example `Helm` and `Go` reconcilers -[%collapsible] -==== -[source,terminal] ----- -... -// Setup manager with Go API - if err = (&controllers.MemcachedBackupReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "MemcachedBackup") - os.Exit(1) - } - - ... -// Setup manager with Helm API - for _, w := range ws { - - ... - if err := r.SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "Helm") - os.Exit(1) - } - setupLog.Info("configured watch", "gvk", w.GroupVersionKind, "chartPath", w.ChartPath, "maxConcurrentReconciles", maxConcurrentReconciles, "reconcilePeriod", reconcilePeriod) - } - -// Start the manager - if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil { - setupLog.Error(err, "problem running manager") - os.Exit(1) - } ----- -==== diff --git a/modules/osdk-hh-project-layout.adoc b/modules/osdk-hh-project-layout.adoc deleted file mode 100644 index d2b37bb865..0000000000 --- a/modules/osdk-hh-project-layout.adoc +++ /dev/null @@ -1,65 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/helm/osdk-hybrid-helm.adoc - -:_mod-docs-content-type: REFERENCE -[id="osdk-hh-project-layout_{context}"] -= Project layout - -The Hybrid Helm Operator scaffolding is customized to be compatible with both Helm and Go APIs. - -[options="header",cols="1a,4a"] -|=== - -|File/folders |Purpose - -|`Dockerfile` -|Instructions used by a container engine to build your Operator image with the `make docker-build` command. - -|`Makefile` -|Build file with helper targets to help you work with your project. - -|`PROJECT` -|YAML file containing metadata information for the Operator. Represents the project's configuration and is used to track useful information for the CLI and plugins. - -|`bin/` -|Contains useful binaries such as the `manager` which is used to run your project locally and the `kustomize` utility used for the project configuration. - -|`config/` -|Contains configuration files, including all link:https://kustomize.io/[Kustomize] manifests, to launch your Operator project on a cluster. Plugins might use it to provide functionality. For example, for the Operator SDK to help create your Operator bundle, the CLI looks up the CRDs and CRs which are scaffolded in this directory. - -`config/crd/`:: Contains custom resource definitions (CRDs). - -`config/default/`:: Contains a Kustomize base for launching the controller in a standard configuration. - -`config/manager/`:: Contains the manifests to launch your Operator project as pods on the cluster. - -`config/manifests/`:: Contains the base to generate your OLM manifests in the `bundle/` directory. - -`config/prometheus/`:: Contains the manifests required to enable project to serve metrics to Prometheus such as the `ServiceMonitor` resource. - -`config/scorecard/`:: Contains the manifests required to allow you test your project with the scorecard tool. - -`config/rbac/`:: Contains the RBAC permissions required to run your project. - -`config/samples/`:: Contains samples for custom resources. - -|`api/` -|Contains the Go API definition. - -|`internal/controllers/` -|Contains the controllers for the Go API. - -|`hack/` -|Contains utility files, such as the file used to scaffold the license header for your project files. - -|`main.go` -|Main program of the Operator. Instantiates a new manager that registers all custom resource definitions (CRDs) in the `apis/` directory and starts all controllers in the `controllers/` directory. - -|`helm-charts/` -|Contains the Helm charts which can be specified using the `create api` command with the Helm plugin. - -|`watches.yaml` -|Contains group/version/kind (GVK) and Helm chart location. Used to configure the Helm watches. - -|=== diff --git a/modules/osdk-hh-rbac.adoc b/modules/osdk-hh-rbac.adoc deleted file mode 100644 index 8fa72d1259..0000000000 --- a/modules/osdk-hh-rbac.adoc +++ /dev/null @@ -1,132 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/helm/osdk-hybrid-helm.adoc - -:_mod-docs-content-type: CONCEPT -[id="osdk-hh-rbac_{context}"] -= Permissions and RBAC manifests - -The controller requires certain role-based access control (RBAC) permissions to interact with the resources it manages. For the Go API, these are specified with RBAC markers, as shown in the Operator SDK tutorial for standard Go-based Operators. - -For the Helm API, the permissions are scaffolded by default in `roles.yaml`. Currently, however, due to a known issue when the Go API is scaffolded, the permissions for the Helm API are overwritten. As a result of this issue, ensure that the permissions defined in `roles.yaml` match your requirements. - -[NOTE] -==== -This known issue is being tracked in link:https://github.com/operator-framework/helm-operator-plugins/issues/142[]. -==== - -The following is an example `role.yaml` for a Memcached Operator: - -.Example `Helm` and `Go` reconcilers -[%collapsible] -==== -[source,yaml] ----- ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: manager-role -rules: -- apiGroups: - - "" - resources: - - namespaces - verbs: - - get -- apiGroups: - - apps - resources: - - deployments - - daemonsets - - replicasets - - statefulsets - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - cache.my.domain - resources: - - memcachedbackups - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - cache.my.domain - resources: - - memcachedbackups/finalizers - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - "" - resources: - - pods - - services - - services/finalizers - - endpoints - - persistentvolumeclaims - - events - - configmaps - - secrets - - serviceaccounts - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - cache.my.domain - resources: - - memcachedbackups/status - verbs: - - get - - patch - - update -- apiGroups: - - policy - resources: - - events - - poddisruptionbudgets - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - cache.my.domain - resources: - - memcacheds - - memcacheds/status - - memcacheds/finalizers - verbs: - - create - - delete - - get - - list - - patch - - update - - watch ----- -==== diff --git a/modules/osdk-java-controller-labels-memcached.adoc b/modules/osdk-java-controller-labels-memcached.adoc deleted file mode 100644 index 2ee93a21ed..0000000000 --- a/modules/osdk-java-controller-labels-memcached.adoc +++ /dev/null @@ -1,19 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/java/osdk-java-tutorial.adoc - -:_mod-docs-content-type: CONCEPT -[id="osdk-java-controller-labels-memcached_{context}"] -= Defining `labelsForMemcached` - -`labelsForMemcached` is a utility to return a map of the labels to attach to the resources: - -[source,java] ----- - private Map labelsForMemcached(Memcached m) { - Map labels = new HashMap<>(); - labels.put("app", "memcached"); - labels.put("memcached_cr", m.getMetadata().getName()); - return labels; - } ----- \ No newline at end of file diff --git a/modules/osdk-java-controller-memcached-deployment.adoc b/modules/osdk-java-controller-memcached-deployment.adoc deleted file mode 100644 index 6f673b16e5..0000000000 --- a/modules/osdk-java-controller-memcached-deployment.adoc +++ /dev/null @@ -1,49 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/java/osdk-java-tutorial.adoc - -:_mod-docs-content-type: CONCEPT -[id="osdk-java-controller-memcached-deployment_{context}"] -= Define the `createMemcachedDeployment` - -The `createMemcachedDeployment` method uses the link:https://fabric8.io/[fabric8] `DeploymentBuilder` class: - -[source,java] ----- - private Deployment createMemcachedDeployment(Memcached m) { - Deployment deployment = new DeploymentBuilder() - .withMetadata( - new ObjectMetaBuilder() - .withName(m.getMetadata().getName()) - .withNamespace(m.getMetadata().getNamespace()) - .build()) - .withSpec( - new DeploymentSpecBuilder() - .withReplicas(m.getSpec().getSize()) - .withSelector( - new LabelSelectorBuilder().withMatchLabels(labelsForMemcached(m)).build()) - .withTemplate( - new PodTemplateSpecBuilder() - .withMetadata( - new ObjectMetaBuilder().withLabels(labelsForMemcached(m)).build()) - .withSpec( - new PodSpecBuilder() - .withContainers( - new ContainerBuilder() - .withImage("memcached:1.4.36-alpine") - .withName("memcached") - .withCommand("memcached", "-m=64", "-o", "modern", "-v") - .withPorts( - new ContainerPortBuilder() - .withContainerPort(11211) - .withName("memcached") - .build()) - .build()) - .build()) - .build()) - .build()) - .build(); - deployment.addOwnerReference(m); - return deployment; - } ----- \ No newline at end of file diff --git a/modules/osdk-java-controller-reconcile-loop.adoc b/modules/osdk-java-controller-reconcile-loop.adoc deleted file mode 100644 index ef4a8f5a45..0000000000 --- a/modules/osdk-java-controller-reconcile-loop.adoc +++ /dev/null @@ -1,74 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/java/osdk-java-tutorial.adoc - -:_mod-docs-content-type: CONCEPT -[id="osdk-java-controller-reconcile-loop_{context}"] -= Reconcile loop - -. Every controller has a reconciler object with a `Reconcile()` method that implements the reconcile loop. The reconcile loop is passed the `Deployment` argument, as shown in the following example: -+ -[source,java] ----- - Deployment deployment = client.apps() - .deployments() - .inNamespace(resource.getMetadata().getNamespace()) - .withName(resource.getMetadata().getName()) - .get(); ----- - -. As shown in the following example, if the `Deployment` is `null`, the deployment needs to be created. After you create the `Deployment`, you can determine if reconciliation is necessary. If there is no need of reconciliation, return the value of `UpdateControl.noUpdate()`, otherwise, return the value of `UpdateControl.updateStatus(resource): -+ -[source, java] ----- - if (deployment == null) { - Deployment newDeployment = createMemcachedDeployment(resource); - client.apps().deployments().create(newDeployment); - return UpdateControl.noUpdate(); - } ----- - -. After getting the `Deployment`, get the current and required replicas, as shown in the following example: -+ -[source,java] ----- - int currentReplicas = deployment.getSpec().getReplicas(); - int requiredReplicas = resource.getSpec().getSize(); ----- - -. If `currentReplicas` does not match the `requiredReplicas`, you must update the `Deployment`, as shown in the following example: -+ -[source,java] ----- - if (currentReplicas != requiredReplicas) { - deployment.getSpec().setReplicas(requiredReplicas); - client.apps().deployments().createOrReplace(deployment); - return UpdateControl.noUpdate(); - } ----- - -. The following example shows how to obtain the list of pods and their names: -+ -[source,java] ----- - List pods = client.pods() - .inNamespace(resource.getMetadata().getNamespace()) - .withLabels(labelsForMemcached(resource)) - .list() - .getItems(); - - List podNames = - pods.stream().map(p -> p.getMetadata().getName()).collect(Collectors.toList()); ----- - -. Check if resources were created and verify podnames with the Memcached resources. If a mismatch exists in either of these conditions, perform a reconciliation as shown in the following example: -+ -[source,java] ----- - if (resource.getStatus() == null - || !CollectionUtils.isEqualCollection(podNames, resource.getStatus().getNodes())) { - if (resource.getStatus() == null) resource.setStatus(new MemcachedStatus()); - resource.getStatus().setNodes(podNames); - return UpdateControl.updateResource(resource); - } ----- \ No newline at end of file diff --git a/modules/osdk-java-create-api-controller.adoc b/modules/osdk-java-create-api-controller.adoc deleted file mode 100644 index 0625932185..0000000000 --- a/modules/osdk-java-create-api-controller.adoc +++ /dev/null @@ -1,57 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/java/osdk-java-tutorial.adoc - -:_mod-docs-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 plugin 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 ----- diff --git a/modules/osdk-java-create-cr.adoc b/modules/osdk-java-create-cr.adoc deleted file mode 100644 index 046050f181..0000000000 --- a/modules/osdk-java-create-cr.adoc +++ /dev/null @@ -1,23 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/java/osdk-java-tutorial.adoc - -:_mod-docs-content-type: PROCEDURE -[id="osdk-java-create-cr_{context}"] -= Creating a Custom Resource - -After generating the CRD manifests, you can create the Custom Resource (CR). - -.Procedure -* Create a Memcached CR called `memcached-sample.yaml`: -+ -[source,yaml] ----- -apiVersion: cache.example.com/v1 -kind: Memcached -metadata: - name: memcached-sample -spec: - # Add spec fields here - size: 1 ----- \ No newline at end of file diff --git a/modules/osdk-java-define-api.adoc b/modules/osdk-java-define-api.adoc deleted file mode 100644 index 5392b6e648..0000000000 --- a/modules/osdk-java-define-api.adoc +++ /dev/null @@ -1,70 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/java/osdk-java-tutorial.adoc - -:_mod-docs-content-type: PROCEDURE -[id="osdk-java-define-api_{context}"] -= Defining the API - -Define the API for the `Memcached` custom resource (CR). - -.Procedure -* Edit the following files that were generated as part of the `create api` process: - -.. Update the following attributes in the `MemcachedSpec.java` file to define the desired state of the `Memcached` CR: -+ -[source,java] ----- -public class MemcachedSpec { - - private Integer size; - - public Integer getSize() { - return size; - } - - public void setSize(Integer size) { - this.size = size; - } -} ----- - -.. Update the following attributes in the `MemcachedStatus.java` file to define the observed state of the `Memcached` CR: -+ -[NOTE] -==== -The example below illustrates a Node status field. It is recommended that you use link:https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties[typical status properties] in practice. -==== -+ -[source,java] ----- -import java.util.ArrayList; -import java.util.List; - -public class MemcachedStatus { - - // Add Status information here - // Nodes are the names of the memcached pods - private List nodes; - - public List getNodes() { - if (nodes == null) { - nodes = new ArrayList<>(); - } - return nodes; - } - - public void setNodes(List nodes) { - this.nodes = nodes; - } -} ----- - -.. Update the `Memcached.java` file to define the Schema for Memcached APIs that extends to both `MemcachedSpec.java` and `MemcachedStatus.java` files. -+ -[source,java] ----- -@Version("v1") -@Group("cache.example.com") -public class Memcached extends CustomResource implements Namespaced {} ----- \ No newline at end of file diff --git a/modules/osdk-java-generate-crd.adoc b/modules/osdk-java-generate-crd.adoc deleted file mode 100644 index 7ae177353f..0000000000 --- a/modules/osdk-java-generate-crd.adoc +++ /dev/null @@ -1,66 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/java/osdk-java-tutorial.adoc - -:_mod-docs-content-type: PROCEDURE -[id="osdk-java-generate-crd_{context}"] -= Generating CRD manifests - -After the API is defined with `MemcachedSpec` and `MemcachedStatus` files, you can generate CRD manifests. - -.Procedure - -* Run the following command from the `memcached-operator` directory to generate the CRD: -+ -[source,terminal] ----- -$ mvn clean install ----- - -.Verification - -* Verify the contents of the CRD in the `target/kubernetes/memcacheds.cache.example.com-v1.yml` file as shown in the following example: -+ -[source,terminal] ----- -$ cat target/kubernetes/memcacheds.cache.example.com-v1.yaml ----- -+ -.Example output -[source,yaml] ----- -# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: memcacheds.cache.example.com -spec: - group: cache.example.com - names: - kind: Memcached - plural: memcacheds - singular: memcached - scope: Namespaced - versions: - - name: v1 - schema: - openAPIV3Schema: - properties: - spec: - properties: - size: - type: integer - type: object - status: - properties: - nodes: - items: - type: string - type: array - type: object - type: object - served: true - storage: true - subresources: - status: {} ----- \ No newline at end of file diff --git a/modules/osdk-java-implement-controller.adoc b/modules/osdk-java-implement-controller.adoc deleted file mode 100644 index be612051ec..0000000000 --- a/modules/osdk-java-implement-controller.adoc +++ /dev/null @@ -1,161 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/java/osdk-java-tutorial.adoc - -:_mod-docs-content-type: PROCEDURE -[id="osdk-java-implement-controller_{context}"] -= Implementing the controller - -After creating a new API and controller, you can implement the controller logic. - -.Procedure - -. Append the following dependency to the `pom.xml` file: -+ -[source,xml] ----- - - commons-collections - commons-collections - 3.2.2 - ----- - -. For this example, replace the generated controller file `MemcachedReconciler.java` with following example implementation: -+ -.Example `MemcachedReconciler.java` -[%collapsible] -==== -[source,java] ----- -package com.example; - -import io.fabric8.kubernetes.client.KubernetesClient; -import io.javaoperatorsdk.operator.api.reconciler.Context; -import io.javaoperatorsdk.operator.api.reconciler.Reconciler; -import io.javaoperatorsdk.operator.api.reconciler.UpdateControl; -import io.fabric8.kubernetes.api.model.ContainerBuilder; -import io.fabric8.kubernetes.api.model.ContainerPortBuilder; -import io.fabric8.kubernetes.api.model.LabelSelectorBuilder; -import io.fabric8.kubernetes.api.model.ObjectMetaBuilder; -import io.fabric8.kubernetes.api.model.OwnerReferenceBuilder; -import io.fabric8.kubernetes.api.model.Pod; -import io.fabric8.kubernetes.api.model.PodSpecBuilder; -import io.fabric8.kubernetes.api.model.PodTemplateSpecBuilder; -import io.fabric8.kubernetes.api.model.apps.Deployment; -import io.fabric8.kubernetes.api.model.apps.DeploymentBuilder; -import io.fabric8.kubernetes.api.model.apps.DeploymentSpecBuilder; -import org.apache.commons.collections.CollectionUtils; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -public class MemcachedReconciler implements Reconciler { - private final KubernetesClient client; - - public MemcachedReconciler(KubernetesClient client) { - this.client = client; - } - - // TODO Fill in the rest of the reconciler - - @Override - public UpdateControl reconcile( - Memcached resource, Context context) { - // TODO: fill in logic - Deployment deployment = client.apps() - .deployments() - .inNamespace(resource.getMetadata().getNamespace()) - .withName(resource.getMetadata().getName()) - .get(); - - if (deployment == null) { - Deployment newDeployment = createMemcachedDeployment(resource); - client.apps().deployments().create(newDeployment); - return UpdateControl.noUpdate(); - } - - int currentReplicas = deployment.getSpec().getReplicas(); - int requiredReplicas = resource.getSpec().getSize(); - - if (currentReplicas != requiredReplicas) { - deployment.getSpec().setReplicas(requiredReplicas); - client.apps().deployments().createOrReplace(deployment); - return UpdateControl.noUpdate(); - } - - List pods = client.pods() - .inNamespace(resource.getMetadata().getNamespace()) - .withLabels(labelsForMemcached(resource)) - .list() - .getItems(); - - List podNames = - pods.stream().map(p -> p.getMetadata().getName()).collect(Collectors.toList()); - - - if (resource.getStatus() == null - || !CollectionUtils.isEqualCollection(podNames, resource.getStatus().getNodes())) { - if (resource.getStatus() == null) resource.setStatus(new MemcachedStatus()); - resource.getStatus().setNodes(podNames); - return UpdateControl.updateResource(resource); - } - - return UpdateControl.noUpdate(); - } - - private Map labelsForMemcached(Memcached m) { - Map labels = new HashMap<>(); - labels.put("app", "memcached"); - labels.put("memcached_cr", m.getMetadata().getName()); - return labels; - } - - private Deployment createMemcachedDeployment(Memcached m) { - Deployment deployment = new DeploymentBuilder() - .withMetadata( - new ObjectMetaBuilder() - .withName(m.getMetadata().getName()) - .withNamespace(m.getMetadata().getNamespace()) - .build()) - .withSpec( - new DeploymentSpecBuilder() - .withReplicas(m.getSpec().getSize()) - .withSelector( - new LabelSelectorBuilder().withMatchLabels(labelsForMemcached(m)).build()) - .withTemplate( - new PodTemplateSpecBuilder() - .withMetadata( - new ObjectMetaBuilder().withLabels(labelsForMemcached(m)).build()) - .withSpec( - new PodSpecBuilder() - .withContainers( - new ContainerBuilder() - .withImage("memcached:1.4.36-alpine") - .withName("memcached") - .withCommand("memcached", "-m=64", "-o", "modern", "-v") - .withPorts( - new ContainerPortBuilder() - .withContainerPort(11211) - .withName("memcached") - .build()) - .build()) - .build()) - .build()) - .build()) - .build(); - deployment.addOwnerReference(m); - return deployment; - } -} ----- -==== -+ -The example controller runs the following reconciliation logic for each `Memcached` custom resource (CR): -+ --- -* Creates a Memcached deployment if it does not exist. -* Ensures that the deployment size matches the size specified by the `Memcached` CR spec. -* Updates the `Memcached` CR status with the names of the `memcached` pods. --- diff --git a/modules/osdk-java-project-layout.adoc b/modules/osdk-java-project-layout.adoc deleted file mode 100644 index 44d2572883..0000000000 --- a/modules/osdk-java-project-layout.adoc +++ /dev/null @@ -1,37 +0,0 @@ -// Module included in the following assemblies: -// -// * operators/operator_sdk/java/osdk-java-project-layout.adoc - -:_mod-docs-content-type: REFERENCE -[id="osdk-java-project-layout_{context}"] -= Java-based project layout - -Java-based Operator projects generated by the `operator-sdk init` command contain the following files and directories: - -[options="header",cols="1,4"] -|=== - -|File or directory |Purpose - -|`pom.xml` -|File that contains the dependencies required to run the Operator. - -|`/` -|Directory that contains the files that represent the API. If the domain is `example.com`, this folder is called `example/`. - -|`MemcachedReconciler.java` -|Java file that defines controller implementations. - -|`MemcachedSpec.java` -|Java file that defines the desired state of the Memcached CR. - -|`MemcachedStatus.java` -|Java file that defines the observed state of the Memcached CR. - -|`Memcached.java` -|Java file that defines the Schema for Memcached APIs. - -|`target/kubernetes/` -|Directory that contains the CRD yaml files. - -|=== diff --git a/modules/osdk-project-file.adoc b/modules/osdk-project-file.adoc index 5239f3abe1..8f0f27d518 100644 --- a/modules/osdk-project-file.adoc +++ b/modules/osdk-project-file.adoc @@ -3,7 +3,6 @@ // * operators/operator_sdk/golang/osdk-golang-tutorial.adoc // * operators/operator_sdk/ansible/osdk-ansible-tutorial.adoc // * operators/operator_sdk/helm/osdk-helm-tutorial.adoc -// * operators/operator_sdk/java/osdk-java-tutorial.adoc ifeval::["{context}" == "osdk-golang-tutorial"] :golang: @@ -20,11 +19,6 @@ ifeval::["{context}" == "osdk-helm-tutorial"] :type: Helm :app: nginx endif::[] -ifeval::["{context}" == "osdk-java-tutorial"] -:java: -:type: Java -:app: memcached -endif::[] [id="osdk-project-file_{context}"] = PROJECT file @@ -80,15 +74,6 @@ resources: version: "3" ---- endif::[] -ifdef::java[] ----- -domain: example.com -layout: -- quarkus.javaoperatorsdk.io/v1-alpha -projectName: memcached-operator -version: "3" ----- -endif::[] ifeval::["{context}" == "osdk-golang-tutorial"] :!golang: @@ -104,9 +89,4 @@ ifeval::["{context}" == "osdk-helm-tutorial"] :!helm: :!type: :!app: -endif::[] -ifeval::["{context}" == "osdk-java-tutorial"] -:!java: -:!type: -:!app: endif::[] \ No newline at end of file diff --git a/modules/osdk-quickstart.adoc b/modules/osdk-quickstart.adoc index 93fe1712cd..d0df298e44 100644 --- a/modules/osdk-quickstart.adoc +++ b/modules/osdk-quickstart.adoc @@ -25,13 +25,6 @@ ifeval::["{context}" == "osdk-helm-quickstart"] :app: nginx :group: demo endif::[] -ifeval::["{context}" == "osdk-java-quickstart"] -:java: -:type: Java -:app-proper: Memcached -:app: memcached -:group: cache -endif::[] :_mod-docs-content-type: PROCEDURE [id="osdk-quickstart_{context}"] @@ -64,9 +57,6 @@ endif::[] ifdef::helm[] with the `helm` plugin endif::[] -ifdef::java[] -with the `quarkus` plugin -endif::[] to initialize the project: + [source,terminal,subs="attributes+"] @@ -92,14 +82,6 @@ $ operator-sdk init \ --plugins=helm ---- endif::[] -ifdef::java[] ----- -$ operator-sdk init \ - --plugins=quarkus \ - --domain=example.com \ - --project-name=memcached-operator ----- -endif::[] . *Create an API.* + @@ -136,15 +118,6 @@ $ operator-sdk create api \ + This API uses the built-in Helm chart boilerplate from the `helm create` command. endif::[] -ifdef::java[] ----- -$ operator-sdk create api \ - --plugins quarkus \ - --group {group} \ - --version v1 \ - --kind {app-proper} ----- -endif::[] . *Build and push the Operator image.* + @@ -251,9 +224,3 @@ ifeval::["{context}" == "osdk-helm-quickstart"] :!app-proper: :!app: endif::[] -ifeval::["{context}" == "osdk-java-quickstart"] -:!java: -:!type: -:!app-proper: -:!app: -endif::[] diff --git a/modules/osdk-run-deployment.adoc b/modules/osdk-run-deployment.adoc index 655b5d4c93..a3585d25da 100644 --- a/modules/osdk-run-deployment.adoc +++ b/modules/osdk-run-deployment.adoc @@ -8,9 +8,6 @@ ifeval::["{context}" == "osdk-golang-tutorial"] :golang: endif::[] -ifeval::["{context}" == "osdk-java-tutorial"] -:java: -endif::[] :_mod-docs-content-type: PROCEDURE [id="osdk-run-deployment_{context}"] @@ -59,67 +56,17 @@ $ make docker-push IMG=//: The name and tag of the image, for example `IMG=//:`, in both the commands can also be set in your Makefile. Modify the `IMG ?= controller:latest` value to set your default image name. ==== -ifdef::java[] -. Run the following command to install the CRD to the default namespace: -+ -[source,terminal] ----- -$ oc apply -f target/kubernetes/memcacheds.cache.example.com-v1.yml ----- -+ -.Example output -[source,terminal] ----- -customresourcedefinition.apiextensions.k8s.io/memcacheds.cache.example.com created ----- - -. Create a file called `rbac.yaml` as shown in the following example: -+ -[source,yaml] ----- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: memcached-operator-admin -subjects: -- kind: ServiceAccount - name: memcached-quarkus-operator-operator - namespace: -roleRef: - kind: ClusterRole - name: cluster-admin - apiGroup: "" ----- -+ -[IMPORTANT] -==== -The `rbac.yaml` file will be applied at a later step. -==== - -endif::[] - . Run the following command to deploy the Operator: + [source,terminal] ---- $ make deploy IMG=//: ---- -ifeval::["{context}" != "osdk-java-tutorial"] + By default, this command creates a namespace with the name of your Operator project in the form `-system` and is used for the deployment. This command also installs the RBAC manifests from `config/rbac`. -endif::[] -ifdef::java[] -. Run the following command to grant `cluster-admin` privileges to the `memcached-quarkus-operator-operator` by applying the `rbac.yaml` file created in a previous step: -+ -[source,terminal] ----- -$ oc apply -f rbac.yaml ----- -endif::[] . Run the following command to verify that the Operator is running: + -ifeval::["{context}" != "osdk-java-tutorial"] [source,terminal] ---- $ oc get deployment -n -system @@ -131,53 +78,7 @@ $ oc get deployment -n -system NAME READY UP-TO-DATE AVAILABLE AGE -controller-manager 1/1 1 1 8m ---- -endif::[] -ifdef::java[] -[source,terminal] ----- -$ oc get all -n default ----- -+ -.Example output -[source,terminal] ----- -NAME READY UP-TO-DATE AVAILABLE AGE -pod/memcached-quarkus-operator-operator-7db86ccf58-k4mlm 0/1 Running 0 18s ----- -. Run the following command to apply the `memcached-sample.yaml` and create the `memcached-sample` pod: -+ -[source,terminal] ----- -$ oc apply -f memcached-sample.yaml ----- -+ -.Example output -[source,terminal] ----- -memcached.cache.example.com/memcached-sample created ----- - -.Verification - -* Run the following command to confirm the pods have started: -+ -[source,terminal] ----- -$ oc get all ----- -+ -.Example output -[source,terminal] ----- -NAME READY STATUS RESTARTS AGE -pod/memcached-quarkus-operator-operator-7b766f4896-kxnzt 1/1 Running 1 79s -pod/memcached-sample-6c765df685-mfqnz 1/1 Running 0 18s ----- -endif::[] ifeval::["{context}" == "osdk-golang-tutorial"] :!golang: endif::[] -ifeval::["{context}" == "osdk-java-tutorial"] -:!java: -endif::[] diff --git a/modules/osdk-run-locally.adoc b/modules/osdk-run-locally.adoc index fb0d38d13a..db45a25e71 100644 --- a/modules/osdk-run-locally.adoc +++ b/modules/osdk-run-locally.adoc @@ -13,9 +13,6 @@ endif::[] ifeval::["{context}" == "osdk-helm-tutorial"] :helm: endif::[] -ifeval::["{context}" == "osdk-java-tutorial"] -:java: -endif::[] :_mod-docs-content-type: PROCEDURE @@ -25,7 +22,7 @@ endif::[] You can run your Operator project as a Go program outside of the cluster. This is useful for development purposes to speed up deployment and testing. .Procedure -ifeval::["{context}" != "osdk-java-tutorial"] + * Run the following command to install the custom resource definitions (CRDs) in the cluster configured in your `~/.kube/config` file and run the Operator locally: + [source,terminal] @@ -35,7 +32,6 @@ $ make install run + .Example output [source,terminal] -endif::[] ifdef::golang[] ---- ... @@ -69,104 +65,7 @@ ifdef::helm[] {"level":"info","ts":1612652420.2309358,"logger":"controller-runtime.manager.controller.nginx-controller","msg":"Starting workers","worker count":8} ---- endif::[] -ifdef::java[] -. Run the following command to compile the Operator: -+ -[source,terminal] ----- -$ mvn clean install ----- -+ -.Example output -[source,terminal] ----- -[INFO] ------------------------------------------------------------------------ -[INFO] BUILD SUCCESS -[INFO] ------------------------------------------------------------------------ -[INFO] Total time: 11.193 s -[INFO] Finished at: 2021-05-26T12:16:54-04:00 -[INFO] ------------------------------------------------------------------------ ----- -. Run the following command to install the CRD to the default namespace: -+ -[source,terminal] ----- -$ oc apply -f target/kubernetes/memcacheds.cache.example.com-v1.yml ----- -+ -.Example output -[source,terminal] ----- -customresourcedefinition.apiextensions.k8s.io/memcacheds.cache.example.com created ----- - -. Create a file called `rbac.yaml` as shown in the following example: -+ -[source,yaml] ----- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: memcached-operator-admin -subjects: -- kind: ServiceAccount - name: memcached-quarkus-operator-operator - namespace: -roleRef: - kind: ClusterRole - name: cluster-admin - apiGroup: "" ----- - -. Run the following command to grant `cluster-admin` privileges to the `memcached-quarkus-operator-operator` by applying the `rbac.yaml` file: -+ -[source,terminal] ----- -$ oc apply -f rbac.yaml ----- - -. Enter the following command to run the Operator: -+ -[source,terminal] ----- -$ java -jar target/quarkus-app/quarkus-run.jar ----- -+ -[NOTE] -==== -The `java` command will run the Operator and remain running until you end the process. You will need another terminal to complete the rest of these commands. -==== - -. Apply the `memcached-sample.yaml` file with the following command: -+ -[source,terminal] ----- -$ kubectl apply -f memcached-sample.yaml ----- -+ -.Example output -[source,terminal] ----- -memcached.cache.example.com/memcached-sample created ----- - -.Verification - -* Run the following command to confirm that the pod has started: -+ -[source,terminal] ----- -$ oc get all ----- -+ -.Example output -[source,terminal] ----- -NAME READY STATUS RESTARTS AGE -pod/memcached-sample-6c765df685-mfqnz 1/1 Running 0 18s ----- -endif::[] ifeval::["{context}" == "osdk-golang-tutorial"] :!golang: endif::[] @@ -175,7 +74,4 @@ ifeval::["{context}" == "osdk-ansible-tutorial"] endif::[] ifeval::["{context}" == "osdk-helm-tutorial"] :!helm: -endif::[] -ifeval::["{context}" == "osdk-java-tutorial"] -:!java: -endif::[] +endif::[] \ No newline at end of file diff --git a/modules/osdk-run-operator.adoc b/modules/osdk-run-operator.adoc index d3e029d593..c18c25ce29 100644 --- a/modules/osdk-run-operator.adoc +++ b/modules/osdk-run-operator.adoc @@ -3,7 +3,6 @@ // * operators/operator_sdk/golang/osdk-golang-tutorial.adoc // * operators/operator_sdk/ansible/osdk-ansible-tutorial.adoc // * operators/operator_sdk/helm/osdk-helm-tutorial.adoc -// * operators/operator_sdk/helm/osdk-hybrid-helm.adoc ifeval::["{context}" == "osdk-golang-tutorial"] :golang: @@ -14,9 +13,6 @@ endif::[] ifeval::["{context}" == "osdk-helm-tutorial"] :helm: endif::[] -ifeval::["{context}" == "osdk-java-tutorial"] -:java: -endif::[] [id="osdk-run-operator_{context}"] = Running the Operator @@ -68,6 +64,3 @@ endif::[] ifeval::["{context}" == "osdk-helm-tutorial"] :!helm: endif::[] -ifeval::["{context}" == "osdk-java-tutorial"] -:!java: -endif::[] diff --git a/modules/osdk-updating-128-to-131.adoc b/modules/osdk-updating-128-to-131.adoc index c70c2c939a..a599893acc 100644 --- a/modules/osdk-updating-128-to-131.adoc +++ b/modules/osdk-updating-128-to-131.adoc @@ -3,8 +3,6 @@ // * operators/operator_sdk/golang/osdk-golang-updating-projects.adoc // * operators/operator_sdk/ansible/osdk-ansible-updating-projects.adoc // * operators/operator_sdk/helm/osdk-helm-updating-projects.adoc -// * operators/operator_sdk/helm/osdk-hybrid-helm-updating-projects.adoc -// * operators/operator_sdk/java/osdk-java-updating-projects.adoc ifeval::["{context}" == "osdk-golang-updating-projects"] :golang: @@ -18,14 +16,6 @@ ifeval::["{context}" == "osdk-helm-updating-projects"] :helm: :type: Helm endif::[] -ifeval::["{context}" == "osdk-hybrid-helm-updating-projects"] -:hybrid: -:type: Hybrid Helm -endif::[] -ifeval::["{context}" == "osdk-java-updating-projects"] -:java: -:type: Java -endif::[] :_mod-docs-content-type: PROCEDURE [id="osdk-upgrading-projects_{context}"] @@ -40,7 +30,7 @@ The following procedure updates an existing {type}-based Operator project for co .Procedure -ifdef::golang,hybrid,java[] +ifdef::golang[] * Edit your Operator project's Makefile to update the Operator SDK version to {osdk_ver}, as shown in the following example: + .Example Makefile @@ -211,11 +201,3 @@ ifeval::["{context}" == "osdk-helm-updating-projects"] :!helm: :!type: endif::[] -ifeval::["{context}" == "osdk-hybrid-helm-updating-projects"] -:!hybrid: -:!type: -endif::[] -ifeval::["{context}" == "osdk-java-updating-projects"] -:!java: -:!type: -endif::[] diff --git a/modules/osdk-updating-131-to-1361.adoc b/modules/osdk-updating-131-to-1361.adoc index 11884cfbbe..5d0bafb61a 100644 --- a/modules/osdk-updating-131-to-1361.adoc +++ b/modules/osdk-updating-131-to-1361.adoc @@ -3,8 +3,6 @@ // * operators/operator_sdk/golang/osdk-golang-updating-projects.adoc // * operators/operator_sdk/ansible/osdk-ansible-updating-projects.adoc // * operators/operator_sdk/helm/osdk-helm-updating-projects.adoc -// * operators/operator_sdk/helm/osdk-hybrid-helm-updating-projects.adoc -// * operators/operator_sdk/java/osdk-java-updating-projects.adoc ifeval::["{context}" == "osdk-golang-updating-projects"] :golang: @@ -18,14 +16,6 @@ ifeval::["{context}" == "osdk-helm-updating-projects"] :helm: :type: Helm endif::[] -ifeval::["{context}" == "osdk-hybrid-helm-updating-projects"] -:hybrid: -:type: Hybrid Helm -endif::[] -ifeval::["{context}" == "osdk-java-updating-projects"] -:java: -:type: Java -endif::[] :_mod-docs-content-type: PROCEDURE [id="osdk-upgrading-projects_{context}"] @@ -70,7 +60,7 @@ ifdef::ansible[] FROM registry.redhat.io/openshift4/ose-ansible-operator:v{product-version} ---- endif::[] -ifdef::golang,hybrid[] +ifdef::golang[] . The `go/v4` plugin is now stable and is the default version used when scaffolding a Go-based Operator. The transition from Golang v2 and v3 plugins to the new Golang v4 plugin introduces significant changes. This migration is designed to enhance your project's functionality and compatibility, reflecting the evolving landscape of Golang development. + For more information on the reasoning behind these changes, see link:https://book.kubebuilder.io/migration/v3vsv4#tldr-of-the-new-gov4-plugin[go/v3 vs go/v4] in the Kubebuilder documentation. @@ -117,7 +107,7 @@ sigs.k8s.io/controller-runtime v0.17.3 $ go mod tidy ---- -ifdef::golang,hybrid[] +ifdef::golang[] .. Projects are now scaffolded with `kube-rbac-proxy` version `0.16.0`. Modify the version of `kube-rbac-proxy` in the scaffolded `config/default/manager_auth_proxy_patch.yaml` file by making the following changes: + [source,diff] @@ -268,11 +258,3 @@ ifeval::["{context}" == "osdk-helm-updating-projects"] :!helm: :!type: endif::[] -ifeval::["{context}" == "osdk-hybrid-helm-updating-projects"] -:!hybrid: -:!type: -endif::[] -ifeval::["{context}" == "osdk-java-updating-projects"] -:!java: -:!type: -endif::[] diff --git a/operators/index.adoc b/operators/index.adoc index 152a841fde..af8ff45658 100644 --- a/operators/index.adoc +++ b/operators/index.adoc @@ -16,9 +16,8 @@ As an Operator author, you can perform the following development tasks for OLM-b ** xref:../operators/operator_sdk/osdk-installing-cli.adoc#osdk-installing-cli[Install Operator SDK CLI]. // The Operator quickstarts aren't published for OSD/ROSA, so for OSD/ROSA, these xrefs point to the tutorials instead. ifndef::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[] -** Create xref:../operators/operator_sdk/golang/osdk-golang-quickstart.adoc#osdk-golang-quickstart[Go-based Operators], xref:../operators/operator_sdk/ansible/osdk-ansible-quickstart.adoc#osdk-ansible-quickstart[Ansible-based Operators], xref:../operators/operator_sdk/java/osdk-java-quickstart.adoc#osdk-java-quickstart[Java-based Operators], and xref:../operators/operator_sdk/helm/osdk-helm-quickstart.adoc#osdk-helm-quickstart[Helm-based Operators]. +** Create xref:../operators/operator_sdk/golang/osdk-golang-quickstart.adoc#osdk-golang-quickstart[Go-based Operators], xref:../operators/operator_sdk/ansible/osdk-ansible-quickstart.adoc#osdk-ansible-quickstart[Ansible-based Operators], and xref:../operators/operator_sdk/helm/osdk-helm-quickstart.adoc#osdk-helm-quickstart[Helm-based Operators]. endif::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[] -// TODO: When the Java-based Operators is GA, it can be added to the list below for OSD/ROSA. ifdef::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[] ** Create xref:../operators/operator_sdk/golang/osdk-golang-tutorial.adoc#osdk-golang-tutorial[Go-based Operators], xref:../operators/operator_sdk/ansible/osdk-ansible-tutorial.adoc#osdk-ansible-tutorial[Ansible-based Operators], and xref:../operators/operator_sdk/helm/osdk-helm-tutorial.adoc#osdk-helm-tutorial[Helm-based Operators]. endif::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[] diff --git a/operators/operator_sdk/helm/osdk-hybrid-helm-updating-projects.adoc b/operators/operator_sdk/helm/osdk-hybrid-helm-updating-projects.adoc deleted file mode 100644 index 27d6dd6fdc..0000000000 --- a/operators/operator_sdk/helm/osdk-hybrid-helm-updating-projects.adoc +++ /dev/null @@ -1,24 +0,0 @@ -:_mod-docs-content-type: ASSEMBLY -[id="osdk-hybrid-helm-updating-projects"] -= Updating Hybrid Helm-based projects for newer Operator SDK versions -include::_attributes/common-attributes.adoc[] -:context: osdk-hybrid-helm-updating-projects - -toc::[] - -{product-title} {product-version} supports Operator SDK {osdk_ver}. If you already have the {osdk_ver_n1} CLI installed on your workstation, you can update the CLI to {osdk_ver} by xref:../../../operators/operator_sdk/osdk-installing-cli.adoc#osdk-installing-cli[installing the latest version]. - -include::snippets/osdk-deprecation.adoc[] - -However, to ensure your existing Operator projects maintain compatibility with Operator SDK {osdk_ver}, update steps are required for the associated breaking changes introduced since {osdk_ver_n1}. You must perform the update steps manually in any of your Operator projects that were previously created or maintained with {osdk_ver_n1}. - -include::modules/osdk-updating-131-to-1361.adoc[leveloffset=+1] - -[id="additional-resources_osdk-hybrid-helm-upgrading-projects"] -[role="_additional-resources"] -== Additional resources - -* xref:../../../operators/operator_sdk/osdk-pkgman-to-bundle.adoc#osdk-pkgman-to-bundle[Migrating package manifest projects to bundle format] -* link:https://access.redhat.com/documentation/en-us/openshift_container_platform/4.10/html-single/operators/index#osdk-upgrading-v1101-to-v1160_osdk-upgrading-projects[Upgrading projects for Operator SDK 1.16.0] -* link:https://access.redhat.com/documentation/en-us/openshift_container_platform/4.9/html/operators/developing-operators#osdk-upgrading-v180-to-v1101_osdk-upgrading-projects[Upgrading projects for Operator SDK v1.10.1] -* link:https://access.redhat.com/documentation/en-us/openshift_container_platform/4.8/html/operators/developing-operators#osdk-upgrading-v130-to-v180_osdk-upgrading-projects[Upgrading projects for Operator SDK v1.8.0] diff --git a/operators/operator_sdk/helm/osdk-hybrid-helm.adoc b/operators/operator_sdk/helm/osdk-hybrid-helm.adoc deleted file mode 100644 index 8335c56375..0000000000 --- a/operators/operator_sdk/helm/osdk-hybrid-helm.adoc +++ /dev/null @@ -1,72 +0,0 @@ -:_mod-docs-content-type: ASSEMBLY -[id="osdk-hybrid-helm"] -= Operator SDK tutorial for Hybrid Helm Operators -include::_attributes/common-attributes.adoc[] -:context: osdk-hybrid-helm - -toc::[] - -The standard Helm-based Operator support in the Operator SDK has limited functionality compared to the Go-based and Ansible-based Operator support that has reached the Auto Pilot capability (level V) in the xref:../../../operators/understanding/olm-what-operators-are.adoc#olm-maturity-model_olm-what-operators-are[Operator maturity model]. - -include::snippets/osdk-deprecation.adoc[] - -The Hybrid Helm Operator enhances the existing Helm-based support's abilities through Go APIs. With this hybrid approach of Helm and Go, the Operator SDK enables Operator authors to use the following process: - -* Generate a default structure for, or _scaffold_, a Go API in the same project as Helm. -* Configure the Helm reconciler in the `main.go` file of the project, through the libraries provided by the Hybrid Helm Operator. - -:FeatureName: The Hybrid Helm Operator -include::snippets/technology-preview.adoc[] - -This tutorial walks through the following process using the Hybrid Helm Operator: - -* Create a `Memcached` deployment through a Helm chart if it does not exist -* Ensure that the deployment size is the same as specified by `Memcached` custom resource (CR) spec -* Create a `MemcachedBackup` deployment by using the Go API - -include::modules/osdk-common-prereqs.adoc[leveloffset=+1] - -[role="_additional-resources"] -.Additional resources -* xref:../../../operators/operator_sdk/osdk-installing-cli.adoc#osdk-installing-cli[Installing the Operator SDK CLI] -* xref:../../../cli_reference/openshift_cli/getting-started-cli.adoc#getting-started-cli[Getting started with the OpenShift CLI] - -include::modules/osdk-hh-create-project.adoc[leveloffset=+1] -.Additional resources - -* This procedure creates a project structure that is compatible with both Helm and Go APIs. To learn more about the project directory structure, see xref:../../../operators/operator_sdk/helm/osdk-hybrid-helm.adoc#osdk-hh-project-layout_osdk-hybrid-helm[Project layout]. - -include::modules/osdk-hh-create-helm-api.adoc[leveloffset=+1] -.Additional resources - -* xref:../../../operators/operator_sdk/helm/osdk-helm-tutorial.adoc#osdk-helm-existing-chart_osdk-helm-tutorial[Existing Helm charts] - -include::modules/osdk-hh-helm-api-logic.adoc[leveloffset=+2] -.Additional resources - -* For detailed documentation on customizing the Helm Operator logic through the chart, see xref:../../../operators/operator_sdk/helm/osdk-helm-tutorial.adoc#osdk-helm-logic_osdk-helm-tutorial[Understanding the Operator logic]. - -include::modules/osdk-hh-helm-reconciler.adoc[leveloffset=+2] - -include::modules/osdk-hh-create-go-api.adoc[leveloffset=+1] - -include::modules/osdk-hh-defining-go-api.adoc[leveloffset=+2] - -include::modules/osdk-hh-implement-controller.adoc[leveloffset=+2] - -For a detailed explanation on how to configure the controller to perform the above mentioned actions, see xref:../../../operators/operator_sdk/golang/osdk-golang-tutorial.adoc#osdk-golang-implement-controller_osdk-golang-tutorial[Implementing the controller] in the Operator SDK tutorial for standard Go-based Operators. - -include::modules/osdk-hh-main-go.adoc[leveloffset=+2] - -include::modules/osdk-hh-rbac.adoc[leveloffset=+2] -.Additional resources - -* xref:../../../operators/operator_sdk/golang/osdk-golang-tutorial.adoc#osdk-golang-controller-rbac-markers_osdk-golang-tutorial[RBAC markers for Go-based Operators] - -include::modules/osdk-run-locally.adoc[leveloffset=+1] - -include::modules/osdk-run-deployment.adoc[leveloffset=+1] - -include::modules/osdk-hh-create-cr.adoc[leveloffset=+1] - -include::modules/osdk-hh-project-layout.adoc[leveloffset=+1] diff --git a/operators/operator_sdk/java/_attributes b/operators/operator_sdk/java/_attributes deleted file mode 120000 index bf7c2529fd..0000000000 --- a/operators/operator_sdk/java/_attributes +++ /dev/null @@ -1 +0,0 @@ -../../../_attributes/ \ No newline at end of file diff --git a/operators/operator_sdk/java/images b/operators/operator_sdk/java/images deleted file mode 120000 index 4399cbb3c0..0000000000 --- a/operators/operator_sdk/java/images +++ /dev/null @@ -1 +0,0 @@ -../../../images/ \ No newline at end of file diff --git a/operators/operator_sdk/java/modules b/operators/operator_sdk/java/modules deleted file mode 120000 index 7e8b50bee7..0000000000 --- a/operators/operator_sdk/java/modules +++ /dev/null @@ -1 +0,0 @@ -../../../modules/ \ No newline at end of file diff --git a/operators/operator_sdk/java/osdk-java-project-layout.adoc b/operators/operator_sdk/java/osdk-java-project-layout.adoc deleted file mode 100644 index 433c6f07c8..0000000000 --- a/operators/operator_sdk/java/osdk-java-project-layout.adoc +++ /dev/null @@ -1,15 +0,0 @@ -:_mod-docs-content-type: ASSEMBLY -[id="osdk-java-project-layout"] -= Project layout for Java-based Operators -include::_attributes/common-attributes.adoc[] -:context: osdk-java-project-layout -:FeatureName: Java-based Operator SDK -include::snippets/technology-preview.adoc[] - -toc::[] - -The `operator-sdk` CLI can generate, or _scaffold_, a number of packages and files for each Operator project. - -include::snippets/osdk-deprecation.adoc[] - -include::modules/osdk-java-project-layout.adoc[leveloffset=+1] diff --git a/operators/operator_sdk/java/osdk-java-quickstart.adoc b/operators/operator_sdk/java/osdk-java-quickstart.adoc deleted file mode 100644 index 177e97b05d..0000000000 --- a/operators/operator_sdk/java/osdk-java-quickstart.adoc +++ /dev/null @@ -1,29 +0,0 @@ -:_mod-docs-content-type: ASSEMBLY -[id="osdk-java-quickstart"] -= Getting started with Operator SDK for Java-based Operators -include::_attributes/common-attributes.adoc[] -:context: osdk-java-quickstart -:FeatureName: Java-based Operator SDK -include::snippets/technology-preview.adoc[] - -// This assembly is not included in the OSD and ROSA docs, because it is Tech Preview. However, once Java-based Operator SDK is GA, this assembly will still need to be excluded from OSD and ROSA if it continues to require cluster-admin permissions. - -toc::[] - -To demonstrate the basics of setting up and running a Java-based Operator using tools and libraries provided by the Operator SDK, Operator developers can build an example Java-based Operator for Memcached, a distributed key-value store, and deploy it to a cluster. - -include::snippets/osdk-deprecation.adoc[] - -include::modules/osdk-common-prereqs.adoc[leveloffset=+1] - -[role="_additional-resources"] -.Additional resources -* xref:../../../operators/operator_sdk/osdk-installing-cli.adoc#osdk-installing-cli[Installing the Operator SDK CLI] -* xref:../../../cli_reference/openshift_cli/getting-started-cli.adoc#getting-started-cli[Getting started with the OpenShift CLI] - -include::modules/osdk-quickstart.adoc[leveloffset=+1] - -[id="next-steps_osdk-java-quickstart"] -== Next steps - -* See xref:../../../operators/operator_sdk/java/osdk-java-tutorial.adoc#osdk-java-tutorial[Operator SDK tutorial for Java-based Operators] for a more in-depth walkthrough on building a Java-based Operator. diff --git a/operators/operator_sdk/java/osdk-java-tutorial.adoc b/operators/operator_sdk/java/osdk-java-tutorial.adoc deleted file mode 100644 index a0d5d5d4a2..0000000000 --- a/operators/operator_sdk/java/osdk-java-tutorial.adoc +++ /dev/null @@ -1,87 +0,0 @@ -:_mod-docs-content-type: ASSEMBLY -[id="osdk-java-tutorial"] -= Operator SDK tutorial for Java-based Operators -include::_attributes/common-attributes.adoc[] -:context: osdk-java-tutorial -:FeatureName: Java-based Operator SDK -include::snippets/technology-preview.adoc[] - -// This assembly is not currrently included in the OSD and ROSA distros, because it is Tech Preview. However, some conditionalization has been added for OSD and ROSA so that the content will be applicable to those distros once this feature is GA and included in the OSD and ROSA docs. - -toc::[] - -Operator developers can take advantage of Java programming language support in the Operator SDK to build an example Java-based Operator for Memcached, a distributed key-value store, and manage its lifecycle. - -include::snippets/osdk-deprecation.adoc[] - -This process is accomplished using two centerpieces of the Operator Framework: - -Operator SDK:: The `operator-sdk` CLI tool and `java-operator-sdk` library API - -Operator Lifecycle Manager (OLM):: Installation, upgrade, and role-based access control (RBAC) of Operators on a cluster - -ifndef::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[] -[NOTE] -==== -This tutorial goes into greater detail than xref:../../../operators/operator_sdk/java/osdk-java-quickstart.adoc#osdk-java-quickstart[Getting started with Operator SDK for Java-based Operators]. -==== -endif::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[] - -// The "Getting started" quickstarts require cluster-admin and are therefore only available in OCP. -ifdef::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[] -[NOTE] -==== -This tutorial goes into greater detail than link:https://access.redhat.com/documentation/en-us/openshift_container_platform/4.13/html-single/operators/index#osdk-java-quickstart[Getting started with Operator SDK for Java-based Operators] in the OpenShift Container Platform documentation. -==== -endif::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[] - -include::modules/osdk-common-prereqs.adoc[leveloffset=+1] - -[role="_additional-resources"] -.Additional resources -* xref:../../../operators/operator_sdk/osdk-installing-cli.adoc#osdk-installing-cli[Installing the Operator SDK CLI] -* xref:../../../cli_reference/openshift_cli/getting-started-cli.adoc#getting-started-cli[Getting started with the OpenShift CLI] - -include::modules/osdk-create-project.adoc[leveloffset=+1] -include::modules/osdk-project-file.adoc[leveloffset=+2] - -include::modules/osdk-java-create-api-controller.adoc[leveloffset=+1] -include::modules/osdk-java-define-api.adoc[leveloffset=+2] -include::modules/osdk-java-generate-crd.adoc[leveloffset=+2] -include::modules/osdk-java-create-cr.adoc[leveloffset=+2] - -include::modules/osdk-java-implement-controller.adoc[leveloffset=+1] - -The next subsections explain how the controller in the example implementation watches resources and how the reconcile loop is triggered. You can skip these subsections to go directly to xref:../../../operators/operator_sdk/java/osdk-java-tutorial.adoc#osdk-run-operator_osdk-java-tutorial[Running the Operator]. - -include::modules/osdk-java-controller-reconcile-loop.adoc[leveloffset=+2] -include::modules/osdk-java-controller-labels-memcached.adoc[leveloffset=+2] -include::modules/osdk-java-controller-memcached-deployment.adoc[leveloffset=+2] - -include::modules/osdk-run-operator.adoc[leveloffset=+1] - -ifdef::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[] -[role="_additional-resources"] -.Additional resources -* link:https://access.redhat.com/documentation/en-us/openshift_container_platform/4.13/html-single/operators/index#osdk-run-locally_osdk-java-tutorial[Running locally outside the cluster] (OpenShift Container Platform documentation) -* link:https://access.redhat.com/documentation/en-us/openshift_container_platform/4.13/html-single/operators/index#osdk-run-deployment_osdk-java-tutorial[Running as a deployment on the cluster] (OpenShift Container Platform documentation) -endif::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[] - -// In OSD/ROSA, the only applicable option for running the Operator is to bundle and deploy with OLM. -ifndef::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[] -include::modules/osdk-run-locally.adoc[leveloffset=+2] -include::modules/osdk-run-deployment.adoc[leveloffset=+2] -endif::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[] - -[id="osdk-bundle-deploy-olm_{context}"] -=== Bundling an Operator and deploying with Operator Lifecycle Manager - -include::modules/osdk-bundle-operator.adoc[leveloffset=+3] -include::modules/osdk-deploy-olm.adoc[leveloffset=+3] - -[role="_additional-resources"] -[id="additional-resources_osdk-java-tutorial"] -== Additional resources - -* See xref:../../../operators/operator_sdk/java/osdk-java-project-layout.adoc#osdk-java-project-layout[Project layout for Java-based Operators] to learn about the directory structures created by the Operator SDK. -* If a xref:../../../networking/enable-cluster-wide-proxy.adoc#enable-cluster-wide-proxy[cluster-wide egress proxy is configured], cluster administrators can xref:../../../operators/admin/olm-configuring-proxy-support.adoc#olm-configuring-proxy-support[override the proxy settings or inject a custom CA certificate] for specific Operators running on Operator Lifecycle Manager (OLM). diff --git a/operators/operator_sdk/java/osdk-java-updating-projects.adoc b/operators/operator_sdk/java/osdk-java-updating-projects.adoc deleted file mode 100644 index 82ed3dbbba..0000000000 --- a/operators/operator_sdk/java/osdk-java-updating-projects.adoc +++ /dev/null @@ -1,21 +0,0 @@ -:_mod-docs-content-type: ASSEMBLY -[id="osdk-java-updating-projects"] -= Updating projects for newer Operator SDK versions -include::_attributes/common-attributes.adoc[] -:context: osdk-java-updating-projects - -toc::[] - -{product-title} {product-version} supports Operator SDK {osdk_ver}. If you already have the {osdk_ver_n1} CLI installed on your workstation, you can update the CLI to {osdk_ver} by xref:../../../operators/operator_sdk/osdk-installing-cli.adoc#osdk-installing-cli[installing the latest version]. - -include::snippets/osdk-deprecation.adoc[] - -However, to ensure your existing Operator projects maintain compatibility with Operator SDK {osdk_ver}, update steps are required for the associated breaking changes introduced since {osdk_ver_n1}. You must perform the update steps manually in any of your Operator projects that were previously created or maintained with {osdk_ver_n1}. - -include::modules/osdk-updating-131-to-1361.adoc[leveloffset=+1] - -[id="additional-resources_osdk-java-upgrading-projects"] -[role="_additional-resources"] -== Additional resources - -* xref:../../../operators/operator_sdk/osdk-pkgman-to-bundle.adoc#osdk-pkgman-to-bundle[Migrating package manifest projects to bundle format] diff --git a/operators/operator_sdk/java/snippets b/operators/operator_sdk/java/snippets deleted file mode 120000 index ce62fd7c41..0000000000 --- a/operators/operator_sdk/java/snippets +++ /dev/null @@ -1 +0,0 @@ -../../../snippets/ \ No newline at end of file diff --git a/snippets/osdk-deprecation.adoc b/snippets/osdk-deprecation.adoc index 32fa5a15f5..bdd1c0f2e7 100644 --- a/snippets/osdk-deprecation.adoc +++ b/snippets/osdk-deprecation.adoc @@ -18,12 +18,6 @@ // * operators/operator_sdk/helm/osdk-helm-support.adoc // * operators/operator_sdk/helm/osdk-helm-tutorial.adoc // * operators/operator_sdk/helm/osdk-helm-updating-projects.adoc -// * operators/operator_sdk/helm/osdk-hybrid-helm-updating-projects.adoc -// * operators/operator_sdk/helm/osdk-hybrid-helm.adoc -// * operators/operator_sdk/java/osdk-java-project-layout.adoc -// * operators/operator_sdk/java/osdk-java-quickstart.adoc -// * operators/operator_sdk/java/osdk-java-tutorial.adoc -// * operators/operator_sdk/java/osdk-java-updating-projects.adoc // * operators/operator_sdk/osdk-about.adoc // * operators/operator_sdk/osdk-bundle-validate.adoc // * operators/operator_sdk/osdk-cli-ref.adoc