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

Pgadmin remove service #3755

Merged
merged 2 commits into from
Oct 19, 2023
Merged
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
31 changes: 0 additions & 31 deletions config/crd/bases/postgres-operator.crunchydata.com_pgadmins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1398,37 +1398,6 @@ spec:
- postgresClusterSelector
type: object
type: array
service:
description: Specification of the service that exposes pgAdmin.
properties:
metadata:
description: Metadata contains metadata for custom resources
properties:
annotations:
additionalProperties:
type: string
type: object
labels:
additionalProperties:
type: string
type: object
type: object
nodePort:
description: The port on which this service is exposed when type
is NodePort or LoadBalancer. Value must be in-range and not
in use or the operation will fail. If unspecified, a port will
be allocated if this Service requires one. - https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
format: int32
type: integer
type:
default: ClusterIP
description: 'More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types'
enum:
- ClusterIP
- NodePort
- LoadBalancer
type: string
type: object
tolerations:
description: 'Tolerations of the PGAdmin pod. More info: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration'
items:
Expand Down
74 changes: 0 additions & 74 deletions docs/content/references/crd.md

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

3 changes: 0 additions & 3 deletions internal/controller/standalone_pgadmin/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,6 @@ func (r *PGAdminReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
if err == nil {
clusters, err = r.getClustersForPGAdmin(ctx, pgAdmin)
}
if err == nil {
_, err = r.reconcilePGAdminService(ctx, pgAdmin)
}
if err == nil {
configmap, err = r.reconcilePGAdminConfigMap(ctx, pgAdmin, clusters)
}
Expand Down
126 changes: 0 additions & 126 deletions internal/controller/standalone_pgadmin/service.go

This file was deleted.

5 changes: 0 additions & 5 deletions internal/controller/standalone_pgadmin/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ func statefulset(
// Don't clutter the namespace with extra ControllerRevisions.
sts.Spec.RevisionHistoryLimit = initialize.Int32(0)

// Give the Pod a stable DNS record based on its name.
// - https://docs.k8s.io/concepts/workloads/controllers/statefulset/#stable-network-id
// - https://docs.k8s.io/concepts/services-networking/dns-pod-service/#pods
sts.Spec.ServiceName = naming.StandalonePGAdminService(pgadmin).Name

// Set the StatefulSet update strategy to "RollingUpdate", and the Partition size for the
// update strategy to 0 (note that these are the defaults for a StatefulSet). This means
// every pod of the StatefulSet will be deleted and recreated when the Pod template changes.
Expand Down
13 changes: 0 additions & 13 deletions internal/naming/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,19 +587,6 @@ func StandalonePGAdmin(pgadmin *v1beta1.PGAdmin) metav1.ObjectMeta {
}
}

// StandalonePGAdminService returns the ObjectMeta necessary to lookup the Service
// that is responsible for the network identity of Pods.
func StandalonePGAdminService(pgadmin *v1beta1.PGAdmin) metav1.ObjectMeta {
// The hyphen below ensures that the DNS name will not be interpreted as a
// top-level domain. Partially qualified requests for "{pod}.{cluster}-pods"
// should not leave the Kubernetes cluster, and if they do they are less
// likely to resolve.
return metav1.ObjectMeta{
Namespace: pgadmin.Namespace,
Name: pgadmin.Name + "-standalone-pods",
}
}

// UpgradeCheckConfigMap returns the ObjectMeta for the PGO ConfigMap
func UpgradeCheckConfigMap() metav1.ObjectMeta {
return metav1.ObjectMeta{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ type PGAdminSpec struct {
// +optional
PriorityClassName *string `json:"priorityClassName,omitempty"`

// Specification of the service that exposes pgAdmin.
// +optional
Service *ServiceSpec `json:"service,omitempty"`

// Tolerations of the PGAdmin pod.
// More info: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration
// +optional
Expand Down

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

2 changes: 1 addition & 1 deletion testing/kuttl/e2e-other/standalone-pgadmin/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ commands:
- script: |
contains() { bash -ceu '[[ "$1" == *"$2"* ]]' - "$@"; }

clusters_actual=$(kubectl exec -n "${NAMESPACE}" pgadmin-standalone-pgadmin-0 -- bash -c 'python3 /usr/local/lib/python3.11/site-packages/pgadmin4/setup.py --dump-servers /tmp/dumped.json --user admin@pgo.com && cat /tmp/dumped.json')
clusters_actual=$(kubectl exec -n "${NAMESPACE}" pgadmin-standalone-pgadmin-0 -- bash -c "python3 /usr/local/lib/python3.11/site-packages/pgadmin4/setup.py --dump-servers /tmp/dumped.json --user admin@pgadmin.${NAMESPACE}.svc && cat /tmp/dumped.json")

clusters_expected="\"Servers\": {}"
{
Expand Down
2 changes: 1 addition & 1 deletion testing/kuttl/e2e-other/standalone-pgadmin/03-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ commands:
exit 1
}

clusters_actual=$(kubectl exec -n "${NAMESPACE}" pgadmin-standalone-pgadmin-0 -- bash -c 'python3 /usr/local/lib/python3.11/site-packages/pgadmin4/setup.py --dump-servers /tmp/dumped.json --user admin@pgo.com && cat /tmp/dumped.json')
clusters_actual=$(kubectl exec -n "${NAMESPACE}" pgadmin-standalone-pgadmin-0 -- bash -c "python3 /usr/local/lib/python3.11/site-packages/pgadmin4/setup.py --dump-servers /tmp/dumped.json --user admin@pgadmin.${NAMESPACE}.svc && cat /tmp/dumped.json")

clusters_expected='
{
Expand Down
2 changes: 1 addition & 1 deletion testing/kuttl/e2e-other/standalone-pgadmin/05-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ commands:
exit 1
}

clusters_actual=$(kubectl exec -n "${NAMESPACE}" pgadmin-standalone-pgadmin-0 -- bash -c 'python3 /usr/local/lib/python3.11/site-packages/pgadmin4/setup.py --dump-servers /tmp/dumped.json --user admin@pgo.com && cat /tmp/dumped.json')
clusters_actual=$(kubectl exec -n "${NAMESPACE}" pgadmin-standalone-pgadmin-0 -- bash -c "python3 /usr/local/lib/python3.11/site-packages/pgadmin4/setup.py --dump-servers /tmp/dumped.json --user admin@pgadmin.${NAMESPACE}.svc && cat /tmp/dumped.json")

clusters_expected='
{
Expand Down
2 changes: 1 addition & 1 deletion testing/kuttl/e2e-other/standalone-pgadmin/07-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ commands:
exit 1
}

clusters_actual=$(kubectl exec -n "${NAMESPACE}" pgadmin-standalone-pgadmin-0 -- bash -c 'python3 /usr/local/lib/python3.11/site-packages/pgadmin4/setup.py --dump-servers /tmp/dumped.json --user admin@pgo.com && cat /tmp/dumped.json')
clusters_actual=$(kubectl exec -n "${NAMESPACE}" pgadmin-standalone-pgadmin-0 -- bash -c "python3 /usr/local/lib/python3.11/site-packages/pgadmin4/setup.py --dump-servers /tmp/dumped.json --user admin@pgadmin.${NAMESPACE}.svc && cat /tmp/dumped.json")

clusters_expected='
{
Expand Down
2 changes: 1 addition & 1 deletion testing/kuttl/e2e-other/standalone-pgadmin/09-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ commands:
exit 1
}

clusters_actual=$(kubectl exec -n "${NAMESPACE}" pgadmin-standalone-pgadmin-0 -- bash -c 'python3 /usr/local/lib/python3.11/site-packages/pgadmin4/setup.py --dump-servers /tmp/dumped.json --user admin@pgo.com && cat /tmp/dumped.json')
clusters_actual=$(kubectl exec -n "${NAMESPACE}" pgadmin-standalone-pgadmin-0 -- bash -c "python3 /usr/local/lib/python3.11/site-packages/pgadmin4/setup.py --dump-servers /tmp/dumped.json --user admin@pgadmin.${NAMESPACE}.svc && cat /tmp/dumped.json")

clusters_expected='
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,4 @@
apiVersion: v1
kind: Service
metadata:
labels:
postgres-operator.crunchydata.com/role: pgadmin
postgres-operator.crunchydata.com/standalone-pgadmin: pgadmin
name: pgadmin-standalone-pods
spec:
ports:
- name: pgadmin
port: 5050
protocol: TCP
targetPort: pgadmin
selector:
postgres-operator.crunchydata.com/role: standalone-pgadmin
postgres-operator.crunchydata.com/standalone-pgadmin: pgadmin
type: ClusterIP
status:
loadBalancer: {}
---
apiVersion: v1
kind: ConfigMap
metadata:
labels:
Expand Down