-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhancement (CollaSet): support pod deletion indication AND resourceC…
…ontext reclaim controller
- Loading branch information
Showing
16 changed files
with
1,134 additions
and
25 deletions.
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
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,25 @@ | ||
/* | ||
Copyright 2023 The KusionStack 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 controllers | ||
|
||
import ( | ||
"kusionstack.io/kafed/pkg/controllers/poddeletion" | ||
) | ||
|
||
func init() { | ||
AddToManagerFuncs = append(AddToManagerFuncs, poddeletion.Add) | ||
} |
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,25 @@ | ||
/* | ||
Copyright 2023 The KusionStack 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 controllers | ||
|
||
import ( | ||
"kusionstack.io/kafed/pkg/controllers/resourcecontext" | ||
) | ||
|
||
func init() { | ||
AddToManagerFuncs = append(AddToManagerFuncs, resourcecontext.Add) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
Copyright 2023 The KusionStack 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 poddeletion | ||
|
||
import ( | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
"kusionstack.io/kafed/pkg/controllers/utils/expectations" | ||
) | ||
|
||
var ( | ||
// activeExpectations is used to check the cache in informer is updated, before reconciling. | ||
activeExpectations *expectations.ActiveExpectations | ||
) | ||
|
||
func InitExpectations(c client.Client) { | ||
activeExpectations = expectations.NewActiveExpectations(c) | ||
} |
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,57 @@ | ||
/* | ||
Copyright 2023 The KusionStack 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 poddeletion | ||
|
||
import ( | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
"kusionstack.io/kafed/pkg/controllers/utils/podopslifecycle" | ||
) | ||
|
||
var ( | ||
OpsLifecycleAdapter = &PodDeleteOpsLifecycleAdapter{} | ||
) | ||
|
||
// PodDeleteOpsLifecycleAdapter tells PodOpsLifecycle the Pod deletion ops info | ||
type PodDeleteOpsLifecycleAdapter struct { | ||
} | ||
|
||
// GetID indicates ID of one PodOpsLifecycle | ||
func (a *PodDeleteOpsLifecycleAdapter) GetID() string { | ||
return "pod-delete" | ||
} | ||
|
||
// GetType indicates type for an Operator | ||
func (a *PodDeleteOpsLifecycleAdapter) GetType() podopslifecycle.OperationType { | ||
return podopslifecycle.OpsLifecycleTypeDelete | ||
} | ||
|
||
// AllowMultiType indicates whether multiple IDs which have the same Type are allowed | ||
func (a *PodDeleteOpsLifecycleAdapter) AllowMultiType() bool { | ||
return true | ||
} | ||
|
||
// WhenBegin will be executed when begin a lifecycle | ||
func (a *PodDeleteOpsLifecycleAdapter) WhenBegin(pod client.Object) (bool, error) { | ||
return false, nil | ||
} | ||
|
||
// WhenFinish will be executed when finish a lifecycle | ||
func (a *PodDeleteOpsLifecycleAdapter) WhenFinish(pod client.Object) (bool, error) { | ||
|
||
return false, nil | ||
} |
Oops, something went wrong.