Skip to content
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

chore: remove protos for new policies #5218

Merged
merged 27 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b6bfcc3
chore: create generator, replace protos for MeshTrafficPermission
lobkovilya Oct 24, 2022
066e927
chore: rewrite policies
lobkovilya Oct 26, 2022
03560ba
chore: make check
lobkovilya Oct 26, 2022
e0aa907
chore: make test
lobkovilya Oct 26, 2022
643d633
chore: remove old generator
lobkovilya Oct 26, 2022
a1d3232
Merge branch 'master' into chore/remove-protos
lobkovilya Oct 26, 2022
6af3498
chore: make check
lobkovilya Oct 26, 2022
02c7bbf
chore: remove 'DENY_WITH_SHADOW_ALLOW' from tests
lobkovilya Oct 26, 2022
75b872c
Merge branch 'master' into chore/remove-protos
lobkovilya Oct 26, 2022
5a7fd1a
chore: remove typeDesc from util methods
lobkovilya Oct 26, 2022
55cea0c
chore: simplify getter generator
lobkovilya Oct 27, 2022
5ba6b6b
chore: review
lobkovilya Oct 27, 2022
c8e7467
chore: remove getters, replace pointers with values
lobkovilya Oct 28, 2022
cd4c685
chore: remove getter gen
lobkovilya Oct 28, 2022
89119d3
chore: remove nullable for 'from/to'
lobkovilya Oct 28, 2022
f6ad262
chore: fix typo in file name
lobkovilya Oct 28, 2022
36a34fe
chore: move targetref
lobkovilya Oct 28, 2022
354e01a
chore: conf isn't a pointer
lobkovilya Oct 28, 2022
a4c34de
chore: update policy bootstrap
lobkovilya Oct 28, 2022
1112199
Merge branch 'master' into chore/remove-protos
lobkovilya Oct 28, 2022
5db2418
chore: review
lobkovilya Oct 31, 2022
72afe4d
chore: make check
lobkovilya Oct 31, 2022
882d59a
Merge branch 'master' into chore/remove-protos
lobkovilya Oct 31, 2022
dfe5f2c
Apply suggestions from code review
lobkovilya Nov 2, 2022
126f77a
Merge branch 'master' into chore/remove-protos
lobkovilya Nov 2, 2022
395f9cb
chore: make check
lobkovilya Nov 2, 2022
96eb3d7
chore: remove space in golden file
lobkovilya Nov 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions api/common/v1alpha1/targetref.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// +kubebuilder:object:generate=true
package v1alpha1
lahabana marked this conversation as resolved.
Show resolved Hide resolved

type TargetRefKind string

var Mesh TargetRefKind = "Mesh"
var MeshSubset TargetRefKind = "MeshSubset"
var MeshService TargetRefKind = "MeshService"
var MeshServiceSubset TargetRefKind = "MeshServiceSubset"
var MeshGatewayRoute TargetRefKind = "MeshGatewayRoute"
var MeshHTTPRoute TargetRefKind = "MeshHTTPRoute"
lobkovilya marked this conversation as resolved.
Show resolved Hide resolved

var order = map[TargetRefKind]int{
Mesh: 1,
MeshSubset: 2,
MeshService: 3,
MeshServiceSubset: 4,
MeshGatewayRoute: 5,
MeshHTTPRoute: 6,
}

func (k TargetRefKind) Less(o TargetRefKind) bool {
return order[k] < order[o]
}

// TargetRef defines structure that allows attaching policy to various objects
type TargetRef struct {
// Kind of the referenced resource
lobkovilya marked this conversation as resolved.
Show resolved Hide resolved
// +kubebuilder:validation:Enum=Mesh;MeshSubset;MeshService;MeshServiceSubset;MeshGatewayRoute;MeshHTTPRoute
lahabana marked this conversation as resolved.
Show resolved Hide resolved
Kind TargetRefKind `json:"kind,omitempty"`
// Name of the referenced resource
lobkovilya marked this conversation as resolved.
Show resolved Hide resolved
Name string `json:"name,omitempty"`
// Tags are used with MeshSubset and MeshServiceSubset to define a subset of
lobkovilya marked this conversation as resolved.
Show resolved Hide resolved
// proxies
lobkovilya marked this conversation as resolved.
Show resolved Hide resolved
Tags map[string]string `json:"tags,omitempty"`
// Mesh is used with MeshService and MeshServiceSubset to identify the service
// from another mesh. Could be useful when implementing policies with
// cross-mesh support.
lobkovilya marked this conversation as resolved.
Show resolved Hide resolved
Mesh string `json:"mesh,omitempty"`
}
259 changes: 0 additions & 259 deletions api/common/v1alpha1/targetref.pb.go

This file was deleted.

33 changes: 0 additions & 33 deletions api/common/v1alpha1/targetref.proto

This file was deleted.

9 changes: 0 additions & 9 deletions api/common/v1alpha1/targetref_helper.go

This file was deleted.

25 changes: 25 additions & 0 deletions api/common/v1alpha1/wrappers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package v1alpha1

type UInt32Value struct {
// The uint32 value.
Value uint32 `json:"value,omitempty"`
}

func (x *UInt32Value) GetValue() uint32 {
if x != nil {
return x.Value
}
return 0
}

type BoolValue struct {
// The bool value.
Value bool `json:"value,omitempty"`
}

func (x *BoolValue) GetValue() bool {
if x != nil {
return x.Value
}
return false
}
Loading