-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #361 from ngrok/del/27983-policy-kind
create policy kind
- Loading branch information
Showing
17 changed files
with
665 additions
and
6 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
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,44 @@ | ||
/* | ||
MIT License | ||
Copyright (c) 2022 ngrok, Inc. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ | ||
|
||
// Package v1alpha1 contains API Schema definitions for the ngrok v1alpha1 API group | ||
// +kubebuilder:object:generate=true | ||
// +groupName=ngrok.k8s.ngrok.com | ||
package v1alpha1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"sigs.k8s.io/controller-runtime/pkg/scheme" | ||
) | ||
|
||
var ( | ||
// GroupVersion is group version used to register these objects | ||
GroupVersion = schema.GroupVersion{Group: "ngrok.k8s.ngrok.com", Version: "v1alpha1"} | ||
|
||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme | ||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} | ||
|
||
// AddToScheme adds the types in this group-version to the given scheme. | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) |
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,74 @@ | ||
/* | ||
MIT License | ||
Copyright (c) 2022 ngrok, Inc. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
"encoding/json" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! | ||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. | ||
|
||
// NgrokTrafficPolicySpec defines the desired state of NgrokTrafficPolicy | ||
type NgrokTrafficPolicySpec struct { | ||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster | ||
// Important: Run "make" to regenerate code after modifying this file | ||
|
||
Policy json.RawMessage `json:"policy,omitempty"` | ||
} | ||
|
||
// NgrokTrafficPolicyStatus defines the observed state of NgrokTrafficPolicy | ||
type NgrokTrafficPolicyStatus struct { | ||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster | ||
// Important: Run "make" to regenerate code after modifying this file | ||
Policy json.RawMessage `json:"policy,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
//+kubebuilder:subresource:status | ||
|
||
// NgrokTrafficPolicy is the Schema for the ngroktrafficpolicies API | ||
type NgrokTrafficPolicy struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec NgrokTrafficPolicySpec `json:"spec,omitempty"` | ||
Status NgrokTrafficPolicyStatus `json:"status,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// NgrokTrafficPolicyList contains a list of NgrokTrafficPolicy | ||
type NgrokTrafficPolicyList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []NgrokTrafficPolicy `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&NgrokTrafficPolicy{}, &NgrokTrafficPolicyList{}) | ||
} |
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
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,23 @@ | ||
# This kustomization.yaml is not intended to be run by itself, | ||
# since it depends on service name and namespace that are out of this kustomize package. | ||
# It should be run by config/default | ||
resources: | ||
- bases/ngrok.k8s.ngrok.com_ngroktrafficpolicies.yaml | ||
#+kubebuilder:scaffold:crdkustomizeresource | ||
|
||
patches: | ||
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix. | ||
# patches here are for enabling the conversion webhook for each CRD | ||
#- path: patches/webhook_in_ngrok_ngroktrafficpolicies.yaml | ||
#+kubebuilder:scaffold:crdkustomizewebhookpatch | ||
|
||
# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. | ||
# patches here are for enabling the CA injection for each CRD | ||
#- path: patches/cainjection_in_ngrok_ngroktrafficpolicies.yaml | ||
#+kubebuilder:scaffold:crdkustomizecainjectionpatch | ||
|
||
# [WEBHOOK] To enable webhook, uncomment the following section | ||
# the following config is for teaching kustomize how to do kustomization for CRDs. | ||
|
||
#configurations: | ||
#- kustomizeconfig.yaml |
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,19 @@ | ||
# This file is for teaching kustomize how to substitute name and namespace reference in CRD | ||
nameReference: | ||
- kind: Service | ||
version: v1 | ||
fieldSpecs: | ||
- kind: CustomResourceDefinition | ||
version: v1 | ||
group: apiextensions.k8s.io | ||
path: spec/conversion/webhook/clientConfig/service/name | ||
|
||
namespace: | ||
- kind: CustomResourceDefinition | ||
version: v1 | ||
group: apiextensions.k8s.io | ||
path: spec/conversion/webhook/clientConfig/service/namespace | ||
create: false | ||
|
||
varReference: | ||
- path: metadata/annotations |
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,31 @@ | ||
# permissions for end users to edit ngroktrafficpolicies. | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: clusterrole | ||
app.kubernetes.io/instance: ngroktrafficpolicy-editor-role | ||
app.kubernetes.io/component: rbac | ||
app.kubernetes.io/created-by: kubernetes-ingress-controller | ||
app.kubernetes.io/part-of: kubernetes-ingress-controller | ||
app.kubernetes.io/managed-by: kustomize | ||
name: ngroktrafficpolicy-editor-role | ||
rules: | ||
- apiGroups: | ||
- ngrok.k8s.ngrok.com | ||
resources: | ||
- ngroktrafficpolicies | ||
verbs: | ||
- create | ||
- delete | ||
- get | ||
- list | ||
- patch | ||
- update | ||
- watch | ||
- apiGroups: | ||
- ngrok.k8s.ngrok.com | ||
resources: | ||
- ngroktrafficpolicies/status | ||
verbs: | ||
- get |
Oops, something went wrong.