-
Notifications
You must be signed in to change notification settings - Fork 41
CM-716: Add HTTP01 Challenge Proxy controller #398
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
2
commits into
openshift:master
Choose a base branch
from
sebrandon1:cm-716-http01-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
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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
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,109 @@ | ||
| package v1alpha1 | ||
|
|
||
| import ( | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| ) | ||
|
|
||
| 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:object:root=true | ||
| // +kubebuilder:subresource:status | ||
| // +kubebuilder:resource:path=http01proxies,scope=Namespaced,categories={cert-manager-operator},shortName=http01proxy | ||
| // +kubebuilder:printcolumn:name="Mode",type="string",JSONPath=".spec.mode" | ||
| // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" | ||
| // +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message" | ||
| // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" | ||
| // +kubebuilder:metadata:labels={"app.kubernetes.io/name=http01proxy", "app.kubernetes.io/part-of=cert-manager-operator"} | ||
|
|
||
| // HTTP01Proxy describes the configuration for the HTTP01 challenge proxy | ||
| // that redirects traffic from the API endpoint on port 80 to ingress routers. | ||
| // This enables cert-manager to perform HTTP01 ACME challenges for API endpoint certificates. | ||
| // The name must be `default` to make HTTP01Proxy a singleton. | ||
| // | ||
| // When an HTTP01Proxy is created, the proxy DaemonSet is deployed on control plane nodes. | ||
| // | ||
| // +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"` | ||
|
|
||
| // status is the most recently observed status of the HTTP01Proxy. | ||
| // +kubebuilder:validation:Optional | ||
| // +optional | ||
| Status HTTP01ProxyStatus `json:"status,omitempty"` | ||
| } | ||
|
|
||
| // HTTP01ProxyMode controls how the HTTP01 challenge proxy is deployed. | ||
| // +kubebuilder:validation:Enum=DefaultDeployment;CustomDeployment | ||
| type HTTP01ProxyMode string | ||
|
|
||
| const ( | ||
| // HTTP01ProxyModeDefault enables the proxy with default configuration. | ||
| HTTP01ProxyModeDefault HTTP01ProxyMode = "DefaultDeployment" | ||
|
|
||
| // HTTP01ProxyModeCustom enables the proxy with user-specified configuration. | ||
| HTTP01ProxyModeCustom HTTP01ProxyMode = "CustomDeployment" | ||
| ) | ||
|
|
||
| // HTTP01ProxySpec is the specification of the desired behavior of the HTTP01Proxy. | ||
| // +kubebuilder:validation:XValidation:rule="self.mode == 'CustomDeployment' ? has(self.customDeployment) : !has(self.customDeployment)",message="customDeployment is required when mode is CustomDeployment and forbidden otherwise" | ||
| type HTTP01ProxySpec struct { | ||
| // mode controls whether the HTTP01 challenge proxy is active and how it should be deployed. | ||
| // DefaultDeployment enables the proxy with default configuration. | ||
| // CustomDeployment enables the proxy with user-specified configuration. | ||
| // +kubebuilder:validation:Required | ||
| // +required | ||
| Mode HTTP01ProxyMode `json:"mode"` | ||
|
|
||
| // customDeployment contains configuration options when mode is CustomDeployment. | ||
| // This field is only valid when mode is CustomDeployment. | ||
| // +kubebuilder:validation:Optional | ||
| // +optional | ||
| CustomDeployment *HTTP01ProxyCustomDeploymentSpec `json:"customDeployment,omitempty"` | ||
| } | ||
|
|
||
| // HTTP01ProxyCustomDeploymentSpec contains configuration for custom proxy deployment. | ||
| type HTTP01ProxyCustomDeploymentSpec struct { | ||
| // internalPort specifies the internal port used by the proxy service. | ||
| // Valid values are 1024-65535. | ||
| // +kubebuilder:validation:Minimum=1024 | ||
| // +kubebuilder:validation:Maximum=65535 | ||
| // +kubebuilder:default=8888 | ||
| // +optional | ||
| InternalPort int32 `json:"internalPort,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 deployment. | ||
| ConditionalStatus `json:",inline,omitempty"` | ||
|
|
||
| // proxyImage is the name of the image and the tag used for deploying the proxy. | ||
| ProxyImage string `json:"proxyImage,omitempty"` | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
bindata/http01-proxy/cert-manager-http01-proxy-clusterrole.yaml
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,19 @@ | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: cert-manager-http01-proxy | ||
| labels: | ||
| app: cert-manager-http01-proxy | ||
| app.kubernetes.io/name: cert-manager-http01-proxy | ||
| app.kubernetes.io/part-of: cert-manager-operator | ||
| rules: | ||
| - apiGroups: | ||
| - config.openshift.io | ||
| resources: | ||
| - clusterversions | ||
| - infrastructures | ||
| - ingresses | ||
| verbs: | ||
| - get | ||
| - list | ||
| - watch |
16 changes: 16 additions & 0 deletions
16
bindata/http01-proxy/cert-manager-http01-proxy-clusterrolebinding.yaml
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,16 @@ | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: cert-manager-http01-proxy | ||
| labels: | ||
| app: cert-manager-http01-proxy | ||
| app.kubernetes.io/name: cert-manager-http01-proxy | ||
| app.kubernetes.io/part-of: cert-manager-operator | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: cert-manager-http01-proxy | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: cert-manager-http01-proxy | ||
| namespace: cert-manager-operator |
60 changes: 60 additions & 0 deletions
60
bindata/http01-proxy/cert-manager-http01-proxy-daemonset.yaml
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,60 @@ | ||
| apiVersion: apps/v1 | ||
| kind: DaemonSet | ||
| metadata: | ||
| name: cert-manager-http01-proxy | ||
| namespace: cert-manager-operator | ||
| labels: | ||
| app: cert-manager-http01-proxy | ||
| app.kubernetes.io/name: cert-manager-http01-proxy | ||
| app.kubernetes.io/part-of: cert-manager-operator | ||
| spec: | ||
| selector: | ||
| matchLabels: | ||
| app: cert-manager-http01-proxy | ||
| updateStrategy: | ||
| type: RollingUpdate | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: cert-manager-http01-proxy | ||
| app.kubernetes.io/name: cert-manager-http01-proxy | ||
| app.kubernetes.io/part-of: cert-manager-operator | ||
| spec: | ||
| serviceAccountName: cert-manager-http01-proxy | ||
| hostNetwork: true | ||
|
sebrandon1 marked this conversation as resolved.
|
||
| nodeSelector: | ||
| node-role.kubernetes.io/master: "" | ||
| tolerations: | ||
| - key: node-role.kubernetes.io/master | ||
| operator: Exists | ||
| effect: NoSchedule | ||
| - key: node-role.kubernetes.io/control-plane | ||
| operator: Exists | ||
| effect: NoSchedule | ||
| containers: | ||
| - name: http01-proxy | ||
| image: ${RELATED_IMAGE_CERT_MANAGER_HTTP01PROXY} | ||
| ports: | ||
| - name: proxy | ||
| containerPort: 8888 | ||
| hostPort: 8888 | ||
| protocol: TCP | ||
| env: | ||
| - name: PROXY_PORT | ||
| value: "8888" | ||
| securityContext: | ||
| allowPrivilegeEscalation: false | ||
| capabilities: | ||
| add: | ||
| - NET_ADMIN | ||
| drop: | ||
| - ALL | ||
| runAsNonRoot: false | ||
| resources: | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| requests: | ||
| cpu: 10m | ||
| memory: 32Mi | ||
| limits: | ||
| cpu: 100m | ||
| memory: 64Mi | ||
| priorityClassName: system-cluster-critical | ||
16 changes: 16 additions & 0 deletions
16
bindata/http01-proxy/cert-manager-http01-proxy-scc-rolebinding.yaml
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,16 @@ | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: cert-manager-http01-proxy-scc | ||
| labels: | ||
| app: cert-manager-http01-proxy | ||
| app.kubernetes.io/name: cert-manager-http01-proxy | ||
| app.kubernetes.io/part-of: cert-manager-operator | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: system:openshift:scc:privileged | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: cert-manager-http01-proxy | ||
| namespace: cert-manager-operator |
9 changes: 9 additions & 0 deletions
9
bindata/http01-proxy/cert-manager-http01-proxy-serviceaccount.yaml
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,9 @@ | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: cert-manager-http01-proxy | ||
| namespace: cert-manager-operator | ||
| labels: | ||
| app: cert-manager-http01-proxy | ||
| app.kubernetes.io/name: cert-manager-http01-proxy | ||
| app.kubernetes.io/part-of: cert-manager-operator |
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.
Uh oh!
There was an error while loading. Please reload this page.