-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(v1beta1): remove unused structs and functions from v1beta1. Rename v1alpha1 structs to follow new naming. Move v1alpha1 structs to separate files
- Loading branch information
1 parent
3d714dc
commit 4166093
Showing
26 changed files
with
1,218 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright 2020-2021 Clastix Labs | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package v1alpha1 | ||
|
||
type AdditionalMetadataSpec struct { | ||
AdditionalLabels map[string]string `json:"additionalLabels,omitempty"` | ||
AdditionalAnnotations map[string]string `json:"additionalAnnotations,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright 2020-2021 Clastix Labs | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package v1alpha1 | ||
|
||
import rbacv1 "k8s.io/api/rbac/v1" | ||
|
||
type AdditionalRoleBindingsSpec struct { | ||
ClusterRoleName string `json:"clusterRoleName"` | ||
// kubebuilder:validation:Minimum=1 | ||
Subjects []rbacv1.Subject `json:"subjects"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright 2020-2021 Clastix Labs | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package v1alpha1 | ||
|
||
// +kubebuilder:validation:Pattern="^([0-9]{1,3}.){3}[0-9]{1,3}(/([0-9]|[1-2][0-9]|3[0-2]))?$" | ||
type AllowedIP string | ||
|
||
type ExternalServiceIPsSpec struct { | ||
Allowed []AllowedIP `json:"allowed"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2020-2021 Clastix Labs | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package v1alpha1 | ||
|
||
// OwnerSpec defines tenant owner name and kind | ||
type OwnerSpec struct { | ||
Name string `json:"name"` | ||
Kind Kind `json:"kind"` | ||
} | ||
|
||
// +kubebuilder:validation:Enum=User;Group | ||
type Kind string | ||
|
||
func (k Kind) String() string { | ||
return string(k) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright 2020-2021 Clastix Labs | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package v1beta1 | ||
|
||
type AdditionalMetadataSpec struct { | ||
AdditionalLabels map[string]string `json:"additionalLabels,omitempty"` | ||
AdditionalAnnotations map[string]string `json:"additionalAnnotations,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright 2020-2021 Clastix Labs | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package v1beta1 | ||
|
||
import rbacv1 "k8s.io/api/rbac/v1" | ||
|
||
type AdditionalRoleBindingsSpec struct { | ||
ClusterRoleName string `json:"clusterRoleName"` | ||
// kubebuilder:validation:Minimum=1 | ||
Subjects []rbacv1.Subject `json:"subjects"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2020-2021 Clastix Labs | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package v1beta1 | ||
|
||
import ( | ||
"regexp" | ||
"sort" | ||
"strings" | ||
) | ||
|
||
type AllowedListSpec struct { | ||
Exact []string `json:"allowed,omitempty"` | ||
Regex string `json:"allowedRegex,omitempty"` | ||
} | ||
|
||
func (in *AllowedListSpec) ExactMatch(value string) (ok bool) { | ||
if len(in.Exact) > 0 { | ||
sort.SliceStable(in.Exact, func(i, j int) bool { | ||
return strings.ToLower(in.Exact[i]) < strings.ToLower(in.Exact[j]) | ||
}) | ||
i := sort.SearchStrings(in.Exact, value) | ||
ok = i < len(in.Exact) && in.Exact[i] == value | ||
} | ||
return | ||
} | ||
|
||
func (in AllowedListSpec) RegexMatch(value string) (ok bool) { | ||
if len(in.Regex) > 0 { | ||
ok = regexp.MustCompile(in.Regex).MatchString(value) | ||
} | ||
return | ||
} |
Oops, something went wrong.