Skip to content
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

.*: TLS and Etcd v3 support #195

Closed
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
20 changes: 20 additions & 0 deletions api/v1alpha1/etcdcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ type EtcdClusterSpec struct {
// rejected.
// +optional
PodTemplate *EtcdPodTemplateSpec `json:"podTemplate,omitempty"`

// TLS configuration
TLS *TLS `json:"tls,omitempty"`
}

// EtcdPodTemplateSpec supports a subset of a normal `v1/PodTemplateSpec` that the operator explicitly permits. We don't
Expand All @@ -44,6 +47,10 @@ type EtcdPodTemplateSpec struct {
// Affinity is the affinity scheduling rules to be applied to the underlying pods.
// +optional
Affinity *corev1.Affinity `json:"affinity,omitempty"`

// Tolerations is the allowed taints that the deployment tolerates on nodes.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
}

// EtcdPodTemplateObjectMeta supports a subset of the features of a normal ObjectMeta. In particular the ones we allow.
Expand All @@ -64,6 +71,15 @@ type EtcdMember struct {
ID string `json:"id"`
}

// TLS configuration for a secure cluster
type TLS struct {

// Enabled allows to setup a secure cluster
// +optional
Enabled bool `json:"enabled,omitempty"`
}


// EtcdClusterStatus defines the observed state of EtcdCluster
type EtcdClusterStatus struct {
// Replicas is the number of etcd peer resources we are managing. This doesn't mean the number of pods that exist
Expand All @@ -80,6 +96,10 @@ type EtcdClusterStatus struct {
// ClusterVersion contains the cluster API version
// +optional
ClusterVersion string `json:"clusterVersion"`

// TLS configuration
// +optional
TLSEnabled bool `json:"tlsEnabled"`
}

// +kubebuilder:object:root=true
Expand Down
7 changes: 7 additions & 0 deletions api/v1alpha1/etcdpeer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ type EtcdPeerSpec struct {
// names starting with `etcd.improbable.io`, and pod templates containing these are considered invalid and will be
// rejected.
PodTemplate *EtcdPodTemplateSpec `json:"podTemplate,omitempty"`

// TLS configuration
TLS *TLS `json:"tls,omitempty"`
}

// EtcdPeerStorage defines the desired storage for an EtcdPeer
Expand All @@ -92,6 +95,10 @@ type EtcdPeerStorage struct {
type EtcdPeerStatus struct {
// ServerVersion contains the Member server version
ServerVersion string `json:"serverVersion"`

// TLS configuration
// +optional
TLSEnabled bool `json:"tlsEnabled"`
}

// +kubebuilder:object:root=true
Expand Down
32 changes: 32 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

51 changes: 51 additions & 0 deletions config/crd/bases/etcd.improbable.io_etcdclusters.yaml

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

51 changes: 51 additions & 0 deletions config/crd/bases/etcd.improbable.io_etcdpeers.yaml

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

51 changes: 51 additions & 0 deletions config/crd/bases/etcd.improbable.io_etcdrestores.yaml

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

8 changes: 8 additions & 0 deletions config/rbac/role.yaml

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

35 changes: 35 additions & 0 deletions config/samples/etcd_v1alpha1_etcdcluster_tls_v3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: etcd.improbable.io/v1alpha1
kind: EtcdCluster
metadata:
name: my-cluster
spec:
replicas: 3
version: 3.3.25
tls:
enabled: true
storage:
volumeClaimTemplate:
storageClassName: standard
resources:
requests:
storage: 1Mi
podTemplate:
resources:
requests:
cpu: 200m
memory: 200Mi
limits:
cpu: 200m
memory: 200Mi
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: etcd.improbable.io/cluster-name
operator: In
values:
- my-cluster
topologyKey: kubernetes.io/hostname
Loading