/* 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 obtain a copy of the License at https://www.gnu.org/licenses/agpl-3.0.html 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 settings import ( "k8s.libre.sh/application/settings/parameters" "k8s.libre.sh/interfaces" "k8s.libre.sh/meta" "k8s.libre.sh/objects" "sigs.k8s.io/controller-runtime/pkg/client" ) type Settings interface { GetMeta() meta.Instance GetConfig() Config SetDefaults() // Init(r interfaces.Reconcile, owner interfaces.Object) error Init(c client.Client, owner interfaces.Object) error GetCreateOptions() *CreateOptions GetObjects() map[int]objects.Object } func NewSettings(s Settings) *Component { return &Component{ CreateOptions: s.GetCreateOptions(), ConfigSpec: &ConfigSpec{ Sources: s.GetConfig().GetSources(), Parameters: s.GetConfig().GetParameters(), }, } } func TemplateValues(s Settings) map[string]interface{} { values := make(map[string]interface{}) keyPairValues := parameters.KeyPairValues(s.GetConfig().GetParameters()) values[s.GetMeta().GetComponent()] = keyPairValues return values }