-
Notifications
You must be signed in to change notification settings - Fork 39
PoC/WIP: Add cert-manager-proxy scaffolding #313
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
Open
sebrandon1
wants to merge
1
commit into
openshift:master
Choose a base branch
from
sebrandon1:poc_cert_manager_proxy
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,188 @@ | ||
| package v1alpha1 | ||
|
|
||
| import ( | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| runtime "k8s.io/apimachinery/pkg/runtime" | ||
| ) | ||
|
|
||
| func init() { | ||
| SchemeBuilder.Register(&HTTP01Proxy{}, &HTTP01ProxyList{}) | ||
| } | ||
|
|
||
| // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
| //+kubebuilder:object:root=true | ||
|
|
||
| // HTTP01ProxyList is a list of HTTP01Proxy objects. | ||
| type HTTP01ProxyList struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
|
|
||
| // metadata is the standard list's metadata. | ||
| // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata | ||
| metav1.ListMeta `json:"metadata"` | ||
| Items []HTTP01Proxy `json:"items"` | ||
| } | ||
|
|
||
| // +genclient | ||
| // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
| // +kubebuilder:subresource:status | ||
|
|
||
| // HTTP01Proxy describes configuration for a cluster-managed HTTP-01 challenge proxy. | ||
| // The name must be `default` to make it a singleton per namespace. | ||
| // | ||
| // When an HTTP01Proxy is created and enabled, the operator may deploy and | ||
| // manage components needed to route and respond to ACME HTTP-01 challenges | ||
| // for eligible namespaces. | ||
| // | ||
| // +kubebuilder:object:root=true | ||
| // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" | ||
| // +kubebuilder:validation:XValidation:rule="self.metadata.name == 'default'",message="http01proxy is a singleton, .metadata.name must be 'default'" | ||
| // +operator-sdk:csv:customresourcedefinitions:displayName="HTTP01Proxy" | ||
| type HTTP01Proxy struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
|
|
||
| // metadata is the standard object's metadata. | ||
| // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata | ||
| metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
|
||
| // spec is the specification of the desired behavior of the HTTP01Proxy. | ||
| // +kubebuilder:validation:Required | ||
| // +required | ||
| Spec HTTP01ProxySpec `json:"spec,omitempty"` | ||
|
|
||
| // status is the most recently observed status of the HTTP01Proxy. | ||
| Status HTTP01ProxyStatus `json:"status,omitempty"` | ||
| } | ||
|
|
||
| // HTTP01ProxySpec defines desired behavior for managing HTTP-01 challenge proxying. | ||
| type HTTP01ProxySpec struct { | ||
| // enabled turns the HTTP01 proxy manager on or off. | ||
| // +kubebuilder:default:=false | ||
| // +kubebuilder:validation:Optional | ||
| // +optional | ||
| Enabled bool `json:"enabled,omitempty"` | ||
|
|
||
| // allowedNamespaces restricts which namespaces may utilize the proxy. | ||
| // When unset, no namespaces are allowed. Set a label selector to opt-in. | ||
| // +kubebuilder:validation:Optional | ||
| // +optional | ||
| AllowedNamespaces *metav1.LabelSelector `json:"allowedNamespaces,omitempty"` | ||
|
|
||
| // cleanupTTLSeconds is the TTL in seconds to keep any ephemeral resources | ||
| // (like Routes) after a challenge is completed. | ||
| // +kubebuilder:default:=600 | ||
| // +kubebuilder:validation:Minimum:=0 | ||
| // +kubebuilder:validation:Optional | ||
| // +optional | ||
| CleanupTTLSeconds int32 `json:"cleanupTTLSeconds,omitempty"` | ||
|
|
||
| // controllerConfig configures labels or other defaults for resources | ||
| // created by the controller. | ||
| // +kubebuilder:validation:Optional | ||
| // +optional | ||
| ControllerConfig *ControllerConfig `json:"controllerConfig,omitempty"` | ||
| } | ||
|
|
||
| // HTTP01ProxyStatus is the most recently observed status of the HTTP01Proxy. | ||
| type HTTP01ProxyStatus struct { | ||
| // conditions holds information about the current state of the HTTP01 proxy controller. | ||
| ConditionalStatus `json:",inline,omitempty"` | ||
|
|
||
| // activeChallenges is a best-effort count of challenges currently being serviced. | ||
| // +kubebuilder:validation:Optional | ||
| // +optional | ||
| ActiveChallenges int32 `json:"activeChallenges,omitempty"` | ||
|
|
||
| // lastError contains a short description of the last reconciliation error, if any. | ||
| // +kubebuilder:validation:Optional | ||
| // +optional | ||
| LastError string `json:"lastError,omitempty"` | ||
| } | ||
|
|
||
| // DeepCopyInto copies all properties of this object into another object of the | ||
| // same type that is provided as a pointer. | ||
| func (in *HTTP01Proxy) DeepCopyInto(out *HTTP01Proxy) { | ||
| *out = *in | ||
| out.TypeMeta = in.TypeMeta | ||
| in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) | ||
| in.Spec.DeepCopyInto(&out.Spec) | ||
| in.Status.DeepCopyInto(&out.Status) | ||
| } | ||
|
|
||
| // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTP01Proxy. | ||
| func (in *HTTP01Proxy) DeepCopy() *HTTP01Proxy { | ||
| if in == nil { | ||
| return nil | ||
| } | ||
| out := new(HTTP01Proxy) | ||
| in.DeepCopyInto(out) | ||
| return out | ||
| } | ||
|
|
||
| // DeepCopyObject copies the receiver, creating a new runtime.Object. | ||
| func (in *HTTP01Proxy) DeepCopyObject() runtime.Object { | ||
| if c := in.DeepCopy(); c != nil { | ||
| return c | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
| // DeepCopyInto for HTTP01ProxySpec | ||
| func (in *HTTP01ProxySpec) DeepCopyInto(out *HTTP01ProxySpec) { | ||
| *out = *in | ||
| if in.AllowedNamespaces != nil { | ||
| out.AllowedNamespaces = new(metav1.LabelSelector) | ||
| in.AllowedNamespaces.DeepCopyInto(out.AllowedNamespaces) | ||
| } | ||
| if in.ControllerConfig != nil { | ||
| out.ControllerConfig = new(ControllerConfig) | ||
| *out.ControllerConfig = *in.ControllerConfig | ||
| if in.ControllerConfig.Labels != nil { | ||
| out.ControllerConfig.Labels = make(map[string]string, len(in.ControllerConfig.Labels)) | ||
| for k, v := range in.ControllerConfig.Labels { | ||
| out.ControllerConfig.Labels[k] = v | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // DeepCopyInto for HTTP01ProxyStatus | ||
| func (in *HTTP01ProxyStatus) DeepCopyInto(out *HTTP01ProxyStatus) { | ||
| *out = *in | ||
| if in.Conditions != nil { | ||
| out.Conditions = make([]metav1.Condition, len(in.Conditions)) | ||
| for i := range in.Conditions { | ||
| in.Conditions[i].DeepCopyInto(&out.Conditions[i]) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // DeepCopyInto copies all properties of this object into another object. | ||
| func (in *HTTP01ProxyList) DeepCopyInto(out *HTTP01ProxyList) { | ||
| *out = *in | ||
| out.TypeMeta = in.TypeMeta | ||
| in.ListMeta.DeepCopyInto(&out.ListMeta) | ||
| if in.Items != nil { | ||
| out.Items = make([]HTTP01Proxy, len(in.Items)) | ||
| for i := range in.Items { | ||
| in.Items[i].DeepCopyInto(&out.Items[i]) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // DeepCopy creates a new deep-copied HTTP01ProxyList. | ||
| func (in *HTTP01ProxyList) DeepCopy() *HTTP01ProxyList { | ||
| if in == nil { | ||
| return nil | ||
| } | ||
| out := new(HTTP01ProxyList) | ||
| in.DeepCopyInto(out) | ||
| return out | ||
| } | ||
|
|
||
| // DeepCopyObject creates a new runtime.Object deep copy. | ||
| func (in *HTTP01ProxyList) DeepCopyObject() runtime.Object { | ||
| if c := in.DeepCopy(); c != nil { | ||
| return c | ||
| } | ||
| return nil | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make
spectruly required (dropomitempty)You’ve marked Spec as required, but
json:",omitempty"can cause clients to omit it when zero-valued, leading to CRD validation failures. Removeomitempty.Apply this diff:
🤖 Prompt for AI Agents