INNER CODE UNIT · Go
getAppProtectVersionInfo
nginx/kubernetes-ingress · cmd/nginx-ingress/main.go:623
func getAppProtectVersionInfo(ctx context.Context) string {
l := nl.LoggerFromContext(ctx)
v, err := os.ReadFile(appProtectVersionPath)
if err != nil {
nl.Fatalf(l, "Cannot detect the AppProtect version, %s", err.Error())
}
version := strings.TrimSpace(string(v))
nl.Infof(l, "Using AppProtect Version %s", version)
return version
}
// selectAppProtectAPIVersion configures the appprotect package to watch the
// v1 CRDs when --plm-storage-url is set, otherwise the legacy v1beta1 CRDs.
func selectAppProtectAPIVersion(ctx context.Context, plmEnabled bool, recorder record.EventRecorder, pod *api_v1.Pod) {
l := nl.LoggerFromContext(ctx)
version := appprotect.SelectAPIVersion(plmEnabled)
// Defensive: SelectAPIVersion only returns values SetAPIVersion accepts.
if err := appprotect.SetAPIVersion(version); err != nil {