-
Notifications
You must be signed in to change notification settings - Fork 117
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
Use triggerv2 controller in shared main #3558
Merged
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
cd2cbaa
Use triggerv2 controller in shared main
Cali0707 38db821
fixed broker deployment after v2 migration
Cali0707 52a46c8
updated consumer to properly reconcile new trigger filters
Cali0707 5697b7e
have namespaced broker reconcile data plane with stateful sets
Cali0707 f61df5b
fix permissions for statefulset
Cali0707 cc05ef5
fix error message
Cali0707 c6e70c4
update codegen
Cali0707 1c42c98
deploy the kafka-broker-receiver as a stateful set too
Cali0707 87a75ba
added broker migration post install job
Cali0707 f3304da
fix secret parsing for consumergroups
Cali0707 e0d8737
fix clusterrole for post install job
Cali0707 5bbb403
fix imports
Cali0707 528f899
correctly set consumer egress auth depending on secret format
Cali0707 107f00f
fix namespaced broker reconciliation of statefulsets
Cali0707 cf3820d
fix unit tests
Cali0707 426ee95
fix linter error
Cali0707 104c3bc
hack: set blockOwnerDeletion to false on consumergroups
Cali0707 5dcc93a
merged main
Cali0707 b25d2e8
Merge branch 'main' into use-triggerv2
Cali0707 e4a081f
fix: fixed consumergroup blockownerdeletion
Cali0707 a765040
hack: print cg in trigger status when cg is not ready
Cali0707 5aac963
Merge branch 'main' into use-triggerv2
Cali0707 8b4aba0
fixed merge conflict
Cali0707 70c1a38
Merge branch 'main' into use-triggerv2
Cali0707 ecc2285
fix: use kafka-broker-brokers-triggers for receiver cm
Cali0707 4b961a1
test fix: broker cm watcher watches correct cm
Cali0707 8424ad2
fix: OIDC works for triggerv2
Cali0707 1f84e84
use filtered informer
Cali0707 820e7b1
use filtered global resync for triggerv2
Cali0707 7fce2dc
maybe get more logs
Cali0707 3e76cbd
fix: upgrade tests cleanup triggerv2 resources
Cali0707 4b3776d
ignore not found error
Cali0707 9560405
upgrade tests fixes
Cali0707 cdd2d62
add logs to upgrade tests
Cali0707 e5aee80
fixed unit tests
Cali0707 9393f75
fix upgrade logger setup
Cali0707 9c54267
goimports
Cali0707 720bdef
fix linter error
Cali0707 d12c18f
use filtered global resync for namespaced triggers as well
Cali0707 8b07dc2
fix: triggerv2 supports cg id templates
Cali0707 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
control-plane/cmd/post-install/kafka_broker_deployment_deleter.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Copyright 2024 The Knative Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"time" | ||
|
||
apierrors "k8s.io/apimachinery/pkg/api/errors" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/util/wait" | ||
"k8s.io/client-go/kubernetes" | ||
"knative.dev/pkg/system" | ||
) | ||
|
||
type kafkaDeploymentDeleter struct { | ||
k8s kubernetes.Interface | ||
} | ||
|
||
func (k *kafkaDeploymentDeleter) DeleteBrokerDeployments(ctx context.Context) error { | ||
deployments := []string{ | ||
"kafka-broker-receiver", | ||
"kafka-broker-dispatcher", | ||
} | ||
|
||
for _, deployment := range deployments { | ||
if err := k.deleteDeployment(ctx, deployment); err != nil { | ||
return fmt.Errorf("failed to delete deployment %s: %v", deployment, err) | ||
} | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (k *kafkaDeploymentDeleter) deleteDeployment(ctx context.Context, deploymentName string) error { | ||
err := k.waiteStatefulSetExists(ctx, deploymentName) | ||
if err != nil { | ||
return fmt.Errorf("failed while waiting for statefulset to come up: %w", err) | ||
} | ||
|
||
err = k.k8s. | ||
AppsV1(). | ||
Deployments(system.Namespace()). | ||
Delete(ctx, deploymentName, metav1.DeleteOptions{}) | ||
if err != nil && !apierrors.IsNotFound(err) { | ||
return fmt.Errorf("failed to delete deployment %s/%s: %w", system.Namespace(), deploymentName, err) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (k *kafkaDeploymentDeleter) waiteStatefulSetExists(ctx context.Context, statefulSetName string) error { | ||
return wait.PollUntilContextTimeout(ctx, 10*time.Second, 10*time.Minute, false, func(ctx context.Context) (done bool, err error) { | ||
_, err = k.k8s.AppsV1().StatefulSets(system.Namespace()).Get(ctx, statefulSetName, metav1.GetOptions{}) | ||
if apierrors.IsNotFound(err) { | ||
return false, nil | ||
} | ||
if err != nil { | ||
return false, fmt.Errorf("failed to get statefulset %s/%s: %w", system.Namespace(), statefulSetName, err) | ||
} | ||
return true, nil | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
waite....
unless it's a word I don't know about