{"record":{"id":"4a14e47d5cc29ce5","repo":"kubernetes/kops","slug":"specified-both-ip-address-and-rule-managed-ip-addr","errorCode":null,"errorMessage":"Specified both IP Address and rule-managed IP address: %v, %v","messagePattern":"Specified both IP Address and rule-managed IP address: (.+?), (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gcetasks/forwardingrule.go","lineNumber":203,"sourceCode":"\tif e.IPAddress != nil {\n\t\to.IPAddress = fi.ValueOf(e.IPAddress.IPAddress)\n\t\tif o.IPAddress == \"\" {\n\t\t\taddr, err := e.IPAddress.find(t.Cloud)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error finding Address %q: %v\", e.IPAddress, err)\n\t\t\t}\n\t\t\tif addr == nil {\n\t\t\t\treturn fmt.Errorf(\"Address %q was not found\", e.IPAddress)\n\t\t\t}\n\n\t\t\to.IPAddress = fi.ValueOf(addr.IPAddress)\n\t\t\tif o.IPAddress == \"\" {\n\t\t\t\treturn fmt.Errorf(\"Address had no IP: %v\", e.IPAddress)\n\t\t\t}\n\t\t}\n\t}\n\tif o.IPAddress != \"\" && e.RuleIPAddress != nil {\n\t\treturn fmt.Errorf(\"Specified both IP Address and rule-managed IP address: %v, %v\", e.IPAddress, *e.RuleIPAddress)\n\t}\n\tif e.RuleIPAddress != nil {\n\t\to.IPAddress = *e.RuleIPAddress\n\t}\n\n\tif e.Network != nil {\n\t\tproject := t.Cloud.Project()\n\t\tif e.Network.Project != nil {\n\t\t\tproject = *e.Network.Project\n\t\t}\n\t\to.Network = e.Network.URL(project)\n\t}\n\n\tif e.Subnetwork != nil {\n\t\tproject := t.Cloud.Project()\n\t\tif e.Network.Project != nil {\n\t\t\tproject = *e.Network.Project\n\t\t}","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gcetasks/forwardingrule.go#L185-L221","documentation":"kOps's GCE ForwardingRule task refuses to reconcile a forwarding rule when the model contains two competing sources for the rule's IP: an explicit IPAddress task reference and a RuleIPAddress (an IP managed by the rule itself, e.g. allocated by the load balancer). This is a config-validation guard thrown before any GCE API call, because only one IP source can be applied.","triggerScenarios":"RenderGCE is called with a ForwardingRule whose IPAddress task resolves to a non-empty IP (o.IPAddress != \"\") while e.RuleIPAddress is also non-nil. Both fields are populated in the same task spec.","commonSituations":"Cluster spec migration: a rule that previously let GCE pick its IP (RuleIPAddress set from the discovered/observed state) is edited to pin an explicit static Address without clearing the stored RuleIPAddress; upgrading clusters between load-balancer modes; hand-edited manifests specifying both.","solutions":["Pick one IP source: either set an explicit IPAddress task (static IP) or rely on the rule-managed IP, not both","If pinning a static IP, ensure RuleIPAddress is nil in the task spec (recreate the task or let kOps re-discover state)","Re-run kops update after fixing the cluster spec so the observed RuleIPAddress is cleared"],"exampleFix":"// before: both set on the ForwardingRule task\nrule.IPAddress = staticAddrTask\nrule.RuleIPAddress = fi.PtrTo(existingIP)\n\n// after: explicit static IP only\nrule.IPAddress = staticAddrTask\nrule.RuleIPAddress = nil","handlingStrategy":"validation","validationCode":"// before creating/updating a GCE ForwardingRule task\nfunc validateForwardingRuleIP(rule *ForwardingRule) error {\n    hasExplicit := rule.IPAddress != nil && rule.IPAddress.IPAddress != nil && *rule.IPAddress.IPAddress != \"\"\n    if hasExplicit && rule.RuleIPAddress != nil {\n        return fmt.Errorf(\"set either IPAddress (%v) or RuleIPAddress (%v), not both\", *rule.IPAddress.IPAddress, *rule.RuleIPAddress)\n    }\n    return nil\n}","typeGuard":"func hasExplicitIP(rule *ForwardingRule) bool {\n    return rule.IPAddress != nil && rule.IPAddress.IPAddress != nil && *rule.IPAddress.IPAddress != \"\"\n}\nfunc hasRuleManagedIP(rule *ForwardingRule) bool { return rule.RuleIPAddress != nil }","tryCatchPattern":null,"preventionTips":["Never set both IPAddress and RuleIPAddress on the same ForwardingRule task","When pinning a static IP, explicitly nil out RuleIPAddress in the cluster spec model","After changing load balancer IP settings, run kops update with refreshed discovery so stale observed state is cleared"],"tags":["gce","forwarding-rule","config-validation","ip-address"],"backgroundTag":"conflicting-ip-configuration","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}