Skip to content

Commit

Permalink
remapping names fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cheina97 committed Dec 21, 2023
1 parent 64947aa commit 3c6ccec
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ require (
github.com/containernetworking/plugins v1.4.0
github.com/coreos/go-iptables v0.7.0
github.com/go-git/go-git/v5 v5.11.0
github.com/google/uuid v1.5.0
github.com/google/nftables v0.1.0
github.com/google/uuid v1.5.0
github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e
github.com/grandcat/zeroconf v1.0.0
github.com/gruntwork-io/gruntwork-cli v0.7.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+
github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII=
github.com/go-git/go-git/v5 v5.10.1 h1:tu8/D8i+TWxgKpzQ3Vc43e+kkhXqtsZCKI/egajKnxk=
github.com/go-git/go-git/v5 v5.10.1/go.mod h1:uEuHjxkHap8kAl//V5F/nNWwqIYtP/402ddd05mp0wg=
github.com/go-git/go-git/v5 v5.11.0 h1:XIZc1p+8YzypNr34itUfSvYJcv+eYdTnTvOZ2vD3cA4=
github.com/go-git/go-git/v5 v5.11.0/go.mod h1:6GFcX2P3NM7FPBfpePbpLd21XxsgdAt+lKqXmCUiUCY=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
Expand Down
12 changes: 6 additions & 6 deletions pkg/gateway/remapping/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
package remapping

var (
// TableNamePodCIDR is the name of the table for the pod CIDR.
TableNamePodCIDR = "remap-podcidr"
// TablePodCIDRName is the name of the table for the pod CIDR.
TablePodCIDRName = "remap-podcidr"

// DNATChain is the name of the chain for the output traffic.
DNATChain = "Outgoing packets remapping"
// SNATChain is the name of the chain for the input traffic.
SNATChain = "Incoming packets remapping"
// DNATChainName is the name of the chain for the output traffic.
DNATChainName = "Outgoing packets remapping"
// SNATChainName is the name of the chain for the input traffic.
SNATChainName = "Incoming packets remapping"
)
8 changes: 4 additions & 4 deletions pkg/gateway/remapping/podcidr.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func CreateOrUpdateNatMappingPodCIDR(ctx context.Context, cl client.Client,
cfg *networkingv1alpha1.Configuration, scheme *runtime.Scheme, opts *Options) error {
fwcfg := &networkingv1alpha1.FirewallConfiguration{
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("%s-%s", cfg.Name, TableNamePodCIDR),
Name: fmt.Sprintf("%s-%s", cfg.Name, TablePodCIDRName),
Namespace: cfg.Namespace,
},
}
Expand All @@ -58,7 +58,7 @@ func forgePodCIDRFirewallConfigurationSpec(cfg *networkingv1alpha1.Configuration
opts *Options) networkingv1alpha1.FirewallConfigurationSpec {
return networkingv1alpha1.FirewallConfigurationSpec{
Table: firewall.Table{
Name: &TableNamePodCIDR,
Name: &TablePodCIDRName,
Family: ptr.To(firewall.TableFamilyIPv4),
Chains: []firewall.Chain{
forgePodCIDRFirewallConfigurationDNATChain(cfg, opts),
Expand All @@ -71,7 +71,7 @@ func forgePodCIDRFirewallConfigurationSpec(cfg *networkingv1alpha1.Configuration
func forgePodCIDRFirewallConfigurationDNATChain(cfg *networkingv1alpha1.Configuration,
opts *Options) firewall.Chain {
return firewall.Chain{
Name: &DNATChain,
Name: &DNATChainName,
Policy: ptr.To(firewall.ChainPolicyAccept),
Type: ptr.To(firewall.ChainTypeNAT),
Hook: &firewall.ChainHookPrerouting,
Expand All @@ -85,7 +85,7 @@ func forgePodCIDRFirewallConfigurationDNATChain(cfg *networkingv1alpha1.Configur
func forgePodCIDRFirewallConfigurationSNATChain(cfg *networkingv1alpha1.Configuration,
opts *Options) firewall.Chain {
return firewall.Chain{
Name: &SNATChain,
Name: &SNATChainName,
Policy: ptr.To(firewall.ChainPolicyAccept),
Type: ptr.To(firewall.ChainTypeNAT),
Hook: &firewall.ChainHookPostrouting,
Expand Down
2 changes: 1 addition & 1 deletion pkg/gateway/remapping/remapping_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (r *RemappingReconciler) Reconcile(ctx context.Context, req ctrl.Request) (

fwcfg := &networkingv1alpha1.FirewallConfiguration{
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("%s-%s", configuration.Name, TableNamePodCIDR),
Name: fmt.Sprintf("%s-%s", configuration.Name, TablePodCIDRName),
Namespace: configuration.Namespace,
Labels: ForgeFirewallTargetLabels(r.Options.GwOptions.RemoteClusterID),
},
Expand Down

0 comments on commit 3c6ccec

Please sign in to comment.