Documentation
¶
Index ¶
- Constants
- func BuildWorkloadIdentityCredentials(wif hyperv1.GCPWorkloadIdentityConfig, serviceAccountEmail string) (string, error)
- func HypershiftLocalZoneName(clusterName string) (string, error)
- func LBResourceLabelsAnnotationValue(labels map[string]string) string
- func ManagedResourceLabelKeys(annotations map[string]string, annotation string) map[string]struct{}
- func MergeResourceLabels(existing, desired map[string]string, ...) (map[string]string, error)
- func ParseLBResourceLabelsAnnotation(annotations map[string]string) (map[string]string, bool, error)
- func PrivateIngressZoneName(baseDomain string) (string, error)
- func PublicIngressZoneName(baseDomain string) (string, error)
- func ReconcileLBResourceLabelAnnotations(annotations map[string]string, desired map[string]string) (map[string]string, bool, error)
- func ResourceLabels(hcp *hyperv1.HostedControlPlane) map[string]string
- func ResourceLabelsToMap(resourceLabels []hyperv1.GCPResourceLabel) map[string]string
- func UpdateManagedResourceLabelKeys(ctx context.Context, c client.Client, obj client.Object, annotation string, ...) error
- func ValidateZoneName(name string) error
- type CredentialSource
- type CredentialSourceFormat
- type ExternalAccountCredential
Constants ¶
const LBResourceLabelsAnnotation = "cloud.google.com/load-balancer-resource-labels"
LBResourceLabelsAnnotation is the Service annotation read by the GCP cloud-controller-manager (openshift/cloud-provider-gcp) to apply labels to the GCP forwarding rules created for that Service. Format: comma-separated "key=value" pairs, e.g. "goog-partner-solution=foo,env=prod".
const ManagedLBResourceLabelsAnnotation = "hypershift.openshift.io/managed-gcp-lb-resource-label-keys"
ManagedLBResourceLabelsAnnotation records the resource-label keys in LBResourceLabelsAnnotation that HyperShift manages. When an HCP label overlaps an existing Service-owned key, HyperShift takes ownership of that key and its HCP value takes precedence. Removing that HCP label later removes the key; the previous Service value is not restored.
const MaxResourceLabels = 64
MaxResourceLabels is the maximum number of labels GCP permits on a resource.
Variables ¶
This section is empty.
Functions ¶
func BuildWorkloadIdentityCredentials ¶
func BuildWorkloadIdentityCredentials(wif hyperv1.GCPWorkloadIdentityConfig, serviceAccountEmail string) (string, error)
BuildWorkloadIdentityCredentials creates the credential configuration JSON for Google Cloud SDK to use Workload Identity Federation with a specific service account email.
func HypershiftLocalZoneName ¶ added in v0.1.88
HypershiftLocalZoneName returns the GCP Cloud DNS managed-zone NAME of the per-cluster hypershift.local private zone for the given cluster name.
func LBResourceLabelsAnnotationValue ¶ added in v0.1.87
LBResourceLabelsAnnotationValue serializes a GCP resource-label map into the comma-separated "key=value" string expected by LBResourceLabelsAnnotation. Returns an empty string when labels is nil or empty.
func ManagedResourceLabelKeys ¶ added in v0.1.87
ManagedResourceLabelKeys returns the resource-label keys previously managed by HyperShift, stored as a comma-separated object annotation.
func MergeResourceLabels ¶ added in v0.1.87
func MergeResourceLabels(existing, desired map[string]string, previouslyManagedLabelKeys map[string]struct{}) (map[string]string, error)
MergeResourceLabels preserves labels that are not managed by HyperShift, removes withdrawn managed labels, and applies the desired labels. GCP permits at most 64 labels per resource.
func ParseLBResourceLabelsAnnotation ¶ added in v0.1.87
func ParseLBResourceLabelsAnnotation(annotations map[string]string) (map[string]string, bool, error)
ParseLBResourceLabelsAnnotation parses the native GCP Service annotation. The format and validation intentionally match cloud-provider-gcp's accepted key=value[,key=value] representation.
func PrivateIngressZoneName ¶ added in v0.1.88
PrivateIngressZoneName returns the GCP Cloud DNS managed-zone NAME of the private ingress zone for the given base domain. See PublicIngressZoneName for input requirements.
func PublicIngressZoneName ¶ added in v0.1.88
PublicIngressZoneName returns the GCP Cloud DNS managed-zone NAME of the public ingress zone for the given base domain. The input MUST be the raw HostedControlPlane base domain (hcp.Spec.DNS.BaseDomain), not a prefixed value, so that it matches the name the GCP Private Service Connect controller uses when it creates the zone.
func ReconcileLBResourceLabelAnnotations ¶ added in v0.1.87
func ReconcileLBResourceLabelAnnotations(annotations map[string]string, desired map[string]string) (map[string]string, bool, error)
ReconcileLBResourceLabelAnnotations merges HCP labels into a Service's GCP load-balancer resource-label annotation. Labels not previously managed by HyperShift are preserved. It returns the desired annotations and whether they differ from annotations.
func ResourceLabels ¶ added in v0.1.87
func ResourceLabels(hcp *hyperv1.HostedControlPlane) map[string]string
ResourceLabels converts the HCP GCP resource-label list to the map format expected by GCP API calls. Returns nil when no labels are configured.
func ResourceLabelsToMap ¶ added in v0.1.87
func ResourceLabelsToMap(resourceLabels []hyperv1.GCPResourceLabel) map[string]string
ResourceLabelsToMap converts GCP resource labels to the map format expected by GCP APIs. Labels without a value are represented by an empty string. Returns nil when no labels are configured.
func UpdateManagedResourceLabelKeys ¶ added in v0.1.87
func UpdateManagedResourceLabelKeys(ctx context.Context, c client.Client, obj client.Object, annotation string, desiredLabels map[string]string) error
UpdateManagedResourceLabelKeys records the sorted desired resource-label keys in an object's annotation. It patches the object only when the annotation changes.
func ValidateZoneName ¶ added in v0.1.88
ValidateZoneName validates that a name meets GCP Cloud DNS managed zone naming constraints.
Types ¶
type CredentialSource ¶
type CredentialSource struct {
File string `json:"file"`
Format CredentialSourceFormat `json:"format"`
}
CredentialSource represents the credential source configuration for GCP external account credentials.
type CredentialSourceFormat ¶
type CredentialSourceFormat struct {
Type string `json:"type"`
}
CredentialSourceFormat represents the format of the credential source.
type ExternalAccountCredential ¶
type ExternalAccountCredential struct {
Type string `json:"type"`
Audience string `json:"audience"`
SubjectTokenType string `json:"subject_token_type"`
TokenURL string `json:"token_url"`
ServiceAccountImpersonationURL string `json:"service_account_impersonation_url"`
CredentialSource CredentialSource `json:"credential_source"`
}
ExternalAccountCredential represents the complete GCP external account credential configuration for Workload Identity Federation. This follows the Google Cloud credential configuration format.