-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: chrischdi <[email protected]> Co-authored-by: sbueringer <[email protected]>
- Loading branch information
1 parent
a1122e2
commit 48cda1a
Showing
15 changed files
with
986 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
Copyright 2022 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
// ResponseStatus represents the status of the hook response. | ||
// +enum | ||
type ResponseStatus string | ||
|
||
const ( | ||
// ResponseStatusSuccess represents the success response. | ||
ResponseStatusSuccess ResponseStatus = "Success" | ||
|
||
// ResponseStatusFailure represents a failure response. | ||
ResponseStatusFailure ResponseStatus = "Failure" | ||
) |
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,91 @@ | ||
/* | ||
Copyright 2022 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
"sigs.k8s.io/cluster-api/internal/runtime/catalog" | ||
) | ||
|
||
// FailurePolicy is the type of a extension failure policy. | ||
type FailurePolicy string | ||
|
||
const ( | ||
// FailurePolicyIgnore means that an error calling the extension is ignored. | ||
FailurePolicyIgnore FailurePolicy = "Ignore" | ||
|
||
// FailurePolicyFail means that an error calling the extension causes the admission to fail. | ||
FailurePolicyFail FailurePolicy = "Fail" | ||
) | ||
|
||
// Hook is a identifier of a runtime hook. | ||
type Hook struct { | ||
// APIVersion is the Version of the Hook | ||
APIVersion string `json:"apiVersion"` | ||
|
||
// Name is the name of the hook | ||
Name string `json:"name"` | ||
} | ||
|
||
// RuntimeExtension represents the discovery information of the extension which includes | ||
// the hook is supports. | ||
type RuntimeExtension struct { | ||
// Name is the name of the RuntimeExtension | ||
Name string `json:"name"` | ||
|
||
// Hook defines the specific runtime event for which this RuntimeExtension calls. | ||
Hook Hook `json:"hook"` | ||
|
||
// TimeoutSeconds defines the timeout duration for client calls to the Hook | ||
TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` | ||
|
||
// FailurePolicy defines how failures in calls to the Hook should be handled by a client. | ||
FailurePolicy *FailurePolicy `json:"failurePolicy,omitempty"` | ||
} | ||
|
||
// DiscoveryHookRequest foo bar baz. | ||
// +kubebuilder:object:root=true | ||
type DiscoveryHookRequest struct { | ||
metav1.TypeMeta `json:",inline"` | ||
} | ||
|
||
// DiscoveryHookResponse foo bar baz. | ||
// +kubebuilder:object:root=true | ||
type DiscoveryHookResponse struct { | ||
metav1.TypeMeta `json:",inline"` | ||
|
||
// Status of the call. One of "Success" or "Failure". | ||
Status ResponseStatus `json:"status"` | ||
|
||
// A human-readable description of the status of the call. | ||
Message string `json:"message"` | ||
|
||
Extensions []RuntimeExtension `json:"extensions"` | ||
} | ||
|
||
// Discovery represents the discovery hook. | ||
func Discovery(*DiscoveryHookRequest, *DiscoveryHookResponse) {} | ||
|
||
func init() { | ||
catalogBuilder.RegisterHook(Discovery, &catalog.HookMeta{ | ||
Tags: []string{"Discovery"}, | ||
Summary: "Discovery endpoint", | ||
Description: "Discovery endpoint discovers the supported hook of a runtime extension", | ||
Singleton: true, | ||
}) | ||
} |
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,21 @@ | ||
/* | ||
Copyright 2022 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// Package v1alpha1 contains the v1alpha1 idl implementation for extension1. | ||
// +k8s:conversion-gen=sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha3 | ||
// +kubebuilder:object:generate=true | ||
// +k8s:openapi-gen=true | ||
package v1alpha1 |
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,37 @@ | ||
/* | ||
Copyright 2022 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
|
||
"sigs.k8s.io/cluster-api/internal/runtime/catalog" | ||
) | ||
|
||
var ( | ||
// GroupVersion is group version identifying rpc services defined in this package | ||
// and their request and response types. | ||
GroupVersion = schema.GroupVersion{Group: "hooks.runtime.cluster.x-k8s.io", Version: "v1alpha1"} | ||
|
||
// catalogBuilder is used to add rpc services and their request and response types | ||
// to a Catalog. | ||
catalogBuilder = &catalog.Builder{GroupVersion: GroupVersion} | ||
|
||
// AddToCatalog adds rpc services defined in this package and their request and | ||
// response types to a catalog. | ||
AddToCatalog = catalogBuilder.AddToCatalog | ||
) |
122 changes: 122 additions & 0 deletions
122
exp/runtime/hooks/api/v1alpha1/zz_generated.deepcopy.go
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,37 @@ | ||
/* | ||
Copyright 2022 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
conversion "k8s.io/apimachinery/pkg/conversion" | ||
|
||
clusterv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" | ||
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" | ||
v1alpha2 "sigs.k8s.io/cluster-api/internal/runtime/catalog/test/v1alpha2" | ||
) | ||
|
||
func Convert_v1alpha1_FakeResponse_To_v1alpha2_FakeResponse(in *FakeResponse, out *v1alpha2.FakeResponse, s conversion.Scope) error { | ||
return autoConvert_v1alpha1_FakeResponse_To_v1alpha2_FakeResponse(in, out, s) | ||
} | ||
|
||
func Convert_v1alpha4_Cluster_To_v1beta1_Cluster(in *clusterv1alpha4.Cluster, out *clusterv1.Cluster, s conversion.Scope) error { | ||
return clusterv1alpha4.Convert_v1alpha4_Cluster_To_v1beta1_Cluster(in, out, s) | ||
} | ||
|
||
func Convert_v1beta1_Cluster_To_v1alpha4_Cluster(in *clusterv1.Cluster, out *clusterv1alpha4.Cluster, s conversion.Scope) error { | ||
return clusterv1alpha4.Convert_v1beta1_Cluster_To_v1alpha4_Cluster(in, out, s) | ||
} |
Oops, something went wrong.