@@ -116,6 +116,63 @@ func (c *Client) ensureImagePullSecretsPresent(namespace string, imagePullSecret
116
116
return nil
117
117
}
118
118
119
+ func (c * Client ) ensureEmbeddedClusterCAPresent (namespace string ) error {
120
+ if ! util .IsEmbeddedCluster () {
121
+ return nil
122
+ }
123
+
124
+ logger .Debugf ("ensuring embedded cluster ca present in namespace %s" , namespace )
125
+
126
+ clientset , err := k8sutil .GetClientset ()
127
+ if err != nil {
128
+ return errors .Wrap (err , "failed to get clientset" )
129
+ }
130
+
131
+ configMapName := os .Getenv ("SSL_CERT_CONFIGMAP" )
132
+ sourceConfigMap , err := clientset .CoreV1 ().ConfigMaps (util .AppNamespace ()).Get (context .TODO (), configMapName , metav1.GetOptions {})
133
+ if err != nil {
134
+ if ! kuberneteserrors .IsNotFound (err ) {
135
+ return errors .Wrap (err , "failed to get source configmap" )
136
+ }
137
+ // This would happen in older EC releases
138
+ return nil
139
+ }
140
+
141
+ destConfigMap := & corev1.ConfigMap {
142
+ TypeMeta : metav1.TypeMeta {
143
+ APIVersion : "v1" ,
144
+ Kind : "ConfigMap" ,
145
+ },
146
+ ObjectMeta : metav1.ObjectMeta {
147
+ Name : configMapName ,
148
+ Labels : sourceConfigMap .DeepCopy ().Labels ,
149
+ Annotations : sourceConfigMap .DeepCopy ().Annotations ,
150
+ Namespace : namespace ,
151
+ },
152
+ Data : sourceConfigMap .DeepCopy ().Data ,
153
+ }
154
+
155
+ _ , err = clientset .CoreV1 ().ConfigMaps (namespace ).Get (context .TODO (), configMapName , metav1.GetOptions {})
156
+ if err != nil {
157
+ if ! kuberneteserrors .IsNotFound (err ) {
158
+ return errors .Wrap (err , "failed to get destination configmap" )
159
+ }
160
+
161
+ _ , err = clientset .CoreV1 ().ConfigMaps (namespace ).Create (context .TODO (), destConfigMap , metav1.CreateOptions {})
162
+ if err != nil {
163
+ return errors .Wrap (err , "failed to create configmap" )
164
+ }
165
+ return nil
166
+ }
167
+
168
+ _ , err = clientset .CoreV1 ().ConfigMaps (namespace ).Update (context .TODO (), destConfigMap , metav1.UpdateOptions {})
169
+ if err != nil {
170
+ return errors .Wrap (err , "failed to update configmap" )
171
+ }
172
+
173
+ return nil
174
+ }
175
+
119
176
func (c * Client ) ensureResourcesPresent (deployArgs operatortypes.DeployAppArgs ) (* deployResult , error ) {
120
177
var deployRes deployResult
121
178
0 commit comments