replace deprecated pointer funcs

This commit is contained in:
Pires
2023-03-13 10:51:22 +00:00
committed by Pires
parent 109b1eed8b
commit eb5d959215
2 changed files with 6 additions and 6 deletions

View File

@@ -334,7 +334,7 @@ func getEnvironmentVariableValue(ctx context.Context, env *corev1.EnvVar, mappin
return getEnvironmentVariableValueWithValueFrom(ctx, env, mappingFunc, pod, container, rm, recorder) return getEnvironmentVariableValueWithValueFrom(ctx, env, mappingFunc, pod, container, rm, recorder)
} }
// Handle values that have been directly provided after expanding variable references. // Handle values that have been directly provided after expanding variable references.
return pointer.StringPtr(expansion.Expand(env.Value, mappingFunc)), nil return pointer.String(expansion.Expand(env.Value, mappingFunc)), nil
} }
func getEnvironmentVariableValueWithValueFrom(ctx context.Context, env *corev1.EnvVar, mappingFunc func(string) string, pod *corev1.Pod, container *corev1.Container, rm *manager.ResourceManager, recorder record.EventRecorder) (*string, error) { func getEnvironmentVariableValueWithValueFrom(ctx context.Context, env *corev1.EnvVar, mappingFunc func(string) string, pod *corev1.Pod, container *corev1.Container, rm *manager.ResourceManager, recorder record.EventRecorder) (*string, error) {
@@ -411,7 +411,7 @@ func getEnvironmentVariableValueWithValueFromConfigMapKeyRef(ctx context.Context
return nil, fmt.Errorf("configmap %q doesn't contain the %q key required by pod %s", vf.Name, vf.Key, pod.Name) return nil, fmt.Errorf("configmap %q doesn't contain the %q key required by pod %s", vf.Name, vf.Key, pod.Name)
} }
// Populate the environment variable and continue on to the next reference. // Populate the environment variable and continue on to the next reference.
return pointer.StringPtr(keyValue), nil return pointer.String(keyValue), nil
} }
func getEnvironmentVariableValueWithValueFromSecretKeyRef(ctx context.Context, env *corev1.EnvVar, mappingFunc func(string) string, pod *corev1.Pod, container *corev1.Container, rm *manager.ResourceManager, recorder record.EventRecorder) (*string, error) { func getEnvironmentVariableValueWithValueFromSecretKeyRef(ctx context.Context, env *corev1.EnvVar, mappingFunc func(string) string, pod *corev1.Pod, container *corev1.Container, rm *manager.ResourceManager, recorder record.EventRecorder) (*string, error) {
@@ -463,7 +463,7 @@ func getEnvironmentVariableValueWithValueFromSecretKeyRef(ctx context.Context, e
return nil, fmt.Errorf("secret %q doesn't contain the %q key required by pod %s", vf.Name, vf.Key, pod.Name) return nil, fmt.Errorf("secret %q doesn't contain the %q key required by pod %s", vf.Name, vf.Key, pod.Name)
} }
// Populate the environment variable and continue on to the next reference. // Populate the environment variable and continue on to the next reference.
return pointer.StringPtr(string(keyValue)), nil return pointer.String(string(keyValue)), nil
} }
// Handle population from a field (downward API). // Handle population from a field (downward API).
@@ -476,7 +476,7 @@ func getEnvironmentVariableValueWithValueFromFieldRef(ctx context.Context, env *
return nil, err return nil, err
} }
return pointer.StringPtr(runtimeVal), nil return pointer.String(runtimeVal), nil
} }
// podFieldSelectorRuntimeValue returns the runtime value of the given // podFieldSelectorRuntimeValue returns the runtime value of the given

View File

@@ -275,8 +275,8 @@ func (c *leaseController) newLease(ctx context.Context, node *corev1.Node, base
Namespace: corev1.NamespaceNodeLease, Namespace: corev1.NamespaceNodeLease,
}, },
Spec: coordinationv1.LeaseSpec{ Spec: coordinationv1.LeaseSpec{
HolderIdentity: pointer.StringPtr(node.Name), HolderIdentity: pointer.String(node.Name),
LeaseDurationSeconds: pointer.Int32Ptr(c.leaseDurationSeconds), LeaseDurationSeconds: pointer.Int32(c.leaseDurationSeconds),
}, },
} }
} else { } else {