@@ -119,16 +119,6 @@ func SetSDK(
119119 out := "\n "
120120 indent := strings .Repeat ("\t " , indentLevel )
121121
122- // The owning resource variable, used so secret fields can pass it to the
123- // runtime's SecretValueFromReference (which sets the cross-namespace
124- // deprecation ACK.Advisory condition on it). It is the leading token of
125- // the source variable path (e.g. "r" from "r.ko"); the generated
126- // *resource type implements acktypes.ConditionManager.
127- resourceVarName := sourceVarName
128- if dot := strings .IndexByte (resourceVarName , '.' ); dot != - 1 {
129- resourceVarName = resourceVarName [:dot ]
130- }
131-
132122 // Check if there's an input wrapper field path configured. If so, we need
133123 // to create a wrapper struct and populate its fields from the CRD spec,
134124 // then assign the wrapper to the input shape's wrapper field.
@@ -412,7 +402,6 @@ func SetSDK(
412402 )
413403 containerOut , err := setSDKForContainer (
414404 cfg , r ,
415- resourceVarName ,
416405 memberName ,
417406 memberVarName ,
418407 sourceFieldPath ,
@@ -441,7 +430,6 @@ func SetSDK(
441430 if r .IsSecretField (memberName ) {
442431 out += setSDKForSecret (
443432 cfg , r ,
444- resourceVarName ,
445433 memberName ,
446434 targetVarName ,
447435 sourceAdaptedVarName ,
@@ -1017,10 +1005,6 @@ func setSDKReadMany(
10171005func setSDKForContainer (
10181006 cfg * ackgenconfig.Config ,
10191007 r * model.CRD ,
1020- // The name of the variable holding the owning resource (a *resource,
1021- // which implements acktypes.ConditionManager). Threaded down so secret
1022- // fields nested in collections can pass it to SecretValueFromReference.
1023- resourceVarName string ,
10241008 // The name of the SDK Input shape member we're outputting for
10251009 targetFieldName string ,
10261010 // The variable name that we want to set a value to
@@ -1039,7 +1023,6 @@ func setSDKForContainer(
10391023 case "structure" :
10401024 return SetSDKForStruct (
10411025 cfg , r ,
1042- resourceVarName ,
10431026 targetFieldName ,
10441027 targetVarName ,
10451028 targetShapeRef ,
@@ -1051,7 +1034,6 @@ func setSDKForContainer(
10511034 case "list" :
10521035 return setSDKForSlice (
10531036 cfg , r ,
1054- resourceVarName ,
10551037 targetFieldName ,
10561038 targetVarName ,
10571039 targetShapeRef ,
@@ -1063,7 +1045,6 @@ func setSDKForContainer(
10631045 case "map" :
10641046 return setSDKForMap (
10651047 cfg , r ,
1066- resourceVarName ,
10671048 targetFieldName ,
10681049 targetVarName ,
10691050 targetShapeRef ,
@@ -1075,7 +1056,6 @@ func setSDKForContainer(
10751056 case "union" :
10761057 return setSDKForUnion (
10771058 cfg , r ,
1078- resourceVarName ,
10791059 targetFieldName ,
10801060 targetVarName ,
10811061 targetShapeRef ,
@@ -1094,7 +1074,6 @@ func setSDKForContainer(
10941074 )
10951075 out += setSDKForSecret (
10961076 cfg , r ,
1097- resourceVarName ,
10981077 "" ,
10991078 targetVarName ,
11001079 sourceVarName ,
@@ -1122,17 +1101,14 @@ func setSDKForContainer(
11221101// the value of a Secret when the type of the source variable is a
11231102// SecretKeyReference.
11241103//
1125- // Cross-namespace validation (and the Phase 1 deprecation notice) is performed
1126- // inside the runtime's SecretValueFromReference, so it is not emitted here.
1127- // This ensures every caller is covered, including custom update functions and
1128- // hooks that call SecretValueFromReference directly. The owning resource is
1129- // passed as the second argument so the runtime can set the cross-namespace
1130- // deprecation ACK.Advisory condition on it; it is derived from the source
1131- // variable (e.g. "r" from "r.ko.Spec.MasterUserPassword").
1104+ // Cross-namespace validation (and the Phase 1 deprecation warning) is
1105+ // performed inside the runtime's SecretValueFromReference, so it is not
1106+ // emitted here. This ensures every caller is covered, including custom
1107+ // update functions and hooks that call SecretValueFromReference directly.
11321108//
11331109// The Go code output from this function looks like this:
11341110//
1135- // tmpSecret, err := rm.rr.SecretValueFromReference(ctx, r, r. ko.Spec.MasterUserPassword)
1111+ // tmpSecret, err := rm.rr.SecretValueFromReference(ctx, ko.Spec.MasterUserPassword)
11361112// if err != nil {
11371113// return nil, ackrequeue.Needed(err)
11381114// }
@@ -1146,11 +1122,6 @@ func setSDKForContainer(
11461122func setSDKForSecret (
11471123 cfg * ackgenconfig.Config ,
11481124 r * model.CRD ,
1149- // The name of the variable holding the owning resource (a
1150- // *resource, which implements acktypes.ConditionManager). It is passed to
1151- // SecretValueFromReference so the runtime can set the cross-namespace
1152- // deprecation ACK.Advisory condition on it. Typically "r" or "desired".
1153- resourceVarName string ,
11541125 // The name of the SDK Shape field we're setting
11551126 targetFieldName string ,
11561127 // The variable name that we want to set a value on
@@ -1167,14 +1138,12 @@ func setSDKForSecret(
11671138 // Cross-namespace validation for the secret reference is performed inside
11681139 // the runtime's SecretValueFromReference, so that every call site is
11691140 // covered (including custom update functions and hooks). No per-call
1170- // validation is generated here. The owning resource is passed so the
1171- // runtime can set the cross-namespace deprecation ACK.Advisory condition
1172- // on it.
1141+ // validation is generated here.
11731142
1174- // tmpSecret, err := rm.rr.SecretValueFromReference(ctx, r, r. ko.Spec.MasterUserPassword)
1143+ // tmpSecret, err := rm.rr.SecretValueFromReference(ctx, ko.Spec.MasterUserPassword)
11751144 out += fmt .Sprintf (
1176- "%s\t %s, err := rm.rr.SecretValueFromReference(ctx, %s, %s )\n " ,
1177- indent , secVar , resourceVarName , sourceVarName ,
1145+ "%s\t %s, err := rm.rr.SecretValueFromReference(ctx, %s)\n " ,
1146+ indent , secVar , sourceVarName ,
11781147 )
11791148 // if err != nil {
11801149 // return nil, ackrequeue.Needed(err)
@@ -1206,12 +1175,6 @@ func setSDKForSecret(
12061175func SetSDKForStruct (
12071176 cfg * ackgenconfig.Config ,
12081177 r * model.CRD ,
1209- // The name of the variable holding the owning resource (a *resource,
1210- // which implements acktypes.ConditionManager). Threaded down so secret
1211- // fields nested in this struct can pass it to SecretValueFromReference.
1212- // When this is the entry point (e.g. the GoCodeSetSDKForStruct template
1213- // helper), it is derived from the leading token of sourceVarName.
1214- resourceVarName string ,
12151178 // The name of the CR field we're outputting for
12161179 targetFieldName string ,
12171180 // The variable name that we want to set a value to
@@ -1228,16 +1191,6 @@ func SetSDKForStruct(
12281191 out := ""
12291192 indent := strings .Repeat ("\t " , indentLevel )
12301193 targetShape := targetShapeRef .Shape
1231- // When SetSDKForStruct is invoked as a top-level entry point (rather than
1232- // recursively via setSDKForContainer), resourceVarName is not supplied by
1233- // the caller. Fall back to the leading token of the source variable path
1234- // (e.g. "r" from "r.ko.Spec.Foo"), which names the owning *resource.
1235- if resourceVarName == "" {
1236- resourceVarName = sourceVarName
1237- if dot := strings .IndexByte (resourceVarName , '.' ); dot != - 1 {
1238- resourceVarName = resourceVarName [:dot ]
1239- }
1240- }
12411194
12421195 for memberIndex , memberName := range targetShape .MemberNames () {
12431196 memberShapeRef := targetShape .MemberRefs [memberName ]
@@ -1295,7 +1248,6 @@ func SetSDKForStruct(
12951248 )
12961249 containerOut , err := setSDKForContainer (
12971250 cfg , r ,
1298- resourceVarName ,
12991251 memberName ,
13001252 memberVarName ,
13011253 memberFieldPath ,
@@ -1324,7 +1276,6 @@ func SetSDKForStruct(
13241276 if r .IsSecretField (memberFieldPath ) {
13251277 out += setSDKForSecret (
13261278 cfg , r ,
1327- resourceVarName ,
13281279 memberName ,
13291280 targetVarName ,
13301281 sourceAdaptedVarName ,
@@ -1359,10 +1310,6 @@ func SetSDKForStruct(
13591310func setSDKForSlice (
13601311 cfg * ackgenconfig.Config ,
13611312 r * model.CRD ,
1362- // The name of the variable holding the owning resource (a *resource,
1363- // which implements acktypes.ConditionManager). Threaded down so secret
1364- // fields nested in this slice can pass it to SecretValueFromReference.
1365- resourceVarName string ,
13661313 // The name of the CR field we're outputting for
13671314 targetFieldName string ,
13681315 // The variable name that we want to set a value to
@@ -1435,7 +1382,6 @@ func setSDKForSlice(
14351382 } else {
14361383 containerOut , err := setSDKForContainer (
14371384 cfg , r ,
1438- resourceVarName ,
14391385 containerFieldName ,
14401386 elemVarName ,
14411387 sourceFieldPath ,
@@ -1468,10 +1414,6 @@ func setSDKForSlice(
14681414func setSDKForMap (
14691415 cfg * ackgenconfig.Config ,
14701416 r * model.CRD ,
1471- // The name of the variable holding the owning resource (a *resource,
1472- // which implements acktypes.ConditionManager). Threaded down so secret
1473- // fields nested in this map can pass it to SecretValueFromReference.
1474- resourceVarName string ,
14751417 // The name of the CR field we're outputting for
14761418 targetFieldName string ,
14771419 // The variable name that we want to set a value to
@@ -1539,7 +1481,6 @@ func setSDKForMap(
15391481 } else {
15401482 containerOut , err := setSDKForContainer (
15411483 cfg , r ,
1542- resourceVarName ,
15431484 containerFieldName ,
15441485 valVarName ,
15451486 sourceFieldPath ,
@@ -1903,10 +1844,6 @@ func resolveAWSMapValueType(valueType string) string {
19031844func setSDKForUnion (
19041845 cfg * ackgenconfig.Config ,
19051846 r * model.CRD ,
1906- // The name of the variable holding the owning resource (a *resource,
1907- // which implements acktypes.ConditionManager). Threaded down so secret
1908- // fields nested in this union can pass it to SecretValueFromReference.
1909- resourceVarName string ,
19101847 // The name of the CR field we're outputting for
19111848 targetFieldName string ,
19121849 // The variable name that we want to set a value to
@@ -1992,7 +1929,6 @@ func setSDKForUnion(
19921929 )
19931930 containerOut , err := setSDKForContainer (
19941931 cfg , r ,
1995- resourceVarName ,
19961932 memberName ,
19971933 indexedVarName ,
19981934 memberFieldPath ,
0 commit comments