@@ -7,17 +7,23 @@ import (
77 "github.com/google/go-cmp/cmp"
88 "github.com/google/go-cmp/cmp/cmpopts"
99
10+ operatorv1 "github.com/openshift/api/operator/v1"
1011 "github.com/openshift/cluster-ingress-operator/pkg/manifests"
1112 "github.com/openshift/cluster-ingress-operator/pkg/operator/controller"
1213
1314 appsv1 "k8s.io/api/apps/v1"
1415 corev1 "k8s.io/api/core/v1"
1516 "k8s.io/apimachinery/pkg/api/errors"
17+ "k8s.io/apimachinery/pkg/types"
1618)
1719
1820// ensureCanaryDaemonSet ensures the canary daemonset exists
1921func (r * reconciler ) ensureCanaryDaemonSet () (bool , * appsv1.DaemonSet , error ) {
20- desired := desiredCanaryDaemonSet (r .config .CanaryImage )
22+ secretName , err := r .canarySecretName (controller .CanaryDaemonSetName ().Namespace )
23+ if err != nil {
24+ return false , nil , err
25+ }
26+ desired := desiredCanaryDaemonSet (r .config .CanaryImage , secretName .Name )
2127 haveDs , current , err := r .currentCanaryDaemonSet ()
2228 if err != nil {
2329 return false , nil , err
@@ -80,7 +86,7 @@ func (r *reconciler) updateCanaryDaemonSet(current, desired *appsv1.DaemonSet) (
8086
8187// desiredCanaryDaemonSet returns the desired canary daemonset read in
8288// from manifests
83- func desiredCanaryDaemonSet (canaryImage string ) * appsv1.DaemonSet {
89+ func desiredCanaryDaemonSet (canaryImage , secretName string ) * appsv1.DaemonSet {
8490 daemonset := manifests .CanaryDaemonSet ()
8591 name := controller .CanaryDaemonSetName ()
8692 daemonset .Name = name .Name
@@ -97,6 +103,8 @@ func desiredCanaryDaemonSet(canaryImage string) *appsv1.DaemonSet {
97103 daemonset .Spec .Template .Spec .Containers [0 ].Image = canaryImage
98104 daemonset .Spec .Template .Spec .Containers [0 ].Command = []string {"ingress-operator" , CanaryHealthcheckCommand }
99105
106+ daemonset .Spec .Template .Spec .Volumes [0 ].Secret .SecretName = secretName
107+
100108 return daemonset
101109}
102110
@@ -196,3 +204,15 @@ func cmpTolerations(a, b corev1.Toleration) bool {
196204 }
197205 return true
198206}
207+
208+ func (r * reconciler ) canarySecretName (Namespace string ) (types.NamespacedName , error ) {
209+ defaultIC := operatorv1.IngressController {}
210+ defaultICName := types.NamespacedName {
211+ Name : manifests .DefaultIngressControllerName ,
212+ Namespace : r .config .Namespace ,
213+ }
214+ if err := r .client .Get (context .TODO (), defaultICName , & defaultIC ); err != nil {
215+ return types.NamespacedName {}, err
216+ }
217+ return controller .RouterEffectiveDefaultCertificateSecretName (& defaultIC , Namespace ), nil
218+ }
0 commit comments