-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make external ip ranger admission config based
- Loading branch information
Showing
20 changed files
with
184 additions
and
39 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
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
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
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
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
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,4 @@ | ||
// +k8s:deepcopy-gen=package,register | ||
|
||
// Package externalipranger is the internal version of the API. | ||
package externalipranger |
14 changes: 14 additions & 0 deletions
14
pkg/service/admission/apis/externalipranger/install/install.go
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,14 @@ | ||
package install | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime" | ||
utilruntime "k8s.io/apimachinery/pkg/util/runtime" | ||
|
||
"github.com/openshift/origin/pkg/service/admission/apis/externalipranger" | ||
"github.com/openshift/origin/pkg/service/admission/apis/externalipranger/v1" | ||
) | ||
|
||
func InstallLegacyInternal(scheme *runtime.Scheme) { | ||
utilruntime.Must(externalipranger.InstallLegacy(scheme)) | ||
utilruntime.Must(v1.InstallLegacy(scheme)) | ||
} |
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,20 @@ | ||
package externalipranger | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
var SchemeGroupVersion = schema.GroupVersion{Group: "", Version: runtime.APIVersionInternal} | ||
|
||
var ( | ||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) | ||
InstallLegacy = SchemeBuilder.AddToScheme | ||
) | ||
|
||
func addKnownTypes(scheme *runtime.Scheme) error { | ||
scheme.AddKnownTypes(SchemeGroupVersion, | ||
&ExternalIPRangerAdmissionConfig{}, | ||
) | ||
return nil | ||
} |
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,20 @@ | ||
package externalipranger | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// RestrictedEndpointsAdmissionConfig is the configuration for which CIDRs services can't manage | ||
type ExternalIPRangerAdmissionConfig struct { | ||
metav1.TypeMeta | ||
|
||
// ExternalIPNetworkCIDRs controls what values are acceptable for the service external IP field. If empty, no externalIP | ||
// may be set. It may contain a list of CIDRs which are checked for access. If a CIDR is prefixed with !, IPs in that | ||
// CIDR will be rejected. Rejections will be applied first, then the IP checked against one of the allowed CIDRs. You | ||
// should ensure this range does not overlap with your nodes, pods, or service CIDRs for security reasons. | ||
ExternalIPNetworkCIDRs []string | ||
// AllowIngressIP indicates that ingress IPs should be allowed | ||
AllowIngressIP bool | ||
} |
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,4 @@ | ||
// +k8s:deepcopy-gen=package,register | ||
|
||
// Package v1 is the v1 version of the API. | ||
package v1 |
26 changes: 26 additions & 0 deletions
26
pkg/service/admission/apis/externalipranger/v1/register.go
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,26 @@ | ||
package v1 | ||
|
||
import ( | ||
"github.com/openshift/origin/pkg/service/admission/apis/restrictedendpoints" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
// SchemeGroupVersion is group version used to register these objects | ||
var SchemeGroupVersion = schema.GroupVersion{Group: "", Version: "v1"} | ||
|
||
var ( | ||
SchemeBuilder = runtime.NewSchemeBuilder( | ||
addKnownTypes, | ||
restrictedendpoints.InstallLegacy, | ||
) | ||
InstallLegacy = SchemeBuilder.AddToScheme | ||
) | ||
|
||
// Adds the list of known types to api.Scheme. | ||
func addKnownTypes(scheme *runtime.Scheme) error { | ||
scheme.AddKnownTypes(SchemeGroupVersion, | ||
&ExternalIPRangerAdmissionConfig{}, | ||
) | ||
return nil | ||
} |
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,20 @@ | ||
package v1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// ExternalIPRangerAdmissionConfig is the configuration for which CIDRs services can't manage | ||
type ExternalIPRangerAdmissionConfig struct { | ||
metav1.TypeMeta `json:",inline"` | ||
|
||
// ExternalIPNetworkCIDRs controls what values are acceptable for the service external IP field. If empty, no externalIP | ||
// may be set. It may contain a list of CIDRs which are checked for access. If a CIDR is prefixed with !, IPs in that | ||
// CIDR will be rejected. Rejections will be applied first, then the IP checked against one of the allowed CIDRs. You | ||
// should ensure this range does not overlap with your nodes, pods, or service CIDRs for security reasons. | ||
ExternalIPNetworkCIDRs []string `json:"externalIPNetworkCIDRs"` | ||
// AllowIngressIP indicates that ingress IPs should be allowed | ||
AllowIngressIP bool `json:"allowIngressIP"` | ||
} |
Oops, something went wrong.