Skip to content

Conversation

jaellio
Copy link
Contributor

@jaellio jaellio commented Feb 15, 2023

Please provide a description of what this PR is for.

Updates the Istio/SPIRE integration doc and demo to reference
the SPIRE Controller Manager instead of the k8s workload
registrar.

Notable Changes:

  • Updates csi driver volume to explicitly specify readOnly. Encountered errors when not setting readOnly on the volume and only specifying it on the volumeMount.
  • Clarifies that the SPIRE Controller Manager does not provide the same automatic workload registration workflow as the k8s workload registrar. A ClusterSPIFFEID must be created.
  • Adds instructions to create a ClusterSPIFFEID, label the ingress-gateway deployment, and register an example workload
  • Updates the command to check if the identities were created for the workloads (ingress-gateway and sleep)
    • The previous command (kubectl exec -i -t $SPIRE_SERVER_POD -n spire -c spire-server -- /bin/sh -c "bin/spire-server entry show -socketPath /run/spire/sockets/server.sock") failed with the following error: Error: connection error: desc = "transport: error while dialing: dial unix /run/spire/sockets: connect: no such file or directory"
    • The new command is a simplified version: kubectl exec -t $SPIRE_SERVER_POD -n spire -c spire-server -- ./bin/spire-server entry show
  • Updates example for creating federated registration entries using the ClusterSPIFFEID
  • Adds a docs test for the automated Istio/SPIRE demo

Resolves #12577

And to help us figure out who should review this PR, please
put an X in all the areas that this PR affects.

  • Configuration Infrastructure
  • Docs
  • Installation
  • Networking
  • Performance and Scalability
  • Policies and Telemetry
  • Security
  • Test and Release
  • User Experience
  • Developer Infrastructure

@istio-testing
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@istio-testing istio-testing added the do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. label Feb 15, 2023
@istio-testing istio-testing added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 15, 2023
@jaellio
Copy link
Contributor Author

jaellio commented Feb 15, 2023

/test all

@frankbu
Copy link
Collaborator

frankbu commented Feb 15, 2023

This doc looks like a good candidate for a doc test: https://github.com/istio/istio.io/tree/master/tests#test-authoring-overview

That way you can be sure it continues to work over time.

@jaellio
Copy link
Contributor Author

jaellio commented Feb 15, 2023

This doc looks like a good candidate for a doc test: https://github.com/istio/istio.io/tree/master/tests#test-authoring-overview

That way you can be sure it continues to work over time.

Great idea, I'll add a test. Thanks for the info!

@istio-testing istio-testing added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 24, 2023
@jaellio jaellio marked this pull request as ready for review February 24, 2023 19:11
@jaellio jaellio requested a review from a team as a code owner February 24, 2023 19:11
@istio-testing istio-testing removed the do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. label Feb 24, 2023
Copy link
Contributor

@bleggett bleggett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jaellio
Copy link
Contributor Author

jaellio commented Feb 24, 2023

This PR should be retested after istio/istio#43346 is merged to verify the doc.test.profile_none_istio.io succeeds.

@jaellio jaellio added the do-not-merge Block automatic merging of a PR. label Feb 24, 2023
@ericvn
Copy link
Contributor

ericvn commented Feb 24, 2023

I hope that istio/istio#43346 will merge today, so the automation of the weekend should pull that commit into the test. Once that passes tests, is approved, and merged, we can retest this.

@jaellio
Copy link
Contributor Author

jaellio commented Feb 24, 2023

/test doc.test.profile_none

@kfaseela
Copy link
Member

/retest

@jaellio
Copy link
Contributor Author

jaellio commented Feb 27, 2023

Retesting after the completion of #12788
/retest

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 28, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@kfaseela
Copy link
Member

As a part of moving Istio under the CNCF, we will be updating the CLA requirements for contributing Istio to use the CNCF CLA. This will be a multi-stage process, which has already started. If you have not already signed the CNCF CLA, you may find instructions to do so here. We expect to remove the requirement for signing the Google CLA in the upcoming weeks. Thank you for your patience, and please respond here if you run into difficulty with the new CLA process.

# @setup profile=none
set +u # Do not exit when value is unset. CHECK_FILE in the IstioOperator might be unset
snip_define_istio_operator
if ! istioctl install --set tag="$TAG" --set hub="$HUB" --skip-confirmation -f ./istio.yaml
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Since the istio-ingressgateway will not be ready, this command will take at least 5 minutes to execute before it returns an error. I can set the readiness timeout on install to be less than 5 minutes, but I don't want this to cause the other components to fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be reasonable to set the readiness timeout to 30s or 1m?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand exactly why it is expected to time out, but would it be better if you use istioctl manifest generate | kubectl apply instead of istioctl install? https://preliminary.istio.io/latest/docs/setup/install/istioctl/#generate-a-manifest-before-installation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was installing Istio before applying the ClusterSPIFFEID. Therefore the istio-ingressgateway wasn't registered with SPIRE and couldn't obtain its certificates. The install command would timeout after 5 min of waiting for the gateway to be ready. This was the expected behavior given how the demo was organized. To improve the customer experience and testability of the demo I have modified the demo's workflow so that the ClusterSPIFFEID is created prior to installing Istio. The Istio installation should complete successfully with this change.

@jaellio jaellio removed the do-not-merge Block automatic merging of a PR. label Mar 1, 2023
jaellio added 2 commits March 1, 2023 15:10
Manager instead of k8s workload registration.

Signed-off-by: jaellio <[email protected]>
controller manager. During cleanup, removes generated istio.yaml
and chaim.pem files. Updates label to
spiffe.io/spire-managed-identity.

Signed-off-by: jaellio <[email protected]>
Created ClusterSPIFFEID before install istio. Previously install
would fail because the ingress gateway wasn't registered/

Signed-off-by: jaellio <[email protected]>
Copy link
Collaborator

@frankbu frankbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor suggestions, but otherwise LGTM.

1. Apply the configuration:

{{< text syntax=bash snip_id=none >}}
$ istioctl install --skip-confirmation -f ./istio.yaml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC, this call is expected to hang for 5 mins. If so, maybe it would be better to avoid that by using:

Suggested change
$ istioctl install --skip-confirmation -f ./istio.yaml
$ istioctl manifest generate --skip-confirmation -f ./istio.yaml | kubectl apply -f -

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking of adding tests and updating the demo for the manual registration option in a separate PR. Should I still include this change here? You are correct that this call will hang. Currently, this PR is focussing on the automatic registration/SPIRE controller manager integration option.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would, but it's up to you, esp. if you are planning to change it further in a followup PR soon.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to make sure using istioctl manifest generate doesn't break anything unexpectedly which I can confirm with a docs test for the manual registration option (and through manual testing). For example, if I updated istioctl install to istioctl manifest generate I would need to include the cmd to create the istio-system ns since it isn't created automatically.

@istio-testing istio-testing merged commit 127c4f2 into istio:master Mar 3, 2023
justedennnnn pushed a commit to justedennnnn/istio.io that referenced this pull request Jun 29, 2023
* Update Istio/SPIRE integration demo to use SPIRE Controller
Manager instead of k8s workload registration.

Signed-off-by: jaellio <[email protected]>

* Adds test for automatic workload registration via the SPIRE
controller manager. During cleanup, removes generated istio.yaml
and chaim.pem files. Updates label to
spiffe.io/spire-managed-identity.

Signed-off-by: jaellio <[email protected]>

* Adds missing newline

Signed-off-by: jaellio <[email protected]>

* Fix spelling error

Signed-off-by: jaellio <[email protected]>

* Add missing ns flag on role and rolebinding resource commands

Signed-off-by: jaellio <[email protected]>

* Delete sleep resources and uninstall before SPIRE

Signed-off-by: jaellio <[email protected]>

* Reconfigures demo so istio install is not expected to fail.
Created ClusterSPIFFEID before install istio. Previously install
would fail because the ingress gateway wasn't registered/

Signed-off-by: jaellio <[email protected]>

* Remove references to v1.14 and update required version to 1.14+

Signed-off-by: jaellio <[email protected]>

* Fix lint errors

Signed-off-by: jaellio <[email protected]>

---------

Signed-off-by: jaellio <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/security kind/docs size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use SPIRE Controller Manager instead of deprecated SPIRE Kubernetes Workload Registrar
7 participants