Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proxy: slim Istio agent dependencies #50212

Merged
merged 4 commits into from
Apr 4, 2024
Merged

Conversation

kyessenov
Copy link
Contributor

Continuation of #50134 to apply to pkg/istio-agent. This leaves just the SDS server to finish.

Change-Id: Ib8ca017c2b86b84c9bff9b818ef6fa531e5e46a8
Signed-off-by: Kuat Yessenov <kuat@google.com>
Change-Id: Iff0c64bb7b806734be402f95129bf788d332525a
Signed-off-by: Kuat Yessenov <kuat@google.com>
@kyessenov kyessenov requested review from a team as code owners April 2, 2024 21:23
@istio-testing istio-testing added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 2, 2024
@kyessenov kyessenov added the release-notes-none Indicates a PR that does not require release notes. label Apr 2, 2024
@kyessenov
Copy link
Contributor Author

/retest

@@ -222,7 +222,7 @@ func initStatusServer(
agent *istio_agent.Agent,
shutdown context.CancelFunc,
) error {
o := options.NewStatusServerOptions(proxy, proxyConfig, agent)
o := options.NewStatusServerOptions(proxy.IsIPv6(), proxy.Type, proxyConfig, agent)
Copy link
Member

Choose a reason for hiding this comment

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

Are we only trying to slim the library, not the cmd itself? If so, why? If not, how does it help to just make the libraries slim?

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 can revert this change. I can't finish changing pilot-agent because of that SDS import. Yes, I tried to move model.Proxy into pkg/model but that causes too much of a change if we embed a struct. So I think it's better to copy just the functions we need.

Change-Id: Ia3ab68417f892843e948e6e91f2730568e54e4d0
Signed-off-by: Kuat Yessenov <kuat@google.com>
Change-Id: I3377a1783b813d50032fe1df9fe8e40f4843ea41
Signed-off-by: Kuat Yessenov <kuat@google.com>
@kyessenov kyessenov requested a review from a team as a code owner April 2, 2024 22:05
@@ -71,6 +73,9 @@ func NewAgentOptions(proxy *model.Proxy, cfg *meshconfig.ProxyConfig) *istioagen
DualStack: features.EnableDualStack,
UseExternalWorkloadSDS: useExternalWorkloadSDSEnv,
MetadataDiscovery: enableWDSEnv,
SDSFactory: func(options *security.Options, workloadSecretCache security.SecretManager, pkpConf *meshconfig.PrivateKeyProvider) istioagent.SDSService {
Copy link
Member

Choose a reason for hiding this comment

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

How does this help reduce imports? We still import sds and would always do so, even if the underlying sds.newServer is later changed to import less

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's temporary so we can lock down all of pkg/istio-agent. I don't know when we can convert SDS to be slim. Once that is done, we can simplify. CC @keithmattix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we get this in while we sort out SDS?

@kyessenov
Copy link
Contributor Author

/retest

@@ -71,6 +73,9 @@ func NewAgentOptions(proxy *model.Proxy, cfg *meshconfig.ProxyConfig) *istioagen
DualStack: features.EnableDualStack,
UseExternalWorkloadSDS: useExternalWorkloadSDSEnv,
MetadataDiscovery: enableWDSEnv,
SDSFactory: func(options *security.Options, workloadSecretCache security.SecretManager, pkpConf *meshconfig.PrivateKeyProvider) istioagent.SDSService {
return sds.NewServer(options, workloadSecretCache, pkpConf)
},
Copy link
Contributor

Choose a reason for hiding this comment

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

I was wondering - can we refactor the code so that components like SDS are in their own package, and the agent uses conditional compilation to load them ? Envoy using SDS to get certs from Istiod is great, but the agent use of SDS has always been over-complex and not necessary.

If we move to a model where Sidecar is also sandwiched - ztunnel taking care of security - we can greatly simplify and reduce the code ( and risks ), while keeping most of the sidecar functionality and benefits.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Go plugins are terrible, so dynamic module loading is unlikely to work. Wasm was suggested, but then these plugins are gRPC heavy which also don't work well in Wasm. My proposal was to just use files as SDS data, and then run the providers in a separate, optional process, which eventually would be replaced by kubernetes/enhancements#4318

Copy link
Contributor

@costinm costinm left a comment

Choose a reason for hiding this comment

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

Looks good.

I was looking at Envoy Gateway - they seem to run envoy directly without any agent. I wonder if an experiment to run Istio sidecars and gateways without any agent would be possible...

@kyessenov
Copy link
Contributor Author

@costinm That's not true, Envoy gateway has an agent https://github.com/envoyproxy/gateway/blob/main/internal/cmd/server.go. You have to have an agent on k8s because Envoy is not k8s-native. We can leverage any improvement here in Envoy, but that will take time.

@costinm
Copy link
Contributor

costinm commented Apr 3, 2024 via email

@istio-testing istio-testing merged commit 903ba1a into istio:master Apr 4, 2024
29 checks passed
@kyessenov
Copy link
Contributor Author

@costinm The challenge is the build. Yes, I think it would be nice to run with files, without SDS, but then we need a separate build with or without SDS. We should certainly pursue that for Google build, but the OSS needs to through a long migration process to shed the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes-none Indicates a PR that does not require release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants