Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
665 commits
Select commit Hold shift + click to select a range
16f8625
Align renovate config with openstack-operato
mrkisaolamb Jan 4, 2024
4fdd60a
Do not user the PlacementAPI CR name as the DB schema name
mrkisaolamb Jan 11, 2024
f2c967e
Use instance.Name in creating resources
mrkisaolamb Jan 11, 2024
70a7441
Set DeploymentReady to False when ReadyCount will be 0
mrkisaolamb Jan 2, 2024
cfb0ec0
Update openstack-k8s-operators
Jan 15, 2024
443b311
Watch input secret and update deployment if a relevant password changes
mrkisaolamb Jan 10, 2024
9c345b1
Ensure that DBPasswordSelector is in secret
mrkisaolamb Jan 15, 2024
dd38d7d
Update openstack-k8s-operators
Jan 22, 2024
56c1f5c
[tlse] tls for PlacementAPI pod configuration
Deydra71 Dec 7, 2023
cf582d0
[go.mod]Bump from v0.3.0 to pseudoversion
gibizer Jan 26, 2024
1cf54bf
Drop Debug fields
gibizer Feb 2, 2024
9b464d5
Reorganize main reconcile flow
mrkisaolamb Jan 15, 2024
0a36edd
Remove initcontainer and add more logs
mrkisaolamb Jan 18, 2024
2b6962c
Sync refactor with tls enable patches
mrkisaolamb Jan 26, 2024
6c757a9
Fix scripts volum issue
mrkisaolamb Feb 2, 2024
b437bcf
Change secret mounting path to allign with nova-operator
mrkisaolamb Feb 6, 2024
3f23ffd
Bump to latest mariadb-operator/api
gibizer Feb 7, 2024
69de162
[FIPS] build operator in fips mode
SeanMooney Feb 8, 2024
24bbd7f
Update openstack-k8s-operators
Feb 9, 2024
9ee07d1
Add missing logic for DefaultConfigOverwrite
gibizer Feb 8, 2024
20c6e5f
Update openstack-k8s-operators
Feb 10, 2024
8e9d664
Update controller-runtime version
Feb 6, 2024
bec9fcc
[webhook] Update webhook functions for CR update
Feb 6, 2024
37af0f4
[manager] Update manager initialisation for CR update
Feb 6, 2024
e192235
[watches] Fix watches declarations for CR update
Feb 6, 2024
eb69b51
Update to Go 1.21
Feb 6, 2024
db35921
Merge pull request #144 from bshephar/controller-runtime
gibizer Feb 14, 2024
40e7bce
Revert "Controller runtime update"
gibizer Feb 14, 2024
5114005
Merge pull request #150 from openstack-k8s-operators/revert-144-contr…
gibizer Feb 14, 2024
4224ade
Update controller-runtime version
gibizer Feb 14, 2024
a2134b9
[webhook] Update webhook functions for CR update
Feb 6, 2024
63d4841
[manager] Update manager initialisation for CR update
Feb 6, 2024
c63c334
[watches] Fix watches declarations for CR update
Feb 6, 2024
5d10ded
Update to Go 1.20
gibizer Feb 14, 2024
10d40f1
Bump envtest to 1.28 to match k8s.io
gibizer Feb 14, 2024
be6fd9c
Merge pull request #151 from gibizer/controller-runtime-0.16
gibizer Feb 14, 2024
e4421dd
Bump to compatible deps
gibizer Feb 14, 2024
8979c0b
Merge pull request #153 from gibizer/controller-runtime-0.16
abays Feb 14, 2024
19cb27d
Fix mixing go.sum lines
gibizer Feb 14, 2024
3fa74b6
Merge pull request #154 from gibizer/fix-gosum
abays Feb 14, 2024
76c9cc3
Unique LeaderElectionID
stuggi Feb 15, 2024
09e78f1
Merge pull request #155 from stuggi/election_id
gibizer Feb 15, 2024
1528c73
Bump golangci-lint
gibizer Feb 16, 2024
103e5d9
Bump golangci-lint
gibizer Feb 16, 2024
23b6cfd
[renovate]Remove golang constraint
gibizer Feb 16, 2024
c7ba29e
Regenerate go.mod indirect dependencies
gibizer Feb 19, 2024
277c435
[tlse] TLS database connection
stuggi Feb 15, 2024
f38ec81
Update openstack-k8s-operators
Feb 29, 2024
e4682e5
migrate from databaseUsername to databaseAccount
zzzeek Feb 23, 2024
7b3b736
Update openstack-k8s-operators
Mar 5, 2024
abca51f
Update module github.com/onsi/ginkgo/v2 to v2.16.0
Mar 7, 2024
74b556c
use Eventually in RunURLAssertSuite test
zzzeek Mar 5, 2024
01dd35a
Add PlacementAPISpecCore struct
dprince Mar 1, 2024
d55d421
Add PlacementAPISpecCore version of validate functions
dprince Mar 7, 2024
9f48b80
Update k8s.io/utils digest to 4693a02
Mar 10, 2024
8bde3e8
Correct ValidateUpdate for PlacementSpecCore
dprince Mar 11, 2024
125a0ef
Update openstack-k8s-operators
Mar 13, 2024
05fd035
Pin setup-envtest at working commit to unblock CI
gibizer Mar 22, 2024
5dd4297
Update module github.com/onsi/gomega to v1.32.0
Mar 27, 2024
4b3bce9
update mariadb to include finalizer secret logic
zzzeek Apr 2, 2024
e895d71
Re-init conditions each reconcile
mrkisaolamb Mar 21, 2024
6171ccc
Add Status.ObservedGeneration to Nova CR
mrkisaolamb Apr 2, 2024
56175b6
Update openstack-k8s-operators
Apr 4, 2024
abb4ebc
Ensure golangci-lint runs on all files
gibizer Apr 15, 2024
b0b8869
Update openstack-k8s-operators
Apr 20, 2024
cd7cdb7
[test] validate that TLSInputReadyCondition is ready when cert secret…
stuggi Apr 22, 2024
629de15
Move ObservedGeneration earlier in reconciliation
mrkisaolamb Apr 5, 2024
bc177b1
Update openstack-k8s-operators
Apr 24, 2024
dd236c3
Bump Placement probe timeouts
SeanMooney Apr 24, 2024
cec72da
Update openstack-k8s-operators
Apr 27, 2024
ec17b4d
Update openstack-k8s-operators
Apr 29, 2024
f585567
Update openstack-k8s-operators
Apr 30, 2024
317c2e0
[pre-commit][kuttl]Check for multiple TestAsserts
gibizer May 13, 2024
9373d85
Set fips-compliant CRD feature flag
May 20, 2024
09b4e23
Check for valid service override endpoint type on create and update
stuggi May 7, 2024
a1012b2
Update openstack-k8s-operators
May 27, 2024
baf4a5b
Wait for DB writes to propagate (causality checks)
gibizer May 29, 2024
0427a48
Update openstack-k8s-operators to 02d9d18
Jun 3, 2024
e6bef88
Correct placement flow to expose service only when deployment is ready
mrkisaolamb May 15, 2024
a0848e3
Update openstack-k8s-operators
Jun 12, 2024
130d31a
Run make bundle and commit the diff
gibizer May 28, 2024
3e932c2
[pre-commit]Run make bundle
gibizer May 28, 2024
fc9b6c4
Revert "Wait for DB writes to propagate (causality checks)"
gibizer Jun 14, 2024
0059e1f
Update openstack-k8s-operators
Jun 15, 2024
8a9d6c1
Update openstack-k8s-operators
Jun 17, 2024
5d6c777
update finalzier to CRD doc
stuggi Jun 17, 2024
93cad44
Update openstack-k8s-operators
Jun 21, 2024
70bc75e
Update functional test to simulate LB IP
stuggi Jun 21, 2024
110c8a4
Update openstack-k8s-operators
Jun 22, 2024
b72733e
Update github.com/openstack-k8s-operators/mariadb-operator/api digest…
Jun 22, 2024
93ee977
Update github.com/openstack-k8s-operators/keystone-operator/api diges…
Jun 23, 2024
6cea4ea
Ensure bundles include all the Required Infrastructure Annotations
mrkisaolamb Jun 25, 2024
dad31ef
Update openstack-k8s-operators
Jun 29, 2024
b005ecd
Update github.com/openstack-k8s-operators/keystone-operator/api diges…
Jul 3, 2024
102f9d8
Adding patch rbac perm for serviceaccounts
gibizer Jul 4, 2024
0cd5a5b
Remove the glance icon field entirely from the CSV
mrkisaolamb Jul 8, 2024
2794e8d
Update openstack-k8s-operators
Jul 9, 2024
beff215
Update openstack-k8s-operators
Jul 27, 2024
6f45354
Align restore LastTransitionTime with nova-operator
mrkisaolamb Jul 26, 2024
7214597
Update openstack-k8s-operators
Jul 30, 2024
2ad8869
Update kuttl test due to lib-common antiaffinity weight change
stuggi Jul 30, 2024
7003169
Update module github.com/onsi/gomega to v1.34.1
Aug 3, 2024
b2c41b4
Return nil error in case NAD not found to use RequeueAfter
stuggi Aug 6, 2024
0b9c315
Update openstack-k8s-operators
Aug 6, 2024
b940539
Update module github.com/onsi/ginkgo/v2 to v2.20.1
Sep 2, 2024
08bc4d4
Update k8s.io to v0.28.13
Sep 2, 2024
e8ca9af
Update tls cert secret validation due VerifyCertSecrets() change
stuggi Sep 5, 2024
49b9af3
Update openstack-k8s-operators
Sep 7, 2024
7728827
Bump golang to 1.21
mrkisaolamb Sep 16, 2024
fe50538
set GOTOOLCHAIN min version when init go.work
mrkisaolamb Sep 18, 2024
35de08a
Update openstack-k8s-operators
Sep 26, 2024
a546f33
Update module github.com/gophercloud/gophercloud to v1.14.1
Sep 26, 2024
f1910e9
Update module github.com/k8snetworkplumbingwg/network-attachment-defi…
Sep 26, 2024
d93cddc
Update openstack-k8s-operators
Sep 27, 2024
76183b2
Update github.com/openstack-k8s-operators/mariadb-operator/api digest…
Sep 28, 2024
72afc76
Update module github.com/k8snetworkplumbingwg/network-attachment-defi…
Oct 5, 2024
a162f17
Make sure to log error in findObjectsForSrc()
stuggi Oct 10, 2024
3940f1f
Update openstack-k8s-operators
Oct 12, 2024
2752a9d
Update openstack-k8s-operators
Oct 12, 2024
e25b25e
Update github.com/openstack-k8s-operators/keystone-operator/api diges…
Oct 12, 2024
160cf18
Update openstack-k8s-operators
Oct 15, 2024
f5c486a
Update openstack-k8s-operators
Oct 19, 2024
90d246f
Update module github.com/k8snetworkplumbingwg/network-attachment-defi…
Oct 19, 2024
7ba6430
Switch to use new CreateServiceReadyCondition
stuggi Oct 24, 2024
aeabdd8
Update openstack-k8s-operators
Oct 30, 2024
4f98c2a
Improve automated support for local webhooks
abays Oct 30, 2024
1aa7f6f
Update openstack-k8s-operators
Nov 2, 2024
473ad7f
Use new nad.EnsureNetworksAnnotation() func to get NAD annotations
stuggi Nov 11, 2024
ad9d6da
Set nodeSelector on jobs and allow empty nodeSelector
olliewalsh Nov 13, 2024
152a47f
Add nodeSelector functional tests
olliewalsh Nov 13, 2024
2ffefdd
Pass-through empty nodeSelector to podSpecs
olliewalsh Nov 18, 2024
92e87cb
[make][pre-commit]Check CRD schema to avoid update issues
mrkisaolamb Nov 26, 2024
64c0b4d
Update openstack-k8s-operators
Nov 30, 2024
41c654c
Use conditional assignment for BRANCH
stuggi Dec 3, 2024
1cb4393
Bump CONTROLLER_TOOLS_VERSION to 0.14.0
stuggi Dec 6, 2024
b0b5c58
crd-schema-check: allow new CRDs
stuggi Dec 12, 2024
b8f7982
Update openstack-k8s-operators
Dec 16, 2024
7ebf020
Added a parameter 'apiTimeout' to allow customization
mrkisaolamb Nov 25, 2024
e368054
Update k8s.io to v0.29.13
Jan 18, 2025
acd1c5e
Fix bad tls-certs data in octavia_tls kuttl test
mrkisaolamb Feb 13, 2025
d924212
Correct defaulting of timeout
mrkisaolamb Feb 10, 2025
f2a3a6a
Consume Topology CR by reference
fmount Feb 11, 2025
d9e6238
Use quay hosted kube-rbac-proxy image
stuggi Feb 17, 2025
b577131
Align LastAppliedTopology to TopologyRef interface
fmount Feb 19, 2025
ce12dad
.github/workflows/release-branch-sync.yaml
dprince Feb 25, 2025
470237b
Update openstack-k8s-operators
Feb 26, 2025
8401e04
Improve error handling
mrkisaolamb Feb 26, 2025
9c0a277
Switch Topology defaultLabelSelector to lib-common GetLabelSelector
fmount Feb 27, 2025
a89043b
Update openstack-k8s-operators
Mar 1, 2025
c6de024
Update github.com/openstack-k8s-operators/keystone-operator/api diges…
Mar 2, 2025
74e5a77
[functional] verify LastAppliedTopology != nil before checking name
stuggi Mar 7, 2025
6c581c9
Update openstack-k8s-operators
Mar 9, 2025
952e400
Improve webhook validation for topology references
fmount Mar 20, 2025
4b59b29
Update openstack-k8s-operators
Mar 22, 2025
1846a50
add zuul noop jobs
SeanMooney Mar 27, 2025
6af9926
Add ratailor and auniyal61 to OWNERS
mrkisaolamb Dec 4, 2024
50b0d2d
remove placeholder design section from the readme
SeanMooney Mar 27, 2025
8ea983e
Improve topology testing coverage
fmount Mar 29, 2025
d7589ed
Update openstack-k8s-operators
Mar 29, 2025
5a2b5b0
Update module github.com/k8snetworkplumbingwg/network-attachment-defi…
Mar 29, 2025
c57f14d
Update openstack-k8s-operators
Apr 5, 2025
491fcf5
Update github.com/openstack-k8s-operators/keystone-operator/api diges…
Apr 6, 2025
2260f65
Add make force-bump target
dprince Apr 10, 2025
eb39814
[run-with-webhook] Handle operator deploy by Openstack initialization
karelyatin Mar 26, 2025
0be044c
Use deployment.IsReady() to validate status
stuggi Apr 3, 2025
4084ee0
Optmize handling topology logic
fmount Apr 2, 2025
a75c3a6
Fix go.mod checksum mismatch
fmount Apr 20, 2025
71b8367
Update openstack-k8s-operators
Apr 20, 2025
24232c1
Add force-bump-pull-request workflows
dprince Apr 28, 2025
3b5a354
Update openstack-k8s-operators
Apr 26, 2025
f410002
Leader election lease tunables
hjensas May 6, 2025
92fbde8
Update openstack-k8s-operators (main)
May 10, 2025
60e545f
Do not update the status when reconciler exits due to panic
ratailor May 14, 2025
5e5cec1
Update openstack-k8s-operators (main)
May 24, 2025
828660d
Watch KeystoneAPI status updates to reconcile
stuggi Jun 4, 2025
b5d97cd
Add pprof-bind-address option to main.go
dprince Jun 18, 2025
b42001c
Update openstack-k8s-operators (main)
Jul 5, 2025
cc18ad9
Update module github.com/k8snetworkplumbingwg/network-attachment-defi…
Jun 28, 2025
bd3b1fa
Update openstack-k8s-operators (main)
Jul 12, 2025
18bb507
Use structured logging
ratailor Jul 17, 2025
ebc7c6c
bump rabbitmq-cluster-operator
stuggi Jul 28, 2025
f145b1b
Update openstack-k8s-operators (main)
Aug 2, 2025
f06f468
Update openstack-k8s-operators (main)
Aug 9, 2025
07cef1f
Update openstack-k8s-operators (main)
Aug 16, 2025
fc5e0dc
Remove Lewis from ci-approvers
ninja-quokka Aug 19, 2025
c4fec92
Update openstack-k8s-operators (main)
Aug 23, 2025
ef8252d
[OSPRH-19382] Remove deprecated Kustomize fields in config dir
abays Aug 25, 2025
9b06715
Make local webhook port configurable
karelyatin Sep 5, 2025
9af9441
bump to golang 1.24
stuggi Apr 16, 2025
d45b0a5
Bump dependencies for OpenShift 4.18 compatibility
stuggi Aug 22, 2025
064016d
bump openstack-k8s-operator dependencies
stuggi Sep 17, 2025
253a923
Modernize Go code with latest style conventions
fmount Sep 26, 2025
38db004
[OSPRH-20438] Improve consistency of condition severity usage
abays Oct 1, 2025
bb54c58
Bump rabbitmq-cluster-operator dependency
stuggi Oct 1, 2025
e2ac6e7
Update module github.com/onsi/gomega to v1.38.2
Oct 2, 2025
ece162f
Update openstack-k8s-operators (main)
Oct 4, 2025
fa4569f
Update module github.com/onsi/ginkgo/v2 to v2.26.0
Oct 6, 2025
2cfb6ac
Use setup-envtest@release-0.22
abays Oct 15, 2025
8f2a009
Update openstack-k8s-operators (main)
Oct 25, 2025
91ea3e3
Update openstack-k8s-operators (main)
Nov 1, 2025
9703bd9
Update module github.com/onsi/ginkgo/v2 to v2.27.2
Nov 1, 2025
72d3e03
Pin base image to 9.6 tag
stuggi Nov 12, 2025
f68619f
Upgrade to Operator SDK 1.41.1
stuggi Nov 17, 2025
6e6e780
Add pprof-bind-address flag support
stuggi Nov 25, 2025
b7227c0
Re-add --webhook-bind-address flag
stuggi Nov 25, 2025
d5a5860
Update openstack-k8s-operators (main)
Dec 6, 2025
5feb997
Update k8s.io 0.31.x replaces to v0.31.14
Dec 6, 2025
b86d94b
Update openstack-k8s-operators (main)
Dec 20, 2025
468b0c1
Update module github.com/onsi/gomega to v1.38.3
Dec 20, 2025
4bf3995
Update module github.com/onsi/ginkgo/v2 to v2.27.3
Dec 21, 2025
b32bdc4
Update openstack-k8s-operators (main)
Dec 27, 2025
43d0de9
Update openstack-k8s-operators (main)
Jan 3, 2026
0925ca0
Bump golangci-lint to 2.7.2
dprince Dec 19, 2025
9839ad6
Update module github.com/onsi/ginkgo/v2 to v2.27.4
Jan 10, 2026
473c257
Update openstack-k8s-operators (main)
Jan 10, 2026
4e8207d
Update module github.com/onsi/gomega to v1.39.0
Jan 11, 2026
b76fe3a
Remove Ollie from owners
abays Jan 23, 2026
78401c7
Update openstack-k8s-operators (main)
Jan 24, 2026
ebac739
Add region_name support to Placement API config
vakwetu Jan 19, 2026
a96a9fd
Application Credential support
xek Jan 29, 2026
7ac7336
Remove ci-approvers from OWNERS and OWNERS_ALIAS
amartyasinha Feb 3, 2026
6dbf58c
Update openstack-k8s-operators (main)
Feb 7, 2026
5302e13
Update module github.com/onsi/ginkgo/v2 to v2.28.1
Feb 7, 2026
eee74ba
Update module github.com/onsi/gomega to v1.39.1
Feb 9, 2026
1423f6a
Allow triggering the build workflow manually of needed
stuggi Feb 10, 2026
43126a6
Sync envtest optimization across all operators
stuggi Feb 12, 2026
8ed126c
Update openstack-k8s-operators (main)
Feb 14, 2026
0cfd100
Update openstack-k8s-operators (main)
Feb 28, 2026
bdc0a28
Update openstack-k8s-operators (main)
Mar 7, 2026
d33189a
Update openstack-k8s-operators (main)
Mar 14, 2026
6ecd622
Update openstack-k8s-operators (main)
Mar 21, 2026
739610b
Update openstack-k8s-operators (main)
Apr 4, 2026
ab0391e
Import and merge placement-operator with rewritten history
auniyal61 Apr 9, 2026
41f78a4
Move placement API to multi-group structure
auniyal61 Apr 8, 2026
d34a935
Move placement controller
auniyal61 Apr 8, 2026
893d5a6
Move placement business logic to internal/placement
auniyal61 Apr 8, 2026
b1b87b0
Move placement webhook
auniyal61 Mar 27, 2026
a2c9caf
Move templates
auniyal61 Mar 27, 2026
ccd3d03
Move placement tests and setup kuttl test suite
auniyal61 Apr 9, 2026
ab0d8d5
Add placement kuttl test dependencies
auniyal61 Apr 9, 2026
2bf32b6
Rename placement files to remove redundant prefix
auniyal61 Apr 8, 2026
22a72ec
Update placement import paths and test package names
auniyal61 Mar 27, 2026
ebc5370
Move placement sample files from placement-operator
auniyal61 Apr 8, 2026
43ab656
Update Makefile to generate placement manifests
auniyal61 Apr 8, 2026
67b9f33
Register PlacementAPI controller and webhook into nova-operator
auniyal61 Apr 1, 2026
9a6df42
Fix codespell typos in placement code
auniyal61 Apr 6, 2026
44ac326
placement webhook manifests in config/webhook
auniyal61 Apr 7, 2026
08ba286
Updates placement template paths for multi-group structure
auniyal61 Apr 7, 2026
2b16a55
Cleanup placement-import and add generated manifests
auniyal61 Apr 8, 2026
081967e
Keep only the base sample in kustomization
auniyal61 Apr 8, 2026
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
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,13 @@ docker-buildx: ## Build and push docker image for the manager for cross-platform

.PHONY: manifests
manifests: gowork controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases && \
$(CONTROLLER_GEN) crd webhook paths="./api/nova/..." paths="./api/placement/..." paths="./internal/webhook/nova/..." paths="./internal/webhook/placement/..." output:crd:artifacts:config=config/crd/bases output:webhook:artifacts:config=config/webhook && \
$(CONTROLLER_GEN) rbac:roleName=manager-role paths="./..." output:dir=config/rbac && \
rm -f api/bases/* && cp -a config/crd/bases api/

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./api/nova/..." paths="./api/placement/..."

.PHONY: fmt
fmt: ## Run go fmt against code.
Expand Down Expand Up @@ -147,10 +148,12 @@ PROCS?=$(shell expr $(shell nproc --ignore 2) / 2)
PROC_CMD = --procs ${PROCS}

.PHONY: test
# TODO: Currently runs all tests (Nova + Placement). In future, optimize CI to run only tests
# for the operator code that changed (e.g., skip Placement tests if only Nova code changed).
test: manifests generate fmt vet envtest ginkgo ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) -v debug --bin-dir $(LOCALBIN) use $(ENVTEST_K8S_VERSION) -p path)" \
OPERATOR_TEMPLATES="$(PWD)/templates" \
$(GINKGO) --trace --cover --coverpkg=../../internal/...,../../api/nova/v1beta1 --coverprofile cover.out --covermode=atomic --randomize-all ${PROC_CMD} $(GINKGO_ARGS) ./test/...
$(GINKGO) --trace --cover --coverpkg=../../internal/...,../../api/nova/v1beta1,../../api/placement/v1beta1 --coverprofile cover.out --covermode=atomic --randomize-all ${PROC_CMD} $(GINKGO_ARGS) ./test/...

##@ Build

Expand Down
502 changes: 502 additions & 0 deletions api/bases/placement.openstack.org_placementapis.yaml

Large diffs are not rendered by default.

259 changes: 259 additions & 0 deletions api/placement/v1beta1/api_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
/*
Copyright 2022.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1beta1

import (
topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
"github.com/openstack-k8s-operators/lib-common/modules/common/service"
"github.com/openstack-k8s-operators/lib-common/modules/common/tls"
"github.com/openstack-k8s-operators/lib-common/modules/common/util"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/validation/field"
)

const (
// DbSyncHash hash
DbSyncHash = "dbsync"

// DeploymentHash hash used to detect changes
DeploymentHash = "deployment"

// Container image fall-back defaults

// PlacementAPIContainerImage is the fall-back container image for PlacementAPI
PlacementAPIContainerImage = "quay.io/podified-antelope-centos9/openstack-placement-api:current-podified"
)

// PlacementAPISpec defines the desired state of PlacementAPI
type PlacementAPISpec struct {
PlacementAPISpecCore `json:",inline"`

// +kubebuilder:validation:Required
// PlacementAPI Container Image URL (will be set to environmental default if empty)
ContainerImage string `json:"containerImage"`
}

// PlacementAPISpecCore -
type PlacementAPISpecCore struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default=60
// +kubebuilder:validation:Minimum=10
// APITimeout for HAProxy, Apache
APITimeout int `json:"apiTimeout"`

// +kubebuilder:validation:Optional
// +kubebuilder:default=placement
// ServiceUser - optional username used for this service to register in keystone
ServiceUser string `json:"serviceUser"`

// +kubebuilder:validation:Required
// MariaDB instance name
// Right now required by the maridb-operator to get the credentials from the instance to create the DB
// Might not be required in future
DatabaseInstance string `json:"databaseInstance"`

// +kubebuilder:validation:Optional
// +kubebuilder:default=placement
// DatabaseAccount - name of MariaDBAccount which will be used to connect.
DatabaseAccount string `json:"databaseAccount"`

// +kubebuilder:validation:Optional
// +kubebuilder:default=1
// +kubebuilder:validation:Maximum=32
// +kubebuilder:validation:Minimum=0
// Replicas of placement API to run
Replicas *int32 `json:"replicas"`

// +kubebuilder:validation:Required
// Secret containing OpenStack password information for placement PlacementPassword
Secret string `json:"secret"`

// +kubebuilder:validation:Optional
// +kubebuilder:default={service: PlacementPassword}
// PasswordSelectors - Selectors to identify the DB and ServiceUser password from the Secret
PasswordSelectors PasswordSelector `json:"passwordSelectors"`

// +kubebuilder:validation:Optional
// NodeSelector to target subset of worker nodes running this service
NodeSelector *map[string]string `json:"nodeSelector,omitempty"`

// +kubebuilder:validation:Optional
// +kubebuilder:default=false
// PreserveJobs - do not delete jobs after they finished e.g. to check logs
PreserveJobs bool `json:"preserveJobs"`

// +kubebuilder:validation:Optional
// CustomServiceConfig - customize the service config using this parameter to change service defaults,
// or overwrite rendered information using raw OpenStack config format. The content gets added to
// to /etc/<service>/<service>.conf.d directory as custom.conf file.
CustomServiceConfig string `json:"customServiceConfig"`

// +kubebuilder:validation:Optional
// DefaultConfigOverwrite - interface to overwrite default config files like policy.yaml.
DefaultConfigOverwrite map[string]string `json:"defaultConfigOverwrite,omitempty"`

// +kubebuilder:validation:Optional
// Resources - Compute Resources required by this service (Limits/Requests).
// https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Resources corev1.ResourceRequirements `json:"resources,omitempty"`

// +kubebuilder:validation:Optional
// NetworkAttachments is a list of NetworkAttachment resource names to expose the services to the given network
NetworkAttachments []string `json:"networkAttachments,omitempty"`

// +kubebuilder:validation:Optional
// Override, provides the ability to override the generated manifest of several child resources.
Override APIOverrideSpec `json:"override,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// TLS - Parameters related to the TLS
TLS tls.API `json:"tls,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// Auth - Parameters related to authentication
Auth AuthSpec `json:"auth,omitempty"`

// +kubebuilder:validation:Optional
// TopologyRef to apply the Topology defined by the associated CR referenced
// by name
TopologyRef *topologyv1.TopoRef `json:"topologyRef,omitempty"`
}

// APIOverrideSpec to override the generated manifest of several child resources.
type APIOverrideSpec struct {
// Override configuration for the Service created to serve traffic to the cluster.
// The key must be the endpoint type (public, internal)
Service map[service.Endpoint]service.RoutedOverrideSpec `json:"service,omitempty"`
}

// AuthSpec defines authentication parameters
type AuthSpec struct {
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// ApplicationCredentialSecret - Secret containing Application Credential ID and Secret
ApplicationCredentialSecret string `json:"applicationCredentialSecret,omitempty"`
}

// PasswordSelector to identify the DB and AdminUser password from the Secret
type PasswordSelector struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default="PlacementPassword"
// Service - Selector to get the service user password from the Secret
Service string `json:"service"`
}

// PlacementAPIStatus defines the observed state of PlacementAPI
type PlacementAPIStatus struct {
// ReadyCount of placement API instances
ReadyCount int32 `json:"readyCount,omitempty"`

// Map of hashes to track e.g. job status
Hash map[string]string `json:"hash,omitempty"`

// Conditions
Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"`

// Placement Database Hostname
DatabaseHostname string `json:"databaseHostname,omitempty"`

// NetworkAttachments status of the deployment pods
NetworkAttachments map[string][]string `json:"networkAttachments,omitempty"`

//ObservedGeneration - the most recent generation observed for this service. If the observed generation is less than the spec generation, then the controller has not processed the latest changes.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`

// LastAppliedTopology - the last applied Topology
LastAppliedTopology *topologyv1.TopoRef `json:"lastAppliedTopology,omitempty"`
}

// PlacementAPI is the Schema for the placementapis API
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="NetworkAttachments",type="string",JSONPath=".spec.networkAttachments",description="NetworkAttachments"
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[0].status",description="Status"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[0].message",description="Message"
type PlacementAPI struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec PlacementAPISpec `json:"spec,omitempty"`
Status PlacementAPIStatus `json:"status,omitempty"`
}

// PlacementAPIList contains a list of PlacementAPI
// +kubebuilder:object:root=true
type PlacementAPIList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []PlacementAPI `json:"items"`
}

func init() {
SchemeBuilder.Register(&PlacementAPI{}, &PlacementAPIList{})
}

// IsReady - returns true if PlacementAPI is reconciled successfully
func (instance PlacementAPI) IsReady() bool {
return instance.Status.Conditions.IsTrue(condition.ReadyCondition)
}

// RbacConditionsSet - set the conditions for the rbac object
func (instance PlacementAPI) RbacConditionsSet(c *condition.Condition) {
instance.Status.Conditions.Set(c)
}

// RbacNamespace - return the namespace
func (instance PlacementAPI) RbacNamespace() string {
return instance.Namespace
}

// RbacResourceName - return the name to be used for rbac objects (serviceaccount, role, rolebinding)
func (instance PlacementAPI) RbacResourceName() string {
return "placement-" + instance.Name
}

// SetupDefaults - initializes any CRD field defaults based on environment variables (the defaulting mechanism itself is implemented via webhooks)
func SetupDefaults() {
// Acquire environmental defaults and initialize Placement defaults with them
placementDefaults := PlacementAPIDefaults{
ContainerImageURL: util.GetEnvVar("RELATED_IMAGE_PLACEMENT_API_IMAGE_URL_DEFAULT", PlacementAPIContainerImage),
APITimeout: 60,
}

SetupPlacementAPIDefaults(placementDefaults)
}

// GetSecret returns the value of the Nova.Spec.Secret
func (instance PlacementAPI) GetSecret() string {
return instance.Spec.Secret
}

// ValidateTopology -
func (instance *PlacementAPISpecCore) ValidateTopology(
basePath *field.Path,
namespace string,
) field.ErrorList {
var allErrs field.ErrorList
allErrs = append(allErrs, topologyv1.ValidateTopologyRef(
instance.TopologyRef,
*basePath.Child("topologyRef"), namespace)...)
return allErrs
}
Loading
Loading