Skip to content

Add --all-projects flag to support cross-project zone management via X-Auth-All-Projects header #83

Description

@abhijith-darshan

Problem

When the Designate service user is scoped to a project that does not own the DNS zones (e.g. scoped to project-a but zones live in project-b), the webhook returns 0 zones and cannot manage any records.

This is a common OpenStack setup where DNS zones are owned by a dedicated admin project, while service users authenticate against a different project.

Expected Behaviour

The webhook should support an --all-projects flag that sets the X-Auth-All-Projects: true header on all Designate API requests, allowing the service user to see and manage zones across all projects.

Proposed Implementation

In internal/designate/client/client.go, add the header when constructing the service client:

func NewDesignateClient(allProjects bool) (DesignateClientInterface, error) {
    serviceClient, err := createDesignateServiceClient()
    if err != nil {
        return nil, err
    }
    if allProjects {
        serviceClient.MoreHeaders = map[string]string{
            "X-Auth-All-Projects": "true",
        }
    }
    return &designateClient{serviceClient}, nil
}

In cmd/webhook/main.go, expose the flag:

pflag.BoolVar(&allProjects, "all-projects", false, "Manage all zones and recordsets regardless of the project the service user resides in")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions