core: make code changes to support latest cntrl runtime

making necessary code changes to support controller
runtime version.

Signed-off-by: subhamkrai <srai@redhat.com>
(cherry picked from commit bf7daccf60)
This commit is contained in:
subhamkrai authored and mergify-bot committed 2022-04-20 17:52:53 +00:00
1 parent e1dee66aaa
commit 5328491880
6 files changed
+30 -30

No files matched your search

+1 -1
View File
@@ -72,7 +72,7 @@ func GetProbeWithDefaults(desiredProbe, currentProbe *v1.Probe) *v1.Probe {
//
// Let's always force the default handler, there is no reason to change it anyway since the underlying content is generated based on the daemon's name
// so we can not make it generic via the spec
newProbe.Handler = currentProbe.Handler
newProbe.ProbeHandler = currentProbe.ProbeHandler
// If the user has not specified thresholds and timeouts, set them to the same values as
// in the default liveness probe created by Rook.
+11 -11
View File
@@ -56,7 +56,7 @@ func TestConfigureLivenessProbe(t *testing.T) {
func configLivenessProbeHelper(t *testing.T, keyType cephv1.KeyType, livenessProbes map[cephv1.KeyType]*cephv1.ProbeSpec) {
p := &v1.Probe{
Handler: v1.Handler{
ProbeHandler: v1.ProbeHandler{
HTTPGet: &v1.HTTPGetAction{
Path: "/",
Port: intstr.FromInt(8080),
@@ -77,7 +77,7 @@ func configLivenessProbeHelper(t *testing.T, keyType cephv1.KeyType, livenessPro
func integrationLivenessProbeCheck(t *testing.T, keyType cephv1.KeyType, livenessProbes map[cephv1.KeyType]*cephv1.ProbeSpec) {
t.Run("integration check: configured probes should override values", func(t *testing.T) {
defaultProbe := &v1.Probe{
Handler: v1.Handler{
ProbeHandler: v1.ProbeHandler{
HTTPGet: &v1.HTTPGetAction{
Path: "/",
Port: intstr.FromInt(8443),
@@ -85,7 +85,7 @@ func integrationLivenessProbeCheck(t *testing.T, keyType cephv1.KeyType, livenes
},
}
userProbe := &v1.Probe{
Handler: v1.Handler{
ProbeHandler: v1.ProbeHandler{
HTTPGet: &v1.HTTPGetAction{
Path: "/custom/path",
Port: intstr.FromInt(8080),
@@ -108,7 +108,7 @@ func integrationLivenessProbeCheck(t *testing.T, keyType cephv1.KeyType, livenes
// the resultant container's startup probe should have been overridden, but the handler
// should always be the rook-given default
expectedProbe := *userProbe
expectedProbe.Handler = defaultProbe.Handler
expectedProbe.ProbeHandler = defaultProbe.ProbeHandler
assert.Equal(t, &expectedProbe, got.StartupProbe)
})
}
@@ -140,7 +140,7 @@ func TestConfigureStartupProbe(t *testing.T) {
func configStartupProbeHelper(t *testing.T, keyType cephv1.KeyType, startupProbes map[cephv1.KeyType]*cephv1.ProbeSpec) {
p := &v1.Probe{
Handler: v1.Handler{
ProbeHandler: v1.ProbeHandler{
HTTPGet: &v1.HTTPGetAction{
Path: "/",
Port: intstr.FromInt(8080),
@@ -160,7 +160,7 @@ func configStartupProbeHelper(t *testing.T, keyType cephv1.KeyType, startupProbe
func integrationStartupProbeCheck(t *testing.T, keyType cephv1.KeyType, startupProbes map[cephv1.KeyType]*cephv1.ProbeSpec) {
t.Run("integration check: configured probes should override values", func(t *testing.T) {
defaultProbe := &v1.Probe{
Handler: v1.Handler{
ProbeHandler: v1.ProbeHandler{
HTTPGet: &v1.HTTPGetAction{
Path: "/",
Port: intstr.FromInt(8443),
@@ -168,7 +168,7 @@ func integrationStartupProbeCheck(t *testing.T, keyType cephv1.KeyType, startupP
},
}
userProbe := &v1.Probe{
Handler: v1.Handler{
ProbeHandler: v1.ProbeHandler{
HTTPGet: &v1.HTTPGetAction{
Path: "/custom/path",
Port: intstr.FromInt(8080),
@@ -191,7 +191,7 @@ func integrationStartupProbeCheck(t *testing.T, keyType cephv1.KeyType, startupP
// the resultant container's startup probe should have been overridden, but the handler
// should always be the rook-given default
expectedProbe := *userProbe
expectedProbe.Handler = defaultProbe.Handler
expectedProbe.ProbeHandler = defaultProbe.ProbeHandler
assert.Equal(t, &expectedProbe, got.StartupProbe)
})
}
@@ -199,7 +199,7 @@ func integrationStartupProbeCheck(t *testing.T, keyType cephv1.KeyType, startupP
func TestGetProbeWithDefaults(t *testing.T) {
t.Run("using default probe", func(t *testing.T) {
currentProb := &v1.Probe{
Handler: v1.Handler{
ProbeHandler: v1.ProbeHandler{
Exec: &v1.ExecAction{
// Example:
Command: []string{
@@ -221,7 +221,7 @@ func TestGetProbeWithDefaults(t *testing.T) {
t.Run("overriding default probes", func(t *testing.T) {
currentProb := &v1.Probe{
Handler: v1.Handler{
ProbeHandler: v1.ProbeHandler{
Exec: &v1.ExecAction{
// Example:
Command: []string{
@@ -237,7 +237,7 @@ func TestGetProbeWithDefaults(t *testing.T) {
}
desiredProbe := &v1.Probe{
Handler: v1.Handler{
ProbeHandler: v1.ProbeHandler{
Exec: &v1.ExecAction{
// Example:
Command: []string{
+1 -1
View File
@@ -561,7 +561,7 @@ func GenerateLivenessProbeExecDaemon(daemonType, daemonID string) *v1.Probe {
confDaemon := getDaemonConfig(daemonType, daemonID)
return &v1.Probe{
Handler: v1.Handler{
ProbeHandler: v1.ProbeHandler{
Exec: &v1.ExecAction{
// Run with env -i to clean env variables in the exec context
// This avoids conflict with the CEPH_ARGS env
+1 -1
View File
@@ -157,7 +157,7 @@ func TestGenerateLivenessProbeExecDaemon(t *testing.T) {
"ceph --admin-daemon /run/ceph/ceph-osd.0.asok status",
}
assert.Equal(t, expectedCommand, probe.Handler.Exec.Command)
assert.Equal(t, expectedCommand, probe.ProbeHandler.Exec.Command)
assert.Equal(t, livenessProbeInitialDelaySeconds, probe.InitialDelaySeconds)
// test with a mon so the delay should be 10
+2 -2
View File
@@ -376,7 +376,7 @@ func configureReadinessProbe(container *v1.Container, healthCheck cephv1.BucketH
func (c *clusterConfig) defaultLivenessProbe() *v1.Probe {
return &v1.Probe{
Handler: v1.Handler{
ProbeHandler: v1.ProbeHandler{
TCPSocket: &v1.TCPSocketAction{
Port: c.generateProbePort(),
},
@@ -387,7 +387,7 @@ func (c *clusterConfig) defaultLivenessProbe() *v1.Probe {
func (c *clusterConfig) defaultReadinessProbe() *v1.Probe {
return &v1.Probe{
Handler: v1.Handler{
ProbeHandler: v1.ProbeHandler{
HTTPGet: &v1.HTTPGetAction{
Path: readinessProbePath,
Port: c.generateProbePort(),
+14 -14
View File
@@ -308,7 +308,7 @@ func TestDefaultLivenessProbe(t *testing.T) {
}
desiredProbe := &v1.Probe{
Handler: v1.Handler{
ProbeHandler: v1.ProbeHandler{
TCPSocket: &v1.TCPSocketAction{
Port: intstr.FromInt(8080),
},
@@ -324,7 +324,7 @@ func TestDefaultLivenessProbe(t *testing.T) {
c.store.Spec.Gateway.SecurePort = 0
c.clusterSpec.Network.HostNetwork = true
p = c.defaultLivenessProbe()
desiredProbe.Handler.TCPSocket.Port = intstr.FromInt(123)
desiredProbe.ProbeHandler.TCPSocket.Port = intstr.FromInt(123)
assert.Equal(t, desiredProbe, p)
// SSL - HostNetwork is enabled
@@ -332,7 +332,7 @@ func TestDefaultLivenessProbe(t *testing.T) {
c.store.Spec.Gateway.SecurePort = 321
c.store.Spec.Gateway.SSLCertificateRef = "foo"
p = c.defaultLivenessProbe()
desiredProbe.Handler.TCPSocket.Port = intstr.FromInt(321)
desiredProbe.ProbeHandler.TCPSocket.Port = intstr.FromInt(321)
assert.Equal(t, desiredProbe, p)
// Both Non-SSL and SSL are enabled
@@ -340,7 +340,7 @@ func TestDefaultLivenessProbe(t *testing.T) {
c.store.Spec.Gateway.Port = 123
c.store.Spec.Gateway.SecurePort = 321
p = c.defaultLivenessProbe()
desiredProbe.Handler.TCPSocket.Port = intstr.FromInt(123)
desiredProbe.ProbeHandler.TCPSocket.Port = intstr.FromInt(123)
assert.Equal(t, desiredProbe, p)
}
@@ -356,7 +356,7 @@ func TestDefaultStartupProbe(t *testing.T) {
}
desiredProbe := &v1.Probe{
Handler: v1.Handler{
ProbeHandler: v1.ProbeHandler{
TCPSocket: &v1.TCPSocketAction{
Port: intstr.FromInt(8080),
},
@@ -374,7 +374,7 @@ func TestDefaultStartupProbe(t *testing.T) {
c.store.Spec.Gateway.SecurePort = 0
c.clusterSpec.Network.HostNetwork = true
p = c.defaultStartupProbe()
desiredProbe.Handler.TCPSocket.Port = intstr.FromInt(123)
desiredProbe.ProbeHandler.TCPSocket.Port = intstr.FromInt(123)
assert.Equal(t, desiredProbe, p)
// SSL - HostNetwork is enabled
@@ -382,7 +382,7 @@ func TestDefaultStartupProbe(t *testing.T) {
c.store.Spec.Gateway.SecurePort = 321
c.store.Spec.Gateway.SSLCertificateRef = "foo"
p = c.defaultStartupProbe()
desiredProbe.Handler.TCPSocket.Port = intstr.FromInt(321)
desiredProbe.ProbeHandler.TCPSocket.Port = intstr.FromInt(321)
assert.Equal(t, desiredProbe, p)
// Both Non-SSL and SSL are enabled
@@ -390,7 +390,7 @@ func TestDefaultStartupProbe(t *testing.T) {
c.store.Spec.Gateway.Port = 123
c.store.Spec.Gateway.SecurePort = 321
p = c.defaultStartupProbe()
desiredProbe.Handler.TCPSocket.Port = intstr.FromInt(123)
desiredProbe.ProbeHandler.TCPSocket.Port = intstr.FromInt(123)
assert.Equal(t, desiredProbe, p)
}
@@ -406,7 +406,7 @@ func TestDefaultReadinessProbe(t *testing.T) {
}
desiredProbe := &v1.Probe{
Handler: v1.Handler{
ProbeHandler: v1.ProbeHandler{
HTTPGet: &v1.HTTPGetAction{
Path: readinessProbePath,
Port: intstr.FromInt(8080),
@@ -424,7 +424,7 @@ func TestDefaultReadinessProbe(t *testing.T) {
c.store.Spec.Gateway.SecurePort = 0
c.clusterSpec.Network.HostNetwork = true
p = c.defaultReadinessProbe()
desiredProbe.Handler.HTTPGet.Port = intstr.FromInt(123)
desiredProbe.ProbeHandler.HTTPGet.Port = intstr.FromInt(123)
assert.Equal(t, desiredProbe, p)
// SSL - HostNetwork is enabled
@@ -432,8 +432,8 @@ func TestDefaultReadinessProbe(t *testing.T) {
c.store.Spec.Gateway.SecurePort = 321
c.store.Spec.Gateway.SSLCertificateRef = "foo"
p = c.defaultReadinessProbe()
desiredProbe.Handler.HTTPGet.Port = intstr.FromInt(321)
desiredProbe.Handler.HTTPGet.Scheme = v1.URISchemeHTTPS
desiredProbe.ProbeHandler.HTTPGet.Port = intstr.FromInt(321)
desiredProbe.ProbeHandler.HTTPGet.Scheme = v1.URISchemeHTTPS
assert.Equal(t, desiredProbe, p)
// Both Non-SSL and SSL are enabled
@@ -441,8 +441,8 @@ func TestDefaultReadinessProbe(t *testing.T) {
c.store.Spec.Gateway.Port = 123
c.store.Spec.Gateway.SecurePort = 321
p = c.defaultReadinessProbe()
desiredProbe.Handler.HTTPGet.Port = intstr.FromInt(123)
desiredProbe.Handler.HTTPGet.Scheme = v1.URISchemeHTTP
desiredProbe.ProbeHandler.HTTPGet.Port = intstr.FromInt(123)
desiredProbe.ProbeHandler.HTTPGet.Scheme = v1.URISchemeHTTP
assert.Equal(t, desiredProbe, p)
}