// -
-// ========================LICENSE_START=================================
-// O-RAN-SC
-// %%
-// Copyright (C) 2022: Nordix Foundation
-// %%
-// 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
+// ========================LICENSE_START=================================
+// O-RAN-SC
+// %%
+// Copyright (C) 2022-2023: Nordix Foundation
+// %%
+// 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
//
-// 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.
-// ========================LICENSE_END===================================
+// 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.
+// ========================LICENSE_END===================================
package main
import (
)
type ServerParameters struct {
- port string // webhook server port
- certFile string // path to the x509 cert
- keyFile string // path to the x509 private key
- hostPath string // path to the x509 private key
+ port string // webhook server port
+ certFile string // path to the x509 cert
+ keyFile string // path to the x509 private key
+ secret string
}
type patchOperation struct {
flag.StringVar(¶meters.port, "port", "8443", "Webhook server port.")
flag.StringVar(¶meters.certFile, "tlsCertFile", "/certs/tls.crt", "File containing the x509 certificate")
flag.StringVar(¶meters.keyFile, "tlsKeyFile", "/certs/tls.key", "File containing the x509 private key")
- flag.StringVar(¶meters.hostPath, "hostPath", "/var/rapps/certs", "Host Path containing rapp cert files")
+ flag.StringVar(¶meters.secret, "secret", "cm-keycloak-client-certs", "Secret containing rapp cert files")
flag.Parse()
http.HandleFunc("/inject-sidecar", HandleSideCarInjection)
Value: containers,
})
- pathType := v1.HostPathDirectoryOrCreate
- pathTypePtr := &pathType
var volumes []v1.Volume
volumes = append(volumes, pod.Spec.Volumes...)
volume := v1.Volume{
Name: "certsdir",
VolumeSource: v1.VolumeSource{
- HostPath: &v1.HostPathVolumeSource{
- Path: parameters.hostPath,
- Type: pathTypePtr,
+ Secret: &v1.SecretVolumeSource{
+ SecretName: parameters.secret,
},
},
}
fmt.Println(volumes)
patches = append(patches, patchOperation{
- Op: "add",
- Path: "/spec/volumes",
- Value: volumes,
+ Op: "add",
+ Path: "/spec/volumes",
+ Value: volumes,
})
fmt.Println(patches)