-
Notifications
You must be signed in to change notification settings - Fork 0
etcdmanager / Etcd Deployment #436
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
Merged
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
36b0582
Initial commit of etcdmanager
eberlep 1bffa2c
Fix linter error
eberlep d7e9844
Small fix
eberlep 282245d
Dynamic configuration
eberlep 3ea11f7
Fix linter error (by ignoring it)
eberlep a8242a1
improve logging
eberlep 5332f63
Add missing label to selector
eberlep 105dbd5
Change default value
eberlep 5414da6
Try sth different
eberlep d8752ef
Remove dummy values
eberlep bea905a
Fix retrieval of sts after renaming it
eberlep 2a0b06f
Add SA and Role for etcd
eberlep 2c90cc3
Use updated Name for fetching
eberlep 210378a
Refactoring
eberlep 4b0d302
Add managedBy label
eberlep f9d8642
Update etcd name to postgreslet name
eberlep 5147b5f
Add common labels to all created resources
eberlep 095810e
Update svc names + selectors
eberlep 0536b44
Initialize nil maps
eberlep 5ec3c32
Fetch correctly named service
eberlep a86558c
Update client und peer urls
eberlep bc652da
Use index to access env value
eberlep 2221b5e
Fall back to postgreslet PSP if etcd PSP is empty
eberlep 561b36c
Update serviceAccountName as well
eberlep 8e447fc
Use postgres partition id as bucket name
eberlep 61d24f0
Proper etcd cluster init
eberlep ed84d17
Revert "Use postgres partition id as bucket name"
eberlep 4fb9c88
Use PartitionID as object prefix
eberlep 947bd38
Indentation
eberlep d54068d
Indentation
eberlep 42a28da
Indentation
eberlep 5710fe2
Use strings.Builder
eberlep 3bad452
...
eberlep f79482f
Add optional removal of etcd
eberlep b9ae49e
For safety, add additional label
eberlep c191d4a
Rename label value
eberlep 60ac9c2
Add new label to pods as well
eberlep 94ef0e4
Cleanup labels
eberlep d6916ae
Remove unneccessary api permissions
eberlep 585c4f0
Add servicemonitors
eberlep 0a046a4
Update selector
eberlep 4488791
rename flag
eberlep e74dba0
Change order of deletion
eberlep 50ca741
Resolve review comments
eberlep bfc6e6b
Change default value
eberlep 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,325 @@ | ||
|
||
|
||
apiVersion: v1 | ||
kind: List | ||
metadata: {} | ||
items: | ||
- kind: ServiceAccount | ||
apiVersion: v1 | ||
metadata: | ||
labels: | ||
postgres.database.fits.cloud/partition-id: sample | ||
postgres.database.fits.cloud/managed-by: postgreslet | ||
postgres.database.fits.cloud/component: etcd | ||
name: patroni-etcd | ||
namespace: postgreslet-system | ||
- kind: Role | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
labels: | ||
postgres.database.fits.cloud/partition-id: sample | ||
postgres.database.fits.cloud/managed-by: postgreslet | ||
postgres.database.fits.cloud/component: etcd | ||
name: patroni-etcd | ||
namespace: postgreslet-system | ||
rules: | ||
- apiGroups: | ||
- extensions | ||
resourceNames: | ||
- postgreslet | ||
resources: | ||
- podsecuritypolicies | ||
verbs: | ||
- use | ||
- kind: RoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
labels: | ||
postgres.database.fits.cloud/partition-id: sample | ||
postgres.database.fits.cloud/managed-by: postgreslet | ||
postgres.database.fits.cloud/component: etcd | ||
name: patroni-etcd | ||
namespace: postgreslet-system | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: patroni-etcd | ||
subjects: | ||
- kind: ServiceAccount | ||
name: patroni-etcd | ||
namespace: postgreslet-system | ||
- kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
labels: | ||
postgres.database.fits.cloud/partition-id: sample | ||
postgres.database.fits.cloud/managed-by: postgreslet | ||
postgres.database.fits.cloud/component: etcd | ||
name: backup-restore-sidecar-config-etcd | ||
namespace: postgreslet-system | ||
data: | ||
config.yaml: | | ||
# SAMPLE VALUES, WILL BE OVERWRITTEN | ||
db: etcd | ||
db-data-directory: /data/etcd/ | ||
backup-provider: s3 | ||
backup-cron-schedule: "*/1 * * * *" | ||
object-prefix: etcd-psql | ||
compression-method: tarlz4 | ||
- kind: StatefulSet | ||
apiVersion: apps/v1 | ||
metadata: | ||
labels: | ||
postgres.database.fits.cloud/partition-id: sample | ||
postgres.database.fits.cloud/managed-by: postgreslet | ||
postgres.database.fits.cloud/component: etcd | ||
name: etcd-psql | ||
namespace: postgreslet-system | ||
spec: | ||
podManagementPolicy: OrderedReady | ||
replicas: 1 | ||
revisionHistoryLimit: 10 | ||
selector: | ||
matchLabels: | ||
postgres.database.fits.cloud/partition-id: sample | ||
postgres.database.fits.cloud/managed-by: postgreslet | ||
postgres.database.fits.cloud/component: etcd | ||
postgres.database.fits.cloud/name: etcd-psql | ||
serviceName: etcd-psql-client | ||
template: | ||
metadata: | ||
labels: | ||
postgres.database.fits.cloud/partition-id: sample | ||
postgres.database.fits.cloud/managed-by: postgreslet | ||
postgres.database.fits.cloud/component: etcd | ||
postgres.database.fits.cloud/name: etcd-psql | ||
spec: | ||
serviceAccountName: patroni-etcd | ||
containers: | ||
- image: quay.io/coreos/etcd:v3.5.4 | ||
# can also be gcr.io/etcd-development/etcd | ||
env: | ||
- name: ETCD_ENABLE_V2 | ||
value: "true" | ||
- name: ETCD_ADVERTISE_CLIENT_URLS | ||
value: http://etcd-psql-headless.ft-etcd-psql.svc.cluster.local:2379,http://etcd-psql.ft-etcd-psql.svc.cluster.local:2379 | ||
- name: ETCD_LISTEN_CLIENT_URLS | ||
value: http://0.0.0.0:2379 | ||
- name: ETCD_INITIAL_ADVERTISE_PEER_URLS | ||
value: http://etcd-psql-headless.ft-etcd-psql.svc.cluster.local:2380 | ||
- name: ETCD_LISTEN_PEER_URLS | ||
value: http://0.0.0.0:2380 | ||
- name: ETCD_INITIAL_CLUSTER | ||
value: default=http://etcd-psql-headless.ft-etcd-psql.svc.cluster.local:2380 | ||
name: etcd | ||
command: | ||
- tini | ||
- -- | ||
args: | ||
- sh | ||
- -c | ||
- backup-restore-sidecar wait && etcd --data-dir=/data/etcd --listen-metrics-urls http://0.0.0.0:2381 | ||
imagePullPolicy: IfNotPresent | ||
livenessProbe: | ||
exec: | ||
command: | ||
- /usr/local/bin/etcdctl | ||
- endpoint | ||
- health | ||
failureThreshold: 3 | ||
initialDelaySeconds: 15 | ||
periodSeconds: 5 | ||
successThreshold: 1 | ||
timeoutSeconds: 1 | ||
readinessProbe: | ||
failureThreshold: 3 | ||
httpGet: | ||
path: /health | ||
port: 2381 | ||
scheme: HTTP | ||
initialDelaySeconds: 15 | ||
periodSeconds: 5 | ||
successThreshold: 1 | ||
timeoutSeconds: 1 | ||
ports: | ||
- containerPort: 2380 | ||
name: server | ||
protocol: TCP | ||
- containerPort: 2379 | ||
name: client | ||
protocol: TCP | ||
resources: | ||
limits: | ||
cpu: 900m | ||
memory: 3G | ||
requests: | ||
cpu: 300m | ||
memory: 1G | ||
terminationMessagePath: /dev/termination-log | ||
terminationMessagePolicy: File | ||
volumeMounts: | ||
- mountPath: /data | ||
name: etcd | ||
- name: bin-provision | ||
subPath: backup-restore-sidecar | ||
mountPath: /usr/local/bin/backup-restore-sidecar | ||
- name: backup-restore-sidecar-config | ||
mountPath: /etc/backup-restore-sidecar | ||
- name: bin-provision | ||
subPath: tini | ||
mountPath: /usr/local/bin/tini | ||
- image: quay.io/coreos/etcd:v3.5.4 | ||
eberlep marked this conversation as resolved.
Show resolved
Hide resolved
|
||
name: backup-restore-sidecar | ||
env: | ||
- name: BACKUP_RESTORE_SIDECAR_S3_BUCKET_NAME | ||
valueFrom: | ||
secretKeyRef: | ||
key: bucketName | ||
name: etcd-backup-restore-s3-config | ||
- name: BACKUP_RESTORE_SIDECAR_S3_ENDPOINT | ||
valueFrom: | ||
secretKeyRef: | ||
key: endpoint | ||
name: etcd-backup-restore-s3-config | ||
- name: BACKUP_RESTORE_SIDECAR_S3_REGION | ||
valueFrom: | ||
secretKeyRef: | ||
key: region | ||
name: etcd-backup-restore-s3-config | ||
- name: BACKUP_RESTORE_SIDECAR_S3_ACCESS_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
key: access-key | ||
name: etcd-backup-restore-s3-config | ||
- name: BACKUP_RESTORE_SIDECAR_S3_SECRET_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
key: secret-key | ||
name: etcd-backup-restore-s3-config | ||
command: | ||
- tini | ||
- -- | ||
args: | ||
- sh | ||
- -c | ||
- mkdir -p /data/etcd && backup-restore-sidecar start --log-level debug | ||
volumeMounts: | ||
- name: etcd | ||
mountPath: /data | ||
- name: bin-provision | ||
subPath: backup-restore-sidecar | ||
mountPath: /usr/local/bin/backup-restore-sidecar | ||
- name: backup-restore-sidecar-config | ||
mountPath: /etc/backup-restore-sidecar | ||
- name: bin-provision | ||
subPath: tini | ||
mountPath: /usr/local/bin/tini | ||
- name: bin-provision | ||
subPath: certs | ||
mountPath: /etc/ssl/certs | ||
initContainers: | ||
- name: backup-restore-sidecar-provider | ||
image: ghcr.io/metal-stack/backup-restore-sidecar:latest | ||
imagePullPolicy: IfNotPresent | ||
command: | ||
- cp | ||
- -r | ||
- /etc/ssl/certs | ||
- /backup-restore-sidecar | ||
- /ubuntu/tini | ||
- /bin-provision | ||
ports: | ||
- containerPort: 2112 | ||
volumeMounts: | ||
- name: bin-provision | ||
mountPath: /bin-provision | ||
volumes: | ||
- name: backup-restore-sidecar-config | ||
configMap: | ||
name: backup-restore-sidecar-config-etcd | ||
- name: bin-provision | ||
emptyDir: {} | ||
- emptyDir: | ||
sizeLimit: 1Gi | ||
name: etcd | ||
- kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
labels: | ||
postgres.database.fits.cloud/partition-id: sample | ||
postgres.database.fits.cloud/managed-by: postgreslet | ||
postgres.database.fits.cloud/component: etcd | ||
postgres.database.fits.cloud/name: backup-restore-sidecar-svc | ||
name: backup-restore-sidecar-svc | ||
namespace: postgreslet-system | ||
spec: | ||
ports: | ||
- name: metrics | ||
port: 2112 | ||
protocol: TCP | ||
targetPort: 2112 | ||
selector: | ||
postgres.database.fits.cloud/partition-id: sample | ||
postgres.database.fits.cloud/managed-by: postgreslet | ||
postgres.database.fits.cloud/component: etcd | ||
postgres.database.fits.cloud/name: etcd-psql | ||
sessionAffinity: None | ||
type: ClusterIP | ||
- kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
labels: | ||
postgres.database.fits.cloud/partition-id: sample | ||
postgres.database.fits.cloud/managed-by: postgreslet | ||
postgres.database.fits.cloud/component: etcd | ||
postgres.database.fits.cloud/name: etcd-psql | ||
name: etcd-psql | ||
namespace: postgreslet-system | ||
spec: | ||
ports: | ||
- name: client | ||
port: 2379 | ||
protocol: TCP | ||
targetPort: client | ||
- name: server | ||
port: 2380 | ||
protocol: TCP | ||
targetPort: server | ||
selector: | ||
postgres.database.fits.cloud/partition-id: sample | ||
postgres.database.fits.cloud/managed-by: postgreslet | ||
postgres.database.fits.cloud/component: etcd | ||
postgres.database.fits.cloud/name: etcd-psql | ||
sessionAffinity: None | ||
type: ClusterIP | ||
- kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
labels: | ||
postgres.database.fits.cloud/partition-id: sample | ||
postgres.database.fits.cloud/managed-by: postgreslet | ||
postgres.database.fits.cloud/component: etcd | ||
postgres.database.fits.cloud/name: etcd-psql-headless | ||
name: etcd-psql-headless | ||
namespace: postgreslet-system | ||
spec: | ||
clusterIP: None | ||
clusterIPs: | ||
- None | ||
ports: | ||
- name: client | ||
port: 2379 | ||
protocol: TCP | ||
targetPort: client | ||
- name: server | ||
port: 2380 | ||
protocol: TCP | ||
targetPort: server | ||
publishNotReadyAddresses: true | ||
selector: | ||
postgres.database.fits.cloud/partition-id: sample | ||
postgres.database.fits.cloud/managed-by: postgreslet | ||
postgres.database.fits.cloud/component: etcd | ||
postgres.database.fits.cloud/name: etcd-psql | ||
sessionAffinity: None | ||
type: ClusterIP |
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.