Documentation
¶
Index ¶
- Constants
- func NewCreateCommand() *cobra.Command
- func NewCreateIAMCommand() *cobra.Command
- func NewDestroyCommand() *cobra.Command
- func NewDestroyIAMCommand() *cobra.Command
- type CreateIAMOptions
- func (o *CreateIAMOptions) CreateIAM(ctx context.Context, logger logr.Logger) (*CreateIAMOutput, error)
- func (o *CreateIAMOptions) Output(results *CreateIAMOutput, logger logr.Logger) error
- func (o *CreateIAMOptions) Run(ctx context.Context, logger logr.Logger) error
- func (o *CreateIAMOptions) ValidateInputs() error
- func (o *CreateIAMOptions) ValidateJWKSFile() error
- type CreateIAMOutput
- type CreateInfraOptions
- func (o *CreateInfraOptions) CreateInfra(ctx context.Context, logger logr.Logger) (*CreateInfraOutput, error)
- func (o *CreateInfraOptions) Output(result *CreateInfraOutput) error
- func (o *CreateInfraOptions) Run(ctx context.Context, logger logr.Logger) error
- func (o *CreateInfraOptions) Validate() error
- type CreateInfraOutput
- type DestroyIAMOptions
- type DestroyInfraOptions
- type IAMManager
- func (c *IAMManager) CreateOIDCProvider(ctx context.Context) (string, string, error)
- func (c *IAMManager) CreateServiceAccounts(ctx context.Context) (map[string]string, error)
- func (c *IAMManager) CreateWorkloadIdentityPool(ctx context.Context) (string, error)
- func (c *IAMManager) DeleteOIDCProvider(ctx context.Context) error
- func (c *IAMManager) DeleteServiceAccounts(ctx context.Context) error
- func (c *IAMManager) DeleteWorkloadIdentityPool(ctx context.Context) error
- func (c *IAMManager) GetProjectNumber(ctx context.Context) (string, error)
- func (c *IAMManager) SetOIDCIssuerURL(url string)
- type K8sServiceAccountRef
- type NetworkManager
- func (n *NetworkManager) CreateFirewallRule(ctx context.Context, networkSelfLink string) (*compute.Firewall, error)
- func (n *NetworkManager) CreateNAT(ctx context.Context, routerName, subnetSelfLink string) (string, error)
- func (n *NetworkManager) CreateNetwork(ctx context.Context) (*compute.Network, error)
- func (n *NetworkManager) CreateRouter(ctx context.Context, networkSelfLink string) (*compute.Router, error)
- func (n *NetworkManager) CreateSubnet(ctx context.Context, networkSelfLink, cidr string) (*compute.Subnetwork, error)
- func (n *NetworkManager) DeleteFirewallRule(ctx context.Context) error
- func (n *NetworkManager) DeleteNAT(ctx context.Context) error
- func (n *NetworkManager) DeleteNetwork(ctx context.Context) error
- func (n *NetworkManager) DeleteRouter(ctx context.Context) error
- func (n *NetworkManager) DeleteSubnet(ctx context.Context) error
- type ServiceAccountDefinition
- type ServiceAccountsConfig
- type WorkloadIdentityConfig
Constants ¶
const (
DefaultSubnetCIDR = "10.0.0.0/24"
)
Variables ¶
This section is empty.
Functions ¶
func NewCreateCommand ¶ added in v0.1.71
NewCreateCommand creates a new cobra command for creating GCP infrastructure
func NewCreateIAMCommand ¶
func NewDestroyCommand ¶ added in v0.1.71
NewDestroyCommand creates a new cobra command for destroying GCP infrastructure
func NewDestroyIAMCommand ¶ added in v0.1.72
Types ¶
type CreateIAMOptions ¶
type CreateIAMOptions struct {
ProjectID string
InfraID string
ClusterOIDCJWKSFile string
OutputFile string
OIDCIssuerURL string
}
func (*CreateIAMOptions) CreateIAM ¶
func (o *CreateIAMOptions) CreateIAM(ctx context.Context, logger logr.Logger) (*CreateIAMOutput, error)
func (*CreateIAMOptions) Output ¶
func (o *CreateIAMOptions) Output(results *CreateIAMOutput, logger logr.Logger) error
func (*CreateIAMOptions) ValidateInputs ¶
func (o *CreateIAMOptions) ValidateInputs() error
func (*CreateIAMOptions) ValidateJWKSFile ¶
func (o *CreateIAMOptions) ValidateJWKSFile() error
type CreateIAMOutput ¶
type CreateInfraOptions ¶ added in v0.1.71
type CreateInfraOptions struct {
// Required flags
ProjectID string
Region string
InfraID string
// Optional flags
VPCCidr string
OutputFile string
}
CreateInfraOptions contains options for creating GCP infrastructure
func (*CreateInfraOptions) CreateInfra ¶ added in v0.1.71
func (o *CreateInfraOptions) CreateInfra(ctx context.Context, logger logr.Logger) (*CreateInfraOutput, error)
CreateInfra creates the GCP infrastructure resources
func (*CreateInfraOptions) Output ¶ added in v0.1.71
func (o *CreateInfraOptions) Output(result *CreateInfraOutput) error
Output writes the infrastructure output to stdout or a file
func (*CreateInfraOptions) Validate ¶ added in v0.1.71
func (o *CreateInfraOptions) Validate() error
Validate validates the create infrastructure options
type CreateInfraOutput ¶ added in v0.1.71
type CreateInfraOutput struct {
Region string `json:"region"`
ProjectID string `json:"projectId"`
InfraID string `json:"infraId"`
NetworkName string `json:"networkName"`
NetworkSelfLink string `json:"networkSelfLink"`
SubnetName string `json:"subnetName"`
SubnetSelfLink string `json:"subnetSelfLink"`
SubnetCIDR string `json:"subnetCidr"`
RouterName string `json:"routerName"`
NATName string `json:"natName"`
FirewallRuleName string `json:"firewallRuleName"`
}
CreateInfraOutput contains the output from infrastructure creation
type DestroyIAMOptions ¶ added in v0.1.72
func (*DestroyIAMOptions) DestroyIAM ¶ added in v0.1.72
func (*DestroyIAMOptions) ValidateInputs ¶ added in v0.1.72
func (o *DestroyIAMOptions) ValidateInputs() error
type DestroyInfraOptions ¶ added in v0.1.71
DestroyInfraOptions contains options for destroying GCP infrastructure
func (*DestroyInfraOptions) Validate ¶ added in v0.1.71
func (o *DestroyInfraOptions) Validate() error
Validate validates the destroy infrastructure options
type IAMManager ¶
type IAMManager struct {
// contains filtered or unexported fields
}
IAMManager encapsulates all GCP API interactions used by the GCP IAM creation flow.
func NewIAMManager ¶
func (*IAMManager) CreateOIDCProvider ¶
func (*IAMManager) CreateServiceAccounts ¶ added in v0.1.71
CreateServiceAccounts creates all Google Service Accounts defined in the template, assigns their roles, and creates WIF bindings.
func (*IAMManager) CreateWorkloadIdentityPool ¶
func (c *IAMManager) CreateWorkloadIdentityPool(ctx context.Context) (string, error)
func (*IAMManager) DeleteOIDCProvider ¶ added in v0.1.72
func (c *IAMManager) DeleteOIDCProvider(ctx context.Context) error
DeleteOIDCProvider deletes the OIDC Provider for this cluster.
func (*IAMManager) DeleteServiceAccounts ¶ added in v0.1.72
func (c *IAMManager) DeleteServiceAccounts(ctx context.Context) error
DeleteServiceAccounts deletes all Google Service Accounts created for this cluster.
func (*IAMManager) DeleteWorkloadIdentityPool ¶ added in v0.1.72
func (c *IAMManager) DeleteWorkloadIdentityPool(ctx context.Context) error
DeleteWorkloadIdentityPool deletes the Workload Identity Pool for this cluster.
func (*IAMManager) GetProjectNumber ¶
func (c *IAMManager) GetProjectNumber(ctx context.Context) (string, error)
func (*IAMManager) SetOIDCIssuerURL ¶
func (c *IAMManager) SetOIDCIssuerURL(url string)
SetOIDCIssuerURL sets a custom OIDC issuer URL.
type K8sServiceAccountRef ¶ added in v0.1.71
K8sServiceAccountRef identifies a Kubernetes ServiceAccount for WIF binding.
type NetworkManager ¶ added in v0.1.71
type NetworkManager struct {
// contains filtered or unexported fields
}
NetworkManager encapsulates all GCP Compute API interactions for network infrastructure.
func NewNetworkManager ¶ added in v0.1.71
func NewNetworkManager(ctx context.Context, projectID, infraID, region string, logger logr.Logger) (*NetworkManager, error)
NewNetworkManager creates a new NetworkManager for GCP network operations.
func (*NetworkManager) CreateFirewallRule ¶ added in v0.1.74
func (n *NetworkManager) CreateFirewallRule(ctx context.Context, networkSelfLink string) (*compute.Firewall, error)
CreateFirewallRule creates a firewall rule to allow kubelet API access.
func (*NetworkManager) CreateNAT ¶ added in v0.1.71
func (n *NetworkManager) CreateNAT(ctx context.Context, routerName, subnetSelfLink string) (string, error)
CreateNAT creates a Cloud NAT configuration on the specified router.
func (*NetworkManager) CreateNetwork ¶ added in v0.1.71
CreateNetwork creates a VPC network with custom subnet mode.
func (*NetworkManager) CreateRouter ¶ added in v0.1.71
func (n *NetworkManager) CreateRouter(ctx context.Context, networkSelfLink string) (*compute.Router, error)
CreateRouter creates a Cloud Router for NAT gateway.
func (*NetworkManager) CreateSubnet ¶ added in v0.1.71
func (n *NetworkManager) CreateSubnet(ctx context.Context, networkSelfLink, cidr string) (*compute.Subnetwork, error)
CreateSubnet creates a subnet in the specified VPC network.
func (*NetworkManager) DeleteFirewallRule ¶ added in v0.1.74
func (n *NetworkManager) DeleteFirewallRule(ctx context.Context) error
DeleteFirewallRule deletes the firewall rule for kubelet access.
func (*NetworkManager) DeleteNAT ¶ added in v0.1.71
func (n *NetworkManager) DeleteNAT(ctx context.Context) error
DeleteNAT deletes the Cloud NAT configuration from the router.
func (*NetworkManager) DeleteNetwork ¶ added in v0.1.71
func (n *NetworkManager) DeleteNetwork(ctx context.Context) error
DeleteNetwork deletes the VPC network.
func (*NetworkManager) DeleteRouter ¶ added in v0.1.71
func (n *NetworkManager) DeleteRouter(ctx context.Context) error
DeleteRouter deletes the Cloud Router.
func (*NetworkManager) DeleteSubnet ¶ added in v0.1.71
func (n *NetworkManager) DeleteSubnet(ctx context.Context) error
DeleteSubnet deletes the subnet.
type ServiceAccountDefinition ¶ added in v0.1.71
type ServiceAccountDefinition struct {
// Name is the component name (used for GSA email: {infraID}-{Name}@{project}.iam.gserviceaccount.com)
Name string `json:"name"`
// DisplayName is the human-readable name for the GSA
DisplayName string `json:"displayName"`
// Description provides context about the GSA's purpose
Description string `json:"description"`
// Roles are the GCP IAM roles to assign to this GSA
Roles []string `json:"roles"`
// K8sServiceAccounts contains the namespace and name of each K8s SA for WIF binding
K8sServiceAccounts []K8sServiceAccountRef `json:"k8sServiceAccounts,omitempty"`
}
ServiceAccountDefinition defines a Google Service Account to be created and its role bindings.
type ServiceAccountsConfig ¶ added in v0.1.71
type ServiceAccountsConfig struct {
ServiceAccounts []ServiceAccountDefinition `json:"serviceAccounts"`
}
ServiceAccountsConfig is the root structure for the service accounts JSON file.