mirror of
https://github.com/ansible/awx.git
synced 2026-03-28 14:25:05 -02:30
Add canonical receptor address
Creates a non-deletable address that acts as the "main" address for this instance. All other addresses for that instance must be non-canonical. When listener_port on an instance is set, automatically create a canonical receptor address where: - address is hostname of instance - port is listener_port - canonical is True Additionally, protocol field is added to instance to denote the receptor listener protocol to use (ws, tcp). The receptor config listener information is derived from the listener_port and protocol information. Having a canonical address that mirrors the listener_port ensures that an address exists that matches the receptor config information. Other changes: - Add managed field to receptor address. If managed is True, no fields on on this address can be edited via the API. If canonical is True, only the address cannot be edited. - Add managed field to instance. If managed is True, users cannot set node_state to deprovisioning (i.e. cannot delete node) This change to our mechanism to prevent users from deleting the mesh ingress hop node. - Field is_internal is now renamed to k8s_routable - Add reverse_peers on instance which is a list of instance IDs that peer to this instance (via an address) Signed-off-by: Seth Foster <fosterbseth@gmail.com>
This commit is contained in:
@@ -5,7 +5,7 @@ from decimal import Decimal
|
||||
import logging
|
||||
import os
|
||||
|
||||
from django.core.validators import MinValueValidator
|
||||
from django.core.validators import MinValueValidator, MaxValueValidator
|
||||
from django.db import models, connection
|
||||
from django.db.models.signals import post_save, post_delete
|
||||
from django.dispatch import receiver
|
||||
@@ -64,6 +64,12 @@ class HasPolicyEditsMixin(HasEditsMixin):
|
||||
return self._values_have_edits(new_values)
|
||||
|
||||
|
||||
class Protocols(models.TextChoices):
|
||||
TCP = 'tcp', 'TCP'
|
||||
WS = 'ws', 'WS'
|
||||
WSS = 'wss', 'WSS'
|
||||
|
||||
|
||||
class InstanceLink(BaseModel):
|
||||
class Meta:
|
||||
ordering = ("id",)
|
||||
@@ -165,6 +171,16 @@ class Instance(HasPolicyEditsMixin, BaseModel):
|
||||
default=0,
|
||||
editable=False,
|
||||
)
|
||||
listener_port = models.PositiveIntegerField(
|
||||
blank=True,
|
||||
null=True,
|
||||
default=None,
|
||||
validators=[MinValueValidator(0), MaxValueValidator(65535)],
|
||||
help_text=_("Port that Receptor will listen for incoming connections on."),
|
||||
)
|
||||
protocol = models.CharField(
|
||||
help_text=_("Protocol to use for the Receptor listener, 'tcp', 'wss', or 'ws'."), max_length=10, default=Protocols.TCP, choices=Protocols.choices
|
||||
)
|
||||
|
||||
class Types(models.TextChoices):
|
||||
CONTROL = 'control', _("Control plane node")
|
||||
@@ -187,6 +203,7 @@ class Instance(HasPolicyEditsMixin, BaseModel):
|
||||
choices=States.choices, default=States.READY, max_length=16, help_text=_("Indicates the current life cycle stage of this instance.")
|
||||
)
|
||||
|
||||
managed = models.BooleanField(help_text=_("If True, this instance is managed by the control plane."), default=False, editable=False)
|
||||
peers = models.ManyToManyField('ReceptorAddress', through=InstanceLink, through_fields=('source', 'target'), related_name='peers_from')
|
||||
peers_from_control_nodes = models.BooleanField(default=False, help_text=_("If True, control plane cluster nodes should automatically peer to it."))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user