@@ -19,7 +19,18 @@ package v1alpha1
1919import (
2020 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121
22+ clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
2223 capierrors "sigs.k8s.io/cluster-api/errors"
24+
25+ fcmv2 "github.com/metal-stack/firewall-controller-manager/api/v2"
26+ )
27+
28+ const (
29+ // ClusterFinalizer allows to clean up resources associated with before removing it from the apiserver.
30+ ClusterFinalizer = "metal-stack.infrastructure.cluster.x-k8s.io/cluster"
31+
32+ ClusterNodeNetworkEnsured clusterv1.ConditionType = "ClusterNodeNetworkEnsured"
33+ ClusterFirewallDeploymentReady clusterv1.ConditionType = "ClusterFirewallDeploymentReady"
2334)
2435
2536// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
@@ -32,10 +43,13 @@ type MetalStackClusterSpec struct {
3243 ControlPlaneEndpoint APIEndpoint `json:"controlPlaneEndpoint,omitempty"`
3344
3445 // ProjectID is the project id of the project in metal-stack in which the associated metal-stack resources are created
35- ProjectID string `json:"projectID,omitempty "`
46+ ProjectID string `json:"projectID"`
3647
3748 // Partition is the data center partition in which the resources are created
38- Partition string `json:"partition,omitempty"`
49+ Partition string `json:"partition"`
50+
51+ // Firewall describes the firewall for this cluster
52+ Firewall Firewall `json:"firewall"`
3953}
4054
4155// APIEndpoint represents a reachable Kubernetes API endpoint.
@@ -47,6 +61,31 @@ type APIEndpoint struct {
4761 Port int `json:"port"`
4862}
4963
64+ // Firewall defines parameters for the firewall creation along with configuration for the firewall-controller.
65+ type Firewall struct {
66+ // Size is the machine size of the firewall.
67+ // An update on this field requires the recreation of the physical firewall and can therefore lead to traffic interruption for the cluster.
68+ Size string `json:"size"`
69+ // Image is the os image of the firewall.
70+ // An update on this field requires the recreation of the physical firewall and can therefore lead to traffic interruption for the cluster.
71+ Image string `json:"image"`
72+ // AdditionalNetworks are the networks to which this firewall is connected.
73+ // An update on this field requires the recreation of the physical firewall and can therefore lead to traffic interruption for the cluster.
74+ // +optional
75+ AdditionalNetworks []string `json:"networks,omitempty"`
76+
77+ // RateLimits allows configuration of rate limit rules for interfaces.
78+ // +optional
79+ RateLimits []fcmv2.RateLimit `json:"rateLimits,omitempty"`
80+ // EgressRules contains egress rules configured for this firewall.
81+ // +optional
82+ EgressRules []fcmv2.EgressRuleSNAT `json:"egressRules,omitempty"`
83+
84+ // LogAcceptedConnections if set to true, also log accepted connections in the droptailer log.
85+ // +optional
86+ LogAcceptedConnections * bool `json:"logAcceptedConnections,omitempty"`
87+ }
88+
5089// MetalStackClusterStatus defines the observed state of MetalStackCluster.
5190type MetalStackClusterStatus struct {
5291 // FailureReason indicates that there is a fatal problem reconciling the
@@ -62,6 +101,10 @@ type MetalStackClusterStatus struct {
62101
63102 // Ready denotes that the cluster is ready.
64103 Ready bool `json:"ready"`
104+
105+ // Conditions defines current service state of the Metal3Cluster.
106+ // +optional
107+ Conditions clusterv1.Conditions `json:"conditions,omitempty"`
65108}
66109
67110// +kubebuilder:object:root=true
@@ -88,3 +131,13 @@ type MetalStackClusterList struct {
88131func init () {
89132 SchemeBuilder .Register (& MetalStackCluster {}, & MetalStackClusterList {})
90133}
134+
135+ // GetConditions returns the list of conditions.
136+ func (c * MetalStackCluster ) GetConditions () clusterv1.Conditions {
137+ return c .Status .Conditions
138+ }
139+
140+ // SetConditions will set the given conditions.
141+ func (c * MetalStackCluster ) SetConditions (conditions clusterv1.Conditions ) {
142+ c .Status .Conditions = conditions
143+ }
0 commit comments