kubernetes/kops · error

Error appending tag to port: %v

Error message

Error appending tag to port: %v

What it means

Immediately after creating a port, RenderOpenstack applies each tag from the Port task via t.Cloud.AppendTag(ResourceTypePort, v.ID, tag). Any failure appending a tag to the freshly created port is wrapped with this message.

Source

Thrown at upup/pkg/fi/cloudup/openstacktasks/port.go:268

func (*Port) RenderOpenstack(t *openstack.OpenstackAPITarget, a, e, changes *Port) error {
	if a == nil {
		klog.V(2).Infof("Creating Port with name: %q", fi.ValueOf(e.Name))

		opt, err := portCreateOptsFromPortTask(t, a, e, changes)
		if err != nil {
			return fmt.Errorf("Error creating port cloud opts: %v", err)
		}

		v, err := t.Cloud.CreatePort(opt)
		if err != nil {
			return fmt.Errorf("Error creating port: %v", err)
		}

		if e.Tags != nil {
			for _, tag := range e.Tags {
				err = t.Cloud.AppendTag(openstack.ResourceTypePort, v.ID, tag)
				if err != nil {
					return fmt.Errorf("Error appending tag to port: %v", err)
				}
			}
		}
		e.ID = new(v.ID)
		klog.V(2).Infof("Creating a new Openstack port, id=%s", v.ID)
		return nil
	}
	if changes != nil {
		if changes.Tags != nil {
			klog.V(2).Infof("Updating tags for Port with name: %q", fi.ValueOf(e.Name))
			for _, tag := range e.Tags {
				err := t.Cloud.AppendTag(openstack.ResourceTypePort, fi.ValueOf(a.ID), tag)
				if err != nil {
					return fmt.Errorf("Error appending tag to port: %v", err)
				}
			}
		}
		if changes.AllowedAddressPairs != nil {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Read the inner error; check whether the neutron tagging extension is enabled (`openstack extension list | grep tag`)
  2. Re-run kops — the port already exists and reconciliation will reuse it and retry tag application
  3. Verify credentials/permissions for the tagging API
  4. Remove or adjust unsupported tag values in the cluster spec

Example fix

null
Defensive patterns

Strategy: retry

Validate before calling

// check tagging extension support
exts, err := cloud.ListExtensions()
if !supportsTagging(exts) {
    return fmt.Errorf("neutron tagging extension unavailable; remove port tags from spec")
}

Try / catch

err = t.Cloud.AppendTag(openstack.ResourceTypePort, v.ID, tag)
if err != nil {
    return fmt.Errorf("Error appending tag to port: %v", err) // re-run kops; port exists, tags will be retried
}

Prevention

When it happens

Trigger: e.Tags is non-nil and one of the AppendTag calls to the Neutron tagging API fails for the new port ID (auth/token issue, API outage, tag policy restriction).

Common situations: Neutron tagging extension (tag: resource) not enabled in the deployment; token expired mid-render; characters in tag unsupported by the deployment; transient 5xx from Neutron.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/60d7588e646531d4. Report an issue: GitHub.