dev4devs-com / postgresql-operator Goto Github PK
View Code? Open in Web Editor NEWOperator in Go developed using the Operator Framework to package, install, configure and manage a PostgreSQL database.
License: Apache License 2.0
Operator in Go developed using the Operator Framework to package, install, configure and manage a PostgreSQL database.
License: Apache License 2.0
The PVC is no longer creating the PV. So, we need to fix it. See that the postgresql is pending because is not possible to do the bound.
$ kubectl get events -n postgresql-operator
LAST SEEN TYPE REASON OBJECT MESSAGE
<unknown> Warning FailedScheduling pod/database-6896fdcbc-2dl4d persistentvolumeclaim "database" not found
<unknown> Warning FailedScheduling pod/database-6896fdcbc-2dl4d persistentvolumeclaim "database" not found
<unknown> Warning FailedScheduling pod/database-6896fdcbc-2dl4d running "VolumeBinding" filter plugin for pod "database-6896fdcbc-2dl4d": pod has unbound immediate PersistentVolumeClaims
<unknown> Warning FailedScheduling pod/database-6896fdcbc-g9dgj persistentvolumeclaim "database" not found
<unknown> Warning FailedScheduling pod/database-6896fdcbc-nlhc2 running "VolumeBinding" filter plugin for pod "database-6896fdcbc-nlhc2": pod has unbound immediate PersistentVolumeClaims
81s Normal SuccessfulCreate replicaset/database-6896fdcbc Created pod: database-6896fdcbc-2dl4d
81s Normal ScalingReplicaSet deployment/database Scaled up replica set database-6896fdcbc to 1
5s Normal ExternalProvisioning persistentvolumeclaim/database waiting for a volume to be created, either by external provisioner "k8s.io/minikube-hostpath" or manually created by system administrator
<unknown> Normal Scheduled pod/postgresql-operator-7cb8ccccd4-jrb5n Successfully assigned postgresql-operator/postgresql-operator-7cb8ccccd4-jrb5n to minikube
97s Normal Pulling pod/postgresql-operator-7cb8ccccd4-jrb5n Pulling image "quay.io/camilamacedo86/postgresql-operator:test"
90s Normal Pulled pod/postgresql-operator-7cb8ccccd4-jrb5n Successfully pulled image "quay.io/camilamacedo86/postgresql-operator:test"
90s Normal Created pod/postgresql-operator-7cb8ccccd4-jrb5n Created container postgresql-operator
89s Normal Started pod/postgresql-operator-7cb8ccccd4-jrb5n Started container postgresql-operator
98s Normal SuccessfulCreate replicaset/postgresql-operator-7cb8ccccd4 Created pod: postgresql-operator-7cb8ccccd4-jrb5n
98s Normal ScalingReplicaSet deployment/postgresql-operator Scaled up replica set postgresql-operator-7cb8ccccd4 to 1
$ kubectl get all -n postgresql-operator
NAME READY STATUS RESTARTS AGE
pod/database-6896fdcbc-2dl4d 0/1 Pending 0 78s
pod/postgresql-operator-7cb8ccccd4-jrb5n 1/1 Running 0 95s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/database ClusterIP 10.100.130.78 <none> 5432/TCP 78s
service/postgresql-operator-metrics ClusterIP 10.102.97.170 <none> 8383/TCP,8686/TCP 80s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/database 0/1 1 0 78s
deployment.apps/postgresql-operator 1/1 1 1 95s
NAME DESIRED CURRENT READY AGE
replicaset.apps/database-6896fdcbc 1 1 0 78s
replicaset.apps/postgresql-operator-7cb8ccccd4 1 1 1 95s
Remove dependency with integr8ly/backup-container-image. See here. This task is for us to improve the project for it do the backup and sent the data to AWS without the need to use this lib.
.
test
I got this error in my GKE & EKS deployments by running make install
, but it works well on my local minikube.
Through searching, I think this may be related to the securityContext setting.
Like this
securityContext:
runAsUser: 1000
fsGroup: 2000
So this is what you mean about To install you need be logged in as a user with cluster privileges like the system:admin user.
in README?
How can i add securityContext setting to Pod?
Tried to install the Operator on OCP 4.9 using steps mentioned in redhat-developer/odo#4961.
Operator to get installed and available for use
Copied from bugzilla
$ k logs catalog-operator-55f45c8665-zg6nn | grep apiextensions.k8s.io/v1beta1
E0825 15:50:44.863539 1 queueinformer_operator.go:290] sync {"update" "test/install-8qsnt"} failed: api-server resource not found installing CustomResourceDefinition backups.postgresql.dev4devs.com: GroupVersionKind apiextensions.k8s.io/v1beta1, Kind=CustomResourceDefinition not found on the cluster. This API may have been deprecated and removed, see https://kubernetes.io/docs/reference/using-api/deprecation-guide/ for more information.
E0825 15:50:45.312012 1 queueinformer_operator.go:290] sync {"update" "test/install-8qsnt"} failed: api-server resource not found installing CustomResourceDefinition backups.postgresql.dev4devs.com: GroupVersionKind apiextensions.k8s.io/v1beta1, Kind=CustomResourceDefinition not found on the cluster. This API may have been deprecated and removed, see https://kubernetes.io/docs/reference/using-api/deprecation-guide/ for more information.
E0825 15:50:46.116916 1 queueinformer_operator.go:290] sync {"update" "test/install-8qsnt"} failed: api-server resource not found installing CustomResourceDefinition backups.postgresql.dev4devs.com: GroupVersionKind apiextensions.k8s.io/v1beta1, Kind=CustomResourceDefinition not found on the cluster. This API may have been deprecated and removed, see https://kubernetes.io/docs/reference/using-api/deprecation-guide/ for more information.
...
* postgresql-operator version: 0.1.1 (Current)
(used the one from https://operatorhub.io/operator/postgresql-operator-dev4devs-com)
(Confused above with minikube)
Looking at redhat-openshift-ecosystem/community-operators-prod#138, it seems like the PostgreSQL Operator will no longer be installed on OCP 4.9 as it uses v1beta1
API. Are there plans to upgrade the Operator to use v1
API?
test.
.
Be easier to check the available make targets.
In order of this project be able to a full life cycle we would like to implement the Restore feature which would be able to get the backup of the database and restore it.
NOTE: A new CR/CRD and controller should be created to achieve this.
Upgrade the SDK version used to the latest one
.
.
.
Is SSL connection a configurable parameter when creating a postgres instance with this operator?
Deployed with default parameters, and I'm unable to connect with a client that requires SSL connections.
.
.
The OK status means just that the objects were created by it is not check if they are running.
In order to update the CR's with the OK status would be great to check the status of the required objects first.
Is the tag 0.1.1 branch still works for building iamge? and is the code works fun for postgresql function?
Build image with code in tag 0.1.1
[root@kvm4ocp5 postgresql-operator]# make image-build-master
make: *** No rule to make target 'image-build-master'. Stop.
[root@kvm4ocp5 postgresql-operator]# operator-sdk build postgresql-operator:0.1.1
[Deprecation Notice] Operator SDK has a new CLI and project layout that is aligned with Kubebuilder.
See `operator-sdk init -h` and the following doc on how to scaffold a new project:
https://v0-19-x.sdk.operatorframework.io/docs/golang/quickstart/
To migrate existing projects to the new layout see:
https://sdk.operatorframework.io/docs/building-operators/golang/project_migration_guide/
go: github.com/operator-framework/[email protected] requires
github.com/operator-framework/[email protected] requires
github.com/operator-framework/[email protected] requires
github.com/operator-framework/[email protected] requires
bitbucket.org/ww/[email protected]: reading https://api.bitbucket.org/2.0/repositories/ww/goautoneg?fields=scm: 404 Not Found
FATA[0002] Failed to build operator binary: failed to exec []string{"go", "build", "-o", "/root/wxk/postgresql-operator/build/_output/bin/postgresql-operator", "-gcflags", "all=-trimpath=/root/wxk", "-asmflags", "all=-trimpath=/root/wxk", "github.com/dev4devs-com/postgresql-operator/cmd/manager"}: exit status 1
can successfully build the image postgresql-operator for 0.1.1
Currently, the project is using Circle CI.
We would like to move forward to use Travis.
Kubernetes has been deprecating API(s), which will be removed and are no longer available in 1.22. Operators projects using these APIs versions will not work on Kubernetes 1.22 or any cluster vendor using this Kubernetes version(1.22), such as OpenShift 4.9+. Following the APIs that are most likely your projects to be affected by:
Therefore, looks like this project distributes solutions in the repository and does not contain any version compatible with k8s 1.22/OCP 4.9. (More info). Following some findings by checking the distributions published:
NOTE: The above findings are only about the manifests shipped inside of the distribution. It is not checking the codebase.
It would be very nice to see new distributions of this project that are no longer using these APIs and so they can work on Kubernetes 1.22 and newer and published in the community-operators collection. OpenShift 4.9, for example, will not ship operators anymore that do still use v1beta1 extension APIs.
Due to the number of options available to build Operators, it is hard to provide direct guidance on updating your operator to support Kubernetes 1.22. Recent versions of the OperatorSDK greater than 1.0.0 and Kubebuilder greater than 3.0.0 scaffold your project with the latest versions of these APIs (all that is generated by tools only). See the guides to upgrade your projects with OperatorSDK Golang, Ansible, Helm or the Kubebuilder one. For APIs other than the ones mentioned above, you will have to check your code for usage of removed API versions and upgrade to newer APIs. The details of this depend on your codebase.
If this projects only need to migrate the API for CRDs and it was built with OperatorSDK versions lower than 1.0.0 then, you maybe able to solve it with an OperatorSDK version >= v0.18.x < 1.0.0:
$ operator-sdk generate crds --crd-version=v1
INFO[0000] Running CRD generator.
INFO[0000] CRD generation complete.
Alternatively, you can try to upgrade your manifests with controller-gen (version >= v0.4.1) :
$ controller-gen crd:trivialVersions=true,preserveUnknownFields=false rbac:roleName=manager-role paths="./..."
Add the markers sideEffects and admissionReviewVersions to your webhook (Example with sideEffects=None and admissionReviewVersions={v1,v1beta1}: memcached-operator/api/v1alpha1/memcached_webhook.go):
Run the command:
$ controller-gen crd:trivialVersions=true,preserveUnknownFields=false rbac:roleName=manager-role webhook paths="./..."
For further information and tips see the comment.
I've followed the instructions and deployed the operator inside a custom namespace (postgresql-operator
). Logs show it's working and when deploying a Database
object inside the same namespace, it creates the deployment, service, and PVC objects, but the PVC hangs in pending status because it has no storage class.
Running database with attached dynamically provisioned volume.
Kubernetes v1.19.7 running on rke
Postgres Operator by Dev4devs v0.1.1
I have already working storage and PostgreSQL databases working with that storage classes, but it seems that the mapping to the PVC doesn't work. Here is some additional output:
> kubectl get pods -n postgresql-operator
NAME READY STATUS RESTARTS AGE
my-database-5886cc5d7c-92fqc 0/1 Pending 0 11m
postgresql-operator-767db75547-6dlpc 1/1 Running 0 67m
> kubectl describe pvc -n postgresql-operator
Name: my-database
Namespace: postgresql-operator
StorageClass:
Status: Pending
Volume:
Labels: cr=my-database
owner=postgresqloperator
Annotations: <none>
Finalizers: [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode: Filesystem
Mounted By: my-database-5886cc5d7c-92fqc
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal FailedBinding 93s (x42 over 11m) persistentvolume-controller no persistent volumes available for this claim and no storage class is set
> kubectl get sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
ceph-fs rook-ceph.cephfs.csi.ceph.com Delete Immediate false 8d
nfs-client cluster.local/nfs-nfs-client-provisioner Delete Immediate true 243d
I've read the docs, but nothing helps it seems. Any idea why? Or where to lookup?
Thanks!
I do not have default storage classes defined, and need to specify which storageclassname the pvc should request.
Have the ability to specify the storageclassname in the CRD.
.
...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.