Skip to content

Commit

Permalink
CLI-1398: Update CLI references to v2 (confluentinc#404)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianstrauch authored Nov 29, 2021
1 parent aef9e14 commit 7b8fe4d
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 105 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ services:
- ./scripts/security:/etc/kafka/secrets

tools:
image: cnfldemos/tools:0.2
image: cnfldemos/tools:0.3
hostname: tools
container_name: tools
depends_on:
Expand Down
18 changes: 9 additions & 9 deletions docs/hybrid-cloud.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ Setup |ccloud| and CLI

#. Setup a payment method for your |ccloud| account and optionally enter the promo code ``CPDEMO50`` in the |ccloud| UI `Billing and payment` section to receive an additional $50 free usage.

#. Install `Confluent Cloud CLI <https://docs.confluent.io/ccloud-cli/current/install.html>`__ v1.25.0 or later.
#. Install `Confluent CLI <https://docs.confluent.io/confluent-cli/current/install.html>`__ v2.2.0 or later. Do not confuse this Confluent CLI binary v2 that is used to manage |ccloud| with the Confluent CLI binary v1 that is used to manage |cp| |release|. See `documentation <https://docs.confluent.io/confluent-cli/current/migrate.html>`__ for more information on the CLI migration and running the CLIs in parallel.

#. Using the CLI, log in to |ccloud| with the command ``ccloud login``, and use your |ccloud| username and password. The ``--save`` argument saves your |ccloud| user login credentials or refresh token (in the case of SSO) to the local ``netrc`` file.
#. Using the CLI, log in to |ccloud| with the command ``confluent login``, and use your |ccloud| username and password. The ``--save`` argument saves your |ccloud| user login credentials or refresh token (in the case of SSO) to the local ``netrc`` file.

.. code:: shell
ccloud login --save
confluent login --save
#. The remainder of the |ccloud| portion of this tutorial must be completed sequentially. We recommend that you manually complete all the steps in the following sections. However, you may also run the script :devx-cp-demo:`scripts/ccloud/create-ccloud-workflow.sh|scripts/ccloud/create-ccloud-workflow.sh` which automates those steps. This option is recommended for users who have run this tutorial before and want to quickly bring it up.

Expand Down Expand Up @@ -125,7 +125,7 @@ Enable :ref:`telemetry_reporter` on the on-prem cluster, and configure it to sen

.. code:: shell
ccloud api-key create --resource cloud -o json
confluent api-key create --resource cloud -o json
#. Verify your output resembles:

Expand Down Expand Up @@ -203,7 +203,7 @@ The Replicator instance is running on the existing Connect worker in the on-prem

.. code-block:: text
docker-compose exec tools bash -c "confluent iam rolebinding create \
docker-compose exec tools bash -c "confluent-v1 iam rolebinding create \
--principal User:connectorSubmitter \
--role ResourceOwner \
--resource Connector:replicate-topic-to-ccloud \
Expand Down Expand Up @@ -301,7 +301,7 @@ Metrics API

.. code-block:: text
CCLOUD_CLUSTER_ID=$(ccloud kafka cluster list -o json | jq -c -r '.[] | select (.name == "'"demo-kafka-cluster-${SERVICE_ACCOUNT_ID}"'")' | jq -r .id)
CCLOUD_CLUSTER_ID=$(confluent kafka cluster list -o json | jq -c -r '.[] | select (.name == "'"demo-kafka-cluster-${SERVICE_ACCOUNT_ID}"'")' | jq -r .id)
#. Substitute values into the query json file. For this substitution to work, you must have set the following parameters in your environment:

Expand Down Expand Up @@ -358,19 +358,19 @@ You must have completed :ref:`cp-demo-ccloud-stack` before proceeding.

.. code-block:: text
ksqlDBAppId=$(ccloud ksql app list | grep "$KSQLDB_ENDPOINT" | awk '{print $1}')
ksqlDBAppId=$(confluent ksql app list | grep "$KSQLDB_ENDPOINT" | awk '{print $1}')
#. Verify the |ccloud| ksqlDB application has transitioned from ``PROVISIONING`` to ``UP`` state. This may take a few minutes.

.. code-block:: text
ccloud ksql app describe $ksqlDBAppId -o json
confluent ksql app describe $ksqlDBAppId -o json
#. Configure ksqlDB ACLs to permit the ksqlDB application to read from ``wikipedia.parsed.ccloud.replica``.

.. code-block:: text
ccloud ksql app configure-acls $ksqlDBAppId wikipedia.parsed.ccloud.replica
confluent ksql app configure-acls $ksqlDBAppId wikipedia.parsed.ccloud.replica
#. Create new ksqlDB queries in |ccloud| from the :devx-cp-demo:`scripts/ccloud/statements.sql|scripts/ccloud/statements.sql` file. Note: depending on which folder you are in, you may need to modify the relative path to the ``statements.sql`` file.

Expand Down
16 changes: 8 additions & 8 deletions docs/on-prem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -681,21 +681,21 @@ Authorization with RBAC
.. code-block:: text
# Create the role binding for the topic ``wikipedia.parsed``
docker-compose exec tools bash -c "confluent iam rolebinding create \
docker-compose exec tools bash -c "confluent-v1 iam rolebinding create \
--principal User:badapp \
--role ResourceOwner \
--resource Topic:wikipedia.parsed \
--kafka-cluster-id $KAFKA_CLUSTER_ID"
# Create the role binding for the group ``wikipedia.test``
docker-compose exec tools bash -c "confluent iam rolebinding create \
docker-compose exec tools bash -c "confluent-v1 iam rolebinding create \
--principal User:badapp \
--role ResourceOwner \
--resource Group:wikipedia.test \
--kafka-cluster-id $KAFKA_CLUSTER_ID"
# Create the role binding for the subject ``wikipedia.parsed-value``, i.e., the topic-value (versus the topic-key)
docker-compose exec tools bash -c "confluent iam rolebinding create \
docker-compose exec tools bash -c "confluent-v1 iam rolebinding create \
--principal User:badapp \
--role ResourceOwner \
--resource Subject:wikipedia.parsed-value \
Expand Down Expand Up @@ -819,7 +819,7 @@ The security in place between |sr| and the end clients, e.g. ``appSA``, is as fo
.. code-block:: text
# Create the role binding for the subject ``users-value``, i.e., the topic-value (versus the topic-key)
docker-compose exec tools bash -c "confluent iam rolebinding create \
docker-compose exec tools bash -c "confluent-v1 iam rolebinding create \
--principal User:appSA \
--role ResourceOwner \
--resource Subject:users-value \
Expand Down Expand Up @@ -981,7 +981,7 @@ For the next few steps, use the |crest| that is running as a standalone service.
.. code-block:: text
# Create the role binding for the topic ``users``
docker-compose exec tools bash -c "confluent iam rolebinding create \
docker-compose exec tools bash -c "confluent-v1 iam rolebinding create \
--principal User:appSA \
--role DeveloperWrite \
--resource Topic:users \
Expand Down Expand Up @@ -1072,7 +1072,7 @@ For the next few steps, use the |crest| that is running as a standalone service.
.. code-block:: text
# Create the role binding for the group ``my_avro_consumer``
docker-compose exec tools bash -c "confluent iam rolebinding create \
docker-compose exec tools bash -c "confluent-v1 iam rolebinding create \
--principal User:appSA \
--role ResourceOwner \
--resource Group:my_avro_consumer \
Expand Down Expand Up @@ -1118,7 +1118,7 @@ For the next few steps, use the |crest| that is running as a standalone service.
.. code-block:: text
# Create the role binding for the group my_avro_consumer
docker-compose exec tools bash -c "confluent iam rolebinding create \
docker-compose exec tools bash -c "confluent-v1 iam rolebinding create \
--principal User:appSA \
--role DeveloperRead \
--resource Topic:users \
Expand Down Expand Up @@ -1182,7 +1182,7 @@ For the next few steps, use the |crest| that is embedded on the |ak| brokers. On
.. code-block:: text
# Create the role binding for the topic ``dev_users``
docker-compose exec tools bash -c "confluent iam rolebinding create \
docker-compose exec tools bash -c "confluent-v1 iam rolebinding create \
--principal User:appSA \
--role ResourceOwner \
--resource Topic:dev_users \
Expand Down
2 changes: 1 addition & 1 deletion docs/teardown.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ If you ran the :ref:`cp-demo-hybrid` portion of this tutorial, which included cr

.. code-block:: text
ccloud api-key delete ${METRICS_API_KEY}
confluent api-key delete ${METRICS_API_KEY}
#. Destroy your |ccloud| environment. Even if you stop ``cp-demo``, the resources in |ccloud| continue to incur charges until you destroy all the resources.

Expand Down
20 changes: 10 additions & 10 deletions scripts/ccloud/create-ccloud-workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ source ${VALIDATE_DIR}/../helper/functions.sh
source ${VALIDATE_DIR}/../../.env
source ${VALIDATE_DIR}/../env.sh

verify_installed ccloud || exit 1
verify_installed confluent || exit 1

curl -sS -o ccloud_library.sh https://raw.githubusercontent.com/confluentinc/examples/latest/utils/ccloud_library.sh
source ./ccloud_library.sh
ccloud::prompt_continue_ccloud_demo || exit 1

# Log into Confluent Cloud CLI
# Log into Confluent CLI
echo
ccloud login --save || exit 1
confluent login --save || exit 1

# Create a new ccloud-stack
echo
Expand All @@ -24,9 +24,9 @@ echo

export EXAMPLE="cp-demo"
ccloud::create_ccloud_stack true || exit 1
export SERVICE_ACCOUNT_ID=$(ccloud kafka cluster list -o json | jq -r '.[0].name' | awk -F'-' '{print $4;}')
export SERVICE_ACCOUNT_ID=$(confluent kafka cluster list -o json | jq -r '.[0].name' | awk -F'-' '{print $4 "-" $5;}')
CONFIG_FILE=stack-configs/java-service-account-$SERVICE_ACCOUNT_ID.config
CCLOUD_CLUSTER_ID=$(ccloud kafka cluster list -o json | jq -c -r '.[] | select (.name == "'"demo-kafka-cluster-$SERVICE_ACCOUNT_ID"'")' | jq -r .id)
CCLOUD_CLUSTER_ID=$(confluent kafka cluster list -o json | jq -c -r '.[] | select (.name == "'"demo-kafka-cluster-$SERVICE_ACCOUNT_ID"'")' | jq -r .id)

# Create parameters customized for Confluent Cloud instance created above
ccloud::generate_configs $CONFIG_FILE
Expand All @@ -41,7 +41,7 @@ CONNECTOR_SUBMITTER="User:connectorSubmitter"
KAFKA_CLUSTER_ID=$(curl -s https://localhost:8091/v1/metadata/id --tlsv1.2 --cacert ${VALIDATE_DIR}/../security/snakeoil-ca-1.crt | jq -r ".id")
CONNECT=connect-cluster
${VALIDATE_DIR}/../helper/refresh_mds_login.sh
docker-compose exec tools bash -c "confluent iam rolebinding create \
docker-compose exec tools bash -c "confluent-v1 iam rolebinding create \
--principal $CONNECTOR_SUBMITTER \
--role ResourceOwner \
--resource Connector:replicate-topic-to-ccloud \
Expand All @@ -59,7 +59,7 @@ echo "Replicator started!"

# Create credentials for the cloud resource
echo
CREDENTIALS=$(ccloud api-key create --resource cloud -o json) || exit 1
CREDENTIALS=$(confluent api-key create --resource cloud -o json) || exit 1
export METRICS_API_KEY=$(echo "$CREDENTIALS" | jq -r .key)
export METRICS_API_SECRET=$(echo "$CREDENTIALS" | jq -r .secret)

Expand Down Expand Up @@ -117,9 +117,9 @@ retry $MAX_WAIT ccloud::validate_ccloud_ksqldb_endpoint_ready $KSQLDB_ENDPOINT

echo
echo "Writing ksqlDB queries in Confluent Cloud"
ksqlDBAppId=$(ccloud ksql app list | grep "$KSQLDB_ENDPOINT" | awk '{print $1}')
ccloud ksql app describe $ksqlDBAppId -o json
ccloud ksql app configure-acls $ksqlDBAppId wikipedia.parsed.ccloud.replica
ksqlDBAppId=$(confluent ksql app list | grep "$KSQLDB_ENDPOINT" | awk '{print $1}')
confluent ksql app describe $ksqlDBAppId -o json
confluent ksql app configure-acls $ksqlDBAppId wikipedia.parsed.ccloud.replica
while read ksqlCmd; do
echo -e "\n$ksqlCmd\n"
curl -X POST $KSQLDB_ENDPOINT/ksql \
Expand Down
8 changes: 4 additions & 4 deletions scripts/ccloud/destroy-ccloud-workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ VALIDATE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"

source ${VALIDATE_DIR}/../helper/functions.sh

verify_installed ccloud || exit 1
verify_installed confluent || exit 1

if [ -z "$SERVICE_ACCOUNT_ID" ]; then
echo "ERROR: Must export parameter SERVICE_ACCOUNT_ID before running this script to destroy Confluent Cloud resources associated to that service account."
Expand All @@ -18,9 +18,9 @@ fi
curl -sS -o ccloud_library.sh https://raw.githubusercontent.com/confluentinc/examples/latest/utils/ccloud_library.sh
source ./ccloud_library.sh

# Log into Confluent Cloud CLI
# Log into Confluent CLI
echo
ccloud login --save || exit 1
confluent login --save || exit 1

#### Teardown ####

Expand Down Expand Up @@ -48,7 +48,7 @@ docker-compose exec kafka1 kafka-configs \
--delete-config confluent.telemetry.enabled,confluent.telemetry.api.key,confluent.telemetry.api.secret

echo "Destroying all Confluent Cloud resources"
ccloud api-key delete $METRICS_API_KEY
confluent api-key delete $METRICS_API_KEY
source "delta_configs/env.delta"
ccloud::destroy_ccloud_stack $SERVICE_ACCOUNT_ID

Expand Down
Loading

0 comments on commit 7b8fe4d

Please sign in to comment.