Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 (the "License");
you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
https://www.gnu.org/licenses/agpl-3.0.html
Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS,
...
@@ -13,6 +13,12 @@ See the License for the specific language governing permissions and
...
@@ -13,6 +13,12 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
// Objects package contains core kubernetes resources definitions that can be included in an application CRD.
// The definitions are stripped down version with only specs that should be user-defined.
//
// Every objects definied in this package implements a mutate interface which can create or update its associated kubernetes resource.
//
// All those objects also implements the Object inteface from which we can create an object syncer - see https://github.com/presslabs/controller-util/syncer
packageobjects
packageobjects
import(
import(
...
@@ -22,12 +28,15 @@ import (
...
@@ -22,12 +28,15 @@ import (
"github.com/presslabs/controller-util/syncer"
"github.com/presslabs/controller-util/syncer"
)
)
// Object interface must be supported by all types that want to sync an object.
// The object interface provides a mutate function and a runtime.Object that can be used in controller-runtime CreateOrUpdate
typeObjectinterface{
typeObjectinterface{
meta.Instance
meta.Instance
Mutate(objinterfaces.Object)error
Mutate(objinterfaces.Object)error
GetObject()interfaces.Object
GetObject()interfaces.Object
}
}
// NewObjectSyncer returns a syncer interface from https://github.com/presslabs/controller-util/syncer which can reconcile an object, create events and logs.