@@ -2856,6 +2856,75 @@ metricsServer:
28562856 require .Equal (t , "383c7cmidrae2" , podAnnotations ["monitoring.openshift.io/serving-ca-secret-hash" ])
28572857}
28582858
2859+ func TestMetricsServerReadinessProbe (t * testing.T ) {
2860+ c , err := NewConfigFromString ("" , true )
2861+ if err != nil {
2862+ t .Fatal (err )
2863+ }
2864+
2865+ c .SetImages (map [string ]string {
2866+ "kube-metrics-server" : "docker.io/openshift/origin-kube-metrics-server:latest" ,
2867+ })
2868+
2869+ f := NewFactory ("openshift-monitoring" , "openshift-user-workload-monitoring" , c , & fakeInfrastructureReader {}, & fakeProxyReader {}, NewAssets (assetsPath ), & APIServerConfig {}, & configv1.Console {})
2870+ kubeletCABundle := & v1.ConfigMap {
2871+ ObjectMeta : metav1.ObjectMeta {
2872+ Name : "kubelet-serving-ca-bundle" ,
2873+ Namespace : "openshift-monitoring" ,
2874+ },
2875+ Data : map [string ]string {
2876+ "ca-bundle.crt" : "ca-certificate" ,
2877+ },
2878+ }
2879+ servingCASecret := & v1.Secret {
2880+ ObjectMeta : metav1.ObjectMeta {
2881+ Name : "metrics-server-tls" ,
2882+ Namespace : "openshift-monitoring" ,
2883+ },
2884+ Data : map [string ][]byte {
2885+ "tls.crt" : []byte ("foo" ),
2886+ "tls.key" : []byte ("bar" ),
2887+ },
2888+ }
2889+ metricsClientSecret := & v1.Secret {
2890+ ObjectMeta : metav1.ObjectMeta {
2891+ Name : "metrics-client-cert" ,
2892+ Namespace : "openshift-monitoring" ,
2893+ },
2894+ Data : map [string ][]byte {
2895+ "tls.crt" : []byte ("bar" ),
2896+ "tls.key" : []byte ("foo" ),
2897+ },
2898+ }
2899+ apiAuthConfigMapData := map [string ]string {
2900+ "requestheader-allowed-names" : "" ,
2901+ "requestheader-extra-headers-prefix" : "" ,
2902+ "requestheader-group-headers" : "" ,
2903+ "requestheader-username-headers" : "" ,
2904+ }
2905+
2906+ d , err := f .MetricsServerDeployment ("foo" , kubeletCABundle , servingCASecret , metricsClientSecret , apiAuthConfigMapData )
2907+ if err != nil {
2908+ t .Fatal (err )
2909+ }
2910+
2911+ for _ , container := range d .Spec .Template .Spec .Containers {
2912+ if container .Name == "metrics-server" {
2913+ if container .ReadinessProbe .HTTPGet .Path != "/livez" {
2914+ t .Fatalf ("expected readiness probe's path to be '/livez', got %q" , container .ReadinessProbe .HTTPGet .Path )
2915+ }
2916+
2917+ if container .StartupProbe .HTTPGet .Path != "/readyz" {
2918+ t .Fatalf ("expected startup probe's path to be '/readyz', got %q" , container .StartupProbe .HTTPGet .Path )
2919+ }
2920+
2921+ return
2922+ }
2923+ }
2924+
2925+ t .Fatalf ("failed to find container %q" , "metrics-server" )
2926+ }
2927+
28592928func TestMetricsServerAuditLog (t * testing.T ) {
28602929 argsForProfile := func (profile string ) []string {
28612930 return []string {
0 commit comments