Newer
Older
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
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.
*/
"k8s.libre.sh/application/settings/parameters"
"k8s.libre.sh/meta"
"k8s.libre.sh/objects"
"k8s.libre.sh/objects/secret"
"sigs.k8s.io/controller-runtime/pkg/client"
GetMeta() meta.Instance
GetSecretMeta() meta.Instance
GetConfigMapMeta() meta.Instance
func NewSettings(s Settings) *Component {
return &Component{
CommonMeta: s.GetMeta().(*meta.ObjectMeta),
SecretMeta: s.GetSecretMeta().(*meta.ObjectMeta),
ConfigMeta: s.GetConfigMapMeta().(*meta.ObjectMeta),
ConfigRefs: s.GetConfig().GetConfigRefs(),
SecretRefs: s.GetConfig().GetSecretRefs(),
Parameters: s.GetConfig().GetParameters(),
},
}
cm := &configmap.ConfigMap{
ObjectMeta: &meta.ObjectMeta{},
}
secret := &secret.Secret{
ObjectMeta: &meta.ObjectMeta{},
}
meta.SetObjectMeta(s.GetConfigMapMeta(), cm.ObjectMeta)
meta.SetObjectMeta(s.GetSecretMeta(), secret.ObjectMeta)
for _, p := range *params.GetParameters() {
if p.MountType == parameters.MountEnvFile &&
p.Type == parameters.SecretParameter &&
len(p.Value) > 0 {
secret.Parameters = append(secret.Parameters, p)
if p.MountType == parameters.MountEnvFile &&
p.Type == parameters.ConfigParameter &&
len(p.Value) > 0 {
cm.Parameters = append(cm.Parameters, p)