Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*.out

/cert-manager-operator
/http01-proxy

# Log output from telepresence
telepresence.log
Expand Down
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ endif
CERT_MANAGER_VERSION ?= v1.20.3
ISTIO_CSR_VERSION ?= v0.16.0
TRUST_MANAGER_VERSION ?= v0.20.3
HTTP01PROXY_VERSION ?= v0.1.0
Comment thread
sebrandon1 marked this conversation as resolved.

# --- Test Versions ---

Expand Down Expand Up @@ -329,10 +330,12 @@ local-run: build ## Run the operator locally against the cluster configured in ~
RELATED_IMAGE_CERT_MANAGER_ACMESOLVER=quay.io/jetstack/cert-manager-acmesolver:$(CERT_MANAGER_VERSION) \
RELATED_IMAGE_CERT_MANAGER_ISTIOCSR=quay.io/jetstack/cert-manager-istio-csr:$(ISTIO_CSR_VERSION) \
RELATED_IMAGE_CERT_MANAGER_TRUST_MANAGER=quay.io/jetstack/trust-manager:$(TRUST_MANAGER_VERSION) \
RELATED_IMAGE_CERT_MANAGER_HTTP01PROXY=quay.io/openshift/cert-manager-http01-proxy:$(HTTP01PROXY_VERSION) \
OPERATOR_NAME=cert-manager-operator \
OPERAND_IMAGE_VERSION=$(BUNDLE_VERSION) \
ISTIOCSR_OPERAND_IMAGE_VERSION=$(ISTIO_CSR_VERSION) \
TRUSTMANAGER_OPERAND_IMAGE_VERSION=$(TRUST_MANAGER_VERSION) \
HTTP01PROXY_OPERAND_IMAGE_VERSION=$(HTTP01PROXY_VERSION) \
OPERATOR_IMAGE_VERSION=$(BUNDLE_VERSION) \
./cert-manager-operator start \
--config=./hack/local-run-config.yaml \
Expand All @@ -352,6 +355,10 @@ build: generate fmt vet build-operator ## Build operator binary with all checks
build-operator: ## Build operator binary only (no checks or code generation).
@GOFLAGS="-mod=vendor" source hack/go-fips.sh && $(GO) build $(GOBUILD_VERSION_ARGS) -o $(BIN)

.PHONY: build-http01-proxy
build-http01-proxy: ## Build HTTP01 proxy binary.
@GOFLAGS="-mod=vendor" source hack/go-fips.sh && $(GO) build $(GOBUILD_VERSION_ARGS) -o $(PROJECT_ROOT)/http01-proxy ./cmd/http01-proxy

.PHONY: run
run: manifests generate fmt vet ## Run the operator from your host (for development).
go run $(PACKAGE)
Expand All @@ -364,6 +371,10 @@ image-build: ## Build container image with the operator.
image-push: ## Push container image with the operator.
$(CONTAINER_ENGINE) push $(IMG) $(CONTAINER_PUSH_ARGS)

.PHONY: image-build-http01-proxy
image-build-http01-proxy: ## Build HTTP01 proxy container image.
$(CONTAINER_ENGINE) build -t cert-manager-http01-proxy:$(HTTP01PROXY_VERSION) -f images/ci/http01proxy.Dockerfile .

# ============================================================================
# Deployment
# ============================================================================
Expand Down
10 changes: 10 additions & 0 deletions api/operator/v1alpha1/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,19 @@ var (
// For more details,
// https://github.com/openshift/enhancements/blob/master/enhancements/cert-manager/trust-manager-controller.md
FeatureTrustManager featuregate.Feature = "TrustManager"

// HTTP01Proxy enables the controller for http01proxies.operator.openshift.io resource,
// which extends cert-manager-operator to deploy and manage the HTTP01 challenge proxy.
// The proxy enables cert-manager to complete HTTP01 ACME challenges for the API endpoint
// on baremetal platforms where the API VIP is not exposed via OpenShift Ingress.
//
// For more details,
// https://github.com/openshift/enhancements/pull/1929
FeatureHTTP01Proxy featuregate.Feature = "HTTP01Proxy"
)

var OperatorFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
FeatureIstioCSR: {Default: true, PreRelease: featuregate.GA},
FeatureTrustManager: {Default: false, PreRelease: "TechPreview"},
FeatureHTTP01Proxy: {Default: false, PreRelease: featuregate.Alpha},
}
109 changes: 109 additions & 0 deletions api/operator/v1alpha1/http01proxy_types.go
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'"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
// +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"`
}
110 changes: 110 additions & 0 deletions api/operator/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions bundle/manifests/cert-manager-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@ spec:
kind: ClusterIssuer
name: clusterissuers.cert-manager.io
version: v1
- kind: HTTP01Proxy
name: http01proxies.operator.openshift.io
version: v1alpha1
- description: |-
An Issuer represents a certificate issuing authority which can be
referenced as part of `issuerRef` fields.
Expand Down Expand Up @@ -616,6 +619,18 @@ spec:
- patch
- update
- watch
- apiGroups:
- machineconfiguration.openshift.io
resources:
- machineconfigs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- networking.k8s.io
resources:
Expand Down Expand Up @@ -646,6 +661,7 @@ spec:
- operator.openshift.io
resources:
- certmanagers/finalizers
- http01proxies/finalizers
- istiocsrs/finalizers
- trustmanagers/finalizers
verbs:
Expand All @@ -654,6 +670,7 @@ spec:
- operator.openshift.io
resources:
- certmanagers/status
- http01proxies/status
- istiocsrs/status
- trustmanagers/status
verbs:
Expand All @@ -663,6 +680,7 @@ spec:
- apiGroups:
- operator.openshift.io
resources:
- http01proxies
- istiocsrs
- trustmanagers
verbs:
Expand Down Expand Up @@ -802,12 +820,16 @@ spec:
value: quay.io/jetstack/cert-manager-istio-csr:v0.16.0
- name: RELATED_IMAGE_CERT_MANAGER_TRUST_MANAGER
value: quay.io/jetstack/trust-manager:v0.20.3
- name: RELATED_IMAGE_CERT_MANAGER_HTTP01PROXY
value: quay.io/openshift/cert-manager-http01-proxy:v0.1.0
- name: OPERAND_IMAGE_VERSION
value: 1.20.3
- name: ISTIOCSR_OPERAND_IMAGE_VERSION
value: 0.16.0
- name: TRUSTMANAGER_OPERAND_IMAGE_VERSION
value: 0.20.3
- name: HTTP01PROXY_OPERAND_IMAGE_VERSION
value: 0.1.0
- name: OPERATOR_IMAGE_VERSION
value: 1.20.0
- name: OPERATOR_LOG_LEVEL
Expand Down Expand Up @@ -924,5 +946,7 @@ spec:
name: cert-manager-istiocsr
- image: quay.io/jetstack/trust-manager:v0.20.3
name: cert-manager-trust-manager
- image: quay.io/openshift/cert-manager-http01-proxy:v0.1.0
name: cert-manager-http01proxy
replaces: cert-manager-operator.v1.19.0
version: 1.20.0
Loading