Documentation ¶
Overview ¶
Implements interaction with the Azure API.
Instance metadata is retrieved from the Azure IMDS API.
Retrieving metadata of other instances is done by using the Azure API, and requires Azure credentials.
Index ¶
- type Cloud
- func (c *Cloud) GetLoadBalancerEndpoint(ctx context.Context) (host, port string, retErr error)
- func (c *Cloud) InitSecretHash(ctx context.Context) ([]byte, error)
- func (c *Cloud) List(ctx context.Context) ([]metadata.InstanceMetadata, error)
- func (c *Cloud) PrepareControlPlaneNode(ctx context.Context, log *slog.Logger) error
- func (c *Cloud) Self(ctx context.Context) (metadata.InstanceMetadata, error)
- func (c *Cloud) UID(ctx context.Context) (string, error)
- type IMDSClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cloud ¶
type Cloud struct {
// contains filtered or unexported fields
}
Cloud provides Azure metadata and API access.
func New ¶
New initializes Cloud with the needed API clients. Default credentials are used for authentication.
func (*Cloud) GetLoadBalancerEndpoint ¶
GetLoadBalancerEndpoint retrieves the first load balancer IP from cloud provider metadata.
The returned string is an IP address without a port, but the method name needs to satisfy the metadata interface.
func (*Cloud) InitSecretHash ¶
InitSecretHash retrieves the InitSecretHash of the current instance.
func (*Cloud) PrepareControlPlaneNode ¶
PrepareControlPlaneNode sets up iptables for the control plane node only if an internal load balancer is used.
This is needed since during `kubeadm init` the API server must talk to the kubeAPIEndpoint, which is the load balancer IP address. During that time, the only healthy VM is the VM itself. Therefore, traffic is sent to the load balancer and the 5-tuple is (VM IP, <some port>, LB IP, 6443, TCP). Now the load balancer does not re-write the source IP address only the destination (DNAT). Therefore the 5-tuple is (VM IP, <some port>, VM IP, 6443, TCP). Now the VM responds to the SYN packet with a SYN-ACK packet, but the outgoing connection waits on a response from the load balancer and not the VM therefore dropping the packet.
OpenShift also uses the same mechanism to redirect traffic to the API server: https://github.com/openshift/machine-config-operator/blob/e453bd20bac0e48afa74e9a27665abaf454d93cd/templates/master/00-master/azure/files/opt-libexec-openshift-azure-routes-sh.yaml
type IMDSClient ¶
type IMDSClient struct {
// contains filtered or unexported fields
}
IMDSClient is a client for the Azure Instance Metadata Service.