-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature azurefirewall #201
base: master
Are you sure you want to change the base?
Changes from 4 commits
09b67a1
a3abf03
2780477
d77f8e2
5893f5e
f89e8f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -225,3 +225,249 @@ type SubnetList struct { | |||||
metav1.ListMeta `json:"metadata,omitempty"` | ||||||
Items []Subnet `json:"items"` | ||||||
} | ||||||
|
||||||
//Azure Firewall Structs | ||||||
// +kubebuilder:object:root=true | ||||||
// A AzureFirewall is a managed resource that represents an Azure Firewall | ||||||
// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" | ||||||
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" | ||||||
// +kubebuilder:printcolumn:name="STATE",type="string",JSONPath=".status.state" | ||||||
// +kubebuilder:printcolumn:name="LOCATION",type="string",JSONPath=".spec.location" | ||||||
// +kubebuilder:printcolumn:name="RECLAIM-POLICY",type="string",JSONPath=".spec.reclaimPolicy" | ||||||
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" | ||||||
// +kubebuilder:subresource:status | ||||||
// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,azure} | ||||||
type AzureFirewall struct { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is a new resource it should be introduced at There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the existing codebase we can see v1beta1 or v1alpha3 outside the network folder and v1alpha3 inside network folder , so do you suggest us to create v1alpha1 module also , if so we will need some direction or help from you as we are not aware of the process for doing that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ShreyNamdeo yes creating a new package would be appropriate here 👍 |
||||||
metav1.TypeMeta `json:",inline"` | ||||||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||||||
|
||||||
Spec AzureFirewallSpec `json:"spec"` | ||||||
Status AzureFirewallStatus `json:"status,omitempty"` | ||||||
///Properties SecurityGroupPropertiesFormat `json:"properties,omitempty"` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like this needs to be removed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delete the commented code at line 246 |
||||||
} | ||||||
|
||||||
// +kubebuilder:object:root=true | ||||||
// AzureFirewallList contains a list of Security Groups | ||||||
type AzureFirewallList struct { | ||||||
metav1.TypeMeta `json:",inline"` | ||||||
metav1.ListMeta `json:"metadata,omitempty"` | ||||||
Items []AzureFirewall `json:"items"` | ||||||
} | ||||||
|
||||||
// A AzureFirewallSpec defines the desired state of a AzureFirewall. | ||||||
type AzureFirewallSpec struct { | ||||||
runtimev1alpha1.ResourceSpec `json:",inline"` | ||||||
|
||||||
// ResourceGroupName - Name of the SecurityGroup's resource group. | ||||||
ResourceGroupName string `json:"resourceGroupName,omitempty"` | ||||||
|
||||||
// ResourceGroupNameRef - A reference to the the SecurityGroup's resource | ||||||
// group. | ||||||
ResourceGroupNameRef *runtimev1alpha1.Reference `json:"resourceGroupNameRef,omitempty"` | ||||||
|
||||||
// ResourceGroupNameSelector - Select a reference to the the Azure Firewall | ||||||
// resource group. | ||||||
ResourceGroupNameSelector *runtimev1alpha1.Selector `json:"resourceGroupNameSelector,omitempty"` | ||||||
|
||||||
// Location - Resource location. | ||||||
Location string `json:"location"` | ||||||
|
||||||
//AzureFirewallPropertiesFormat - Properties of AzureFirewall | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added space in comment line 275 |
||||||
AzureFirewallPropertiesFormat `json:"properties,omitempty"` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is optional it should have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'AzureFirewallPropertiesFormat' is not optional. |
||||||
|
||||||
// Tags - Resource tags. | ||||||
// +optional | ||||||
Tags map[string]string `json:"tags,omitempty"` | ||||||
|
||||||
// Zones - A list of availability zones denoting where the resource needs to come from. | ||||||
Zones []string `json:"zones,omitempty"` | ||||||
|
||||||
// Etag - READ-ONLY; Gets a unique read-only string that changes whenever the resource is updated. | ||||||
Etag string `json:"etag,omitempty"` | ||||||
|
||||||
// ID - Resource ID. | ||||||
ID string `json:"id,omitempty"` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please give us a reference code or explain the changes needed as we are not aware. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Crossplane managed resource API conventions doc is a good resource that discusses these topics. The convention is to have pointer types for optional fields, and to use the |
||||||
|
||||||
// Name - READ-ONLY; Resource name. | ||||||
Name string `json:"name,omitempty"` | ||||||
|
||||||
// Type - READ-ONLY; Resource type. | ||||||
Type string `json:"type,omitempty"` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These should be in status if read only There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to specify these properties while creating firewall , thus we kept them in Spec and we have removed the READ-ONLY signature from comment. |
||||||
// Location - Resource location. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed extra comment from the code. |
||||||
} | ||||||
|
||||||
// AzureFirewallPropertiesFormat properties of the Azure Firewall. | ||||||
type AzureFirewallPropertiesFormat struct { | ||||||
// ApplicationRuleCollections - Collection of application rule collections used by Azure Firewall. | ||||||
//ApplicationRuleCollections *[]AzureFirewallApplicationRuleCollection `json:"applicationRuleCollections,omitempty"` | ||||||
// NatRuleCollections - Collection of NAT rule collections used by Azure Firewall. | ||||||
NatRuleCollections *[]AzureFirewallNatRuleCollection `json:"natRuleCollections,omitempty"` | ||||||
// NetworkRuleCollections - Collection of network rule collections used by Azure Firewall. | ||||||
NetworkRuleCollections *[]AzureFirewallNetworkRuleCollection `json:"networkRuleCollections,omitempty"` | ||||||
// IPConfigurations - IP configuration of the Azure Firewall resource. | ||||||
IPConfigurations *[]AzureFirewallIPConfiguration `json:"ipConfigurations,omitempty"` | ||||||
// ProvisioningState - The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' | ||||||
ProvisioningState string `json:"provisioningState,omitempty"` | ||||||
// ThreatIntelMode - The operation mode for Threat Intelligence. Possible values include: 'AzureFirewallThreatIntelModeAlert', 'AzureFirewallThreatIntelModeDeny', 'AzureFirewallThreatIntelModeOff' | ||||||
ThreatIntelMode string `json:"threatIntelMode,omitempty"` | ||||||
// VirtualHub - The virtualHub to which the firewall belongs. | ||||||
VirtualHub *SubResource `json:"virtualHub,omitempty"` | ||||||
// FirewallPolicy - The firewallPolicy associated with this azure firewall. | ||||||
FirewallPolicy *SubResource `json:"firewallPolicy,omitempty"` | ||||||
// HubIPAddresses - READ-ONLY; IP addresses associated with AzureFirewall. | ||||||
HubIPAddresses *HubIPAddresses `json:"hubIpAddresses,omitempty"` | ||||||
} | ||||||
|
||||||
// AzureFirewallIPConfiguration IP configuration of an Azure Firewall. | ||||||
type AzureFirewallIPConfiguration struct { | ||||||
// AzureFirewallIPConfigurationPropertiesFormat - Properties of the azure firewall IP configuration. | ||||||
AzureFirewallIPConfigurationPropertiesFormat AzureFirewallIPConfigurationPropertiesFormat `json:"properties,omitempty"` | ||||||
// Name - Name of the resource that is unique within a resource group. This name can be used to access the resource. | ||||||
Name *string `json:"name,omitempty"` | ||||||
// Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. | ||||||
Etag *string `json:"etag,omitempty"` | ||||||
// ID - Resource ID. | ||||||
ID *string `json:"id,omitempty"` | ||||||
} | ||||||
|
||||||
// AzureFirewallIPConfigurationPropertiesFormat properties of IP configuration of an Azure Firewall. | ||||||
type AzureFirewallIPConfigurationPropertiesFormat struct { | ||||||
// PrivateIPAddress - READ-ONLY; The Firewall Internal Load Balancer IP to be used as the next hop in User Defined Routes. | ||||||
PrivateIPAddress *string `json:"privateIPAddress,omitempty"` | ||||||
// Subnet - Reference of the subnet resource. This resource must be named 'AzureFirewallSubnet'. | ||||||
Subnet *SubResource `json:"subnet,omitempty"` | ||||||
// PublicIPAddress - Reference of the PublicIP resource. This field is a mandatory input if subnet is not null. | ||||||
PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` | ||||||
// ProvisioningState - The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' | ||||||
ProvisioningState *string `json:"provisioningState,omitempty"` | ||||||
} | ||||||
|
||||||
// SubResource reference to another subresource. | ||||||
type SubResource struct { | ||||||
// ID - Resource ID. | ||||||
ID *string `json:"id,omitempty"` | ||||||
} | ||||||
|
||||||
// HubIPAddresses IP addresses associated with azure firewall. | ||||||
type HubIPAddresses struct { | ||||||
// PublicIPAddresses - List of Public IP addresses associated with azure firewall. | ||||||
PublicIPAddresses *[]AzureFirewallPublicIPAddress `json:"publicIPAddresses,omitempty"` | ||||||
// PrivateIPAddress - Private IP Address associated with azure firewall. | ||||||
PrivateIPAddress *string `json:"privateIPAddress,omitempty"` | ||||||
} | ||||||
|
||||||
// AzureFirewallPublicIPAddress public IP Address associated with azure firewall. | ||||||
type AzureFirewallPublicIPAddress struct { | ||||||
// Address - Public IP Address value. | ||||||
Address *string `json:"address,omitempty"` | ||||||
} | ||||||
|
||||||
// A AzureFirewallStatus represents the observed status of a AzureFirewall. | ||||||
type AzureFirewallStatus struct { | ||||||
runtimev1alpha1.ResourceStatus `json:",inline"` | ||||||
|
||||||
// State of this SecurityGroup. | ||||||
State string `json:"state,omitempty"` | ||||||
|
||||||
// A Message providing detail about the state of this AzureFirewall, if | ||||||
// any. | ||||||
Message string `json:"message,omitempty"` | ||||||
|
||||||
// ID of this AzureFirewall. | ||||||
ID string `json:"id,omitempty"` | ||||||
|
||||||
// Etag - A unique read-only string that changes whenever the resource is | ||||||
// updated. | ||||||
Etag string `json:"etag,omitempty"` | ||||||
|
||||||
// ResourceGUID - The GUID of this AzureFirewall. | ||||||
ResourceGUID string `json:"resourceGuid,omitempty"` | ||||||
|
||||||
// Type of this AzureFirewall. | ||||||
Type string `json:"type,omitempty"` | ||||||
} | ||||||
|
||||||
//Rules Structs | ||||||
// AzureFirewallNatRule properties of a NAT rule. | ||||||
type AzureFirewallNatRule struct { | ||||||
// Name - Name of the NAT rule. | ||||||
Name string `json:"name,omitempty"` | ||||||
// Description - Description of the rule. | ||||||
Description string `json:"description,omitempty"` | ||||||
// SourceAddresses - List of source IP addresses for this rule. | ||||||
SourceAddresses []string `json:"sourceAddresses,omitempty"` | ||||||
// DestinationAddresses - List of destination IP addresses for this rule. Supports IP ranges, prefixes, and service tags. | ||||||
DestinationAddresses []string `json:"destinationAddresses,omitempty"` | ||||||
// DestinationPorts - List of destination ports. | ||||||
DestinationPorts []string `json:"destinationPorts,omitempty"` | ||||||
// Protocols - Array of AzureFirewallNetworkRuleProtocols applicable to this NAT rule. | ||||||
Protocols []string `json:"protocols,omitempty"` | ||||||
// TranslatedAddress - The translated address for this NAT rule. | ||||||
TranslatedAddress string `json:"translatedAddress,omitempty"` | ||||||
// TranslatedPort - The translated port for this NAT rule. | ||||||
TranslatedPort string `json:"translatedPort,omitempty"` | ||||||
} | ||||||
|
||||||
// AzureFirewallNatRuleCollectionProperties properties of the NAT rule collection. | ||||||
type AzureFirewallNatRuleCollectionProperties struct { | ||||||
// Priority - Priority of the NAT rule collection resource. | ||||||
Priority int32 `json:"priority,omitempty"` | ||||||
// Action - The action type of a NAT rule collection. | ||||||
Action string `json:"action,omitempty"` | ||||||
// Rules - Collection of rules used by a NAT rule collection. | ||||||
Rules []AzureFirewallNatRule `json:"rules,omitempty"` | ||||||
// ProvisioningState - The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' | ||||||
ProvisioningState string `json:"provisioningState,omitempty"` | ||||||
} | ||||||
|
||||||
// AzureFirewallNatRuleCollection NAT rule collection resource. | ||||||
type AzureFirewallNatRuleCollection struct { | ||||||
// AzureFirewallNatRuleCollectionProperties - Properties of the azure firewall NAT rule collection. | ||||||
Properties AzureFirewallNatRuleCollectionProperties `json:"properties,omitempty"` | ||||||
// Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource. | ||||||
Name string `json:"name,omitempty"` | ||||||
// Etag - READ-ONLY; Gets a unique read-only string that changes whenever the resource is updated. | ||||||
Etag string `json:"etag,omitempty"` | ||||||
// ID - Resource ID. | ||||||
ID string `json:"id,omitempty"` | ||||||
} | ||||||
|
||||||
// AzureFirewallNetworkRuleCollection network rule collection resource. | ||||||
type AzureFirewallNetworkRuleCollection struct { | ||||||
// AzureFirewallNetworkRuleCollectionPropertiesFormat - Properties of the azure firewall network rule collection. | ||||||
Properties AzureFirewallNetworkRuleCollectionPropertiesFormat `json:"properties,omitempty"` | ||||||
// Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource. | ||||||
Name string `json:"name,omitempty"` | ||||||
// Etag - READ-ONLY; Gets a unique read-only string that changes whenever the resource is updated. | ||||||
Etag string `json:"etag,omitempty"` | ||||||
// ID - Resource ID. | ||||||
ID string `json:"id,omitempty"` | ||||||
} | ||||||
|
||||||
// AzureFirewallNetworkRuleCollectionPropertiesFormat properties of the network rule collection. | ||||||
type AzureFirewallNetworkRuleCollectionPropertiesFormat struct { | ||||||
// Priority - Priority of the network rule collection resource. | ||||||
Priority int32 `json:"priority,omitempty"` | ||||||
// Action - The action type of a rule collection. | ||||||
Action string `json:"action,omitempty"` | ||||||
// Rules - Collection of rules used by a network rule collection. | ||||||
Rules []AzureFirewallNetworkRule `json:"rules,omitempty"` | ||||||
// ProvisioningState - The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' | ||||||
ProvisioningState string `json:"provisioningState,omitempty"` | ||||||
} | ||||||
|
||||||
// AzureFirewallNetworkRule properties of the network rule. | ||||||
type AzureFirewallNetworkRule struct { | ||||||
// Name - Name of the network rule. | ||||||
Name string `json:"name,omitempty"` | ||||||
// Description - Description of the rule. | ||||||
Description string `json:"description,omitempty"` | ||||||
// Protocols - Array of AzureFirewallNetworkRuleProtocols. | ||||||
Protocols []string `json:"protocols,omitempty"` | ||||||
// SourceAddresses - List of source IP addresses for this rule. | ||||||
SourceAddresses []string `json:"sourceAddresses,omitempty"` | ||||||
// DestinationAddresses - List of destination IP addresses. | ||||||
DestinationAddresses []string `json:"destinationAddresses,omitempty"` | ||||||
// DestinationPorts - List of destination ports. | ||||||
DestinationPorts []string `json:"destinationPorts,omitempty"` | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick:
reclaimPolicy
is deprecated so we probably shouldn't show it hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed reclaim policy declaration code.