Skip to content

Commit

Permalink
Merge branch 'main' into getDependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhprasad-sap committed Nov 27, 2024
2 parents ff64b7d + f8b8e47 commit b7b1ea0
Show file tree
Hide file tree
Showing 81 changed files with 1,027 additions and 667 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-website.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: "0.134.0"
hugo-version: "0.134.3"
extended: true
- name: Setup Node
uses: actions/setup-node@v4
Expand Down
11 changes: 4 additions & 7 deletions cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

promop "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned"
apiext "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
)

const (
Expand All @@ -55,11 +54,6 @@ func main() {
klog.Fatal("could not create client for custom resources: ", err.Error())
}

apiExtClient, err := apiext.NewForConfig(config)
if err != nil {
klog.Fatal("could not create client for api-extensions: ", err.Error())
}

promClient, err := promop.NewForConfig(config)
if err != nil {
klog.Fatal("could not create client for prometheus-operator resources: ", err.Error())
Expand All @@ -85,6 +79,9 @@ func main() {
klog.Fatal("could not create client for dns resources: ", err.Error())
}

// Initialize/start metrics server
util.InitMetricsServer()

// context for the reconciliation controller
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Expand Down Expand Up @@ -120,7 +117,7 @@ func main() {
Callbacks: leaderelection.LeaderCallbacks{
OnStartedLeading: func(ctx context.Context) {
klog.InfoS("Started leading: ", LeaseLockName, leaseLockId)
c := controller.NewController(coreClient, crdClient, istioClient, certClient, certManagerClient, dnsClient, apiExtClient, promClient)
c := controller.NewController(coreClient, crdClient, istioClient, certClient, certManagerClient, dnsClient, promClient)
go c.Start(ctx)
},
OnStoppedLeading: func() {
Expand Down
8 changes: 6 additions & 2 deletions cmd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ import (
func main() {
klog.SetLogger(util.GetLogger())
subHandler := getSubscriptionHandler()
http.HandleFunc("/provision/", subHandler.HandleRequest)
http.HandleFunc("/dependencies/{globalAccountId}/{appName}", subHandler.HandleGetDependenciesRequest)

http.HandleFunc("/provision/", util.InstrumentHttpHandler(subHandler.HandleRequest, "cap_op_subscription_requests", "subscription-server requests."))
http.HandleFunc("/dependencies/{globalAccountId}/{appName}", util.InstrumentHttpHandler(subHandler.HandleGetDependenciesRequest, "cap_op_dependencies_requests", "subscription-server dependencies requests."))

// Initialize/start metrics server
util.InitMetricsServer()

// Default port
port := "4000"
Expand Down
5 changes: 2 additions & 3 deletions cmd/web-hooks/internal/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"github.com/sap/cap-operator/pkg/client/clientset/versioned"
"golang.org/x/exp/slices"
admissionv1 "k8s.io/api/admission/v1"
"k8s.io/api/admission/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -698,10 +697,10 @@ func getAdmissionRequestFromBytes(w http.ResponseWriter, body []byte) *admission

func prepareResponse(w http.ResponseWriter, admissionReview *admissionv1.AdmissionReview, validation validateResource) []byte {
// prepare response object
finalizedAdmissionReview := v1beta1.AdmissionReview{}
finalizedAdmissionReview := admissionv1.AdmissionReview{}
finalizedAdmissionReview.Kind = admissionReview.Kind
finalizedAdmissionReview.APIVersion = admissionReview.APIVersion
finalizedAdmissionReview.Response = &v1beta1.AdmissionResponse{
finalizedAdmissionReview.Response = &admissionv1.AdmissionResponse{
UID: admissionReview.Request.UID,
Allowed: validation.allowed,
}
Expand Down
2 changes: 1 addition & 1 deletion crds/sme.sap.com_capapplications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.2
controller-gen.kubebuilder.io/version: v0.16.4
name: capapplications.sme.sap.com
spec:
group: sme.sap.com
Expand Down
18 changes: 13 additions & 5 deletions crds/sme.sap.com_capapplicationversions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.2
controller-gen.kubebuilder.io/version: v0.16.4
name: capapplicationversions.sme.sap.com
spec:
group: sme.sap.com
Expand Down Expand Up @@ -540,6 +540,10 @@ spec:
x-kubernetes-list-type: atomic
type: object
type: object
args:
items:
type: string
type: array
command:
items:
type: string
Expand Down Expand Up @@ -1379,10 +1383,10 @@ spec:
properties:
deletionRules:
oneOf:
- required:
- metrics
- required:
- expression
- required:
- metrics
- required:
- expression
properties:
expression:
type: string
Expand Down Expand Up @@ -3044,6 +3048,10 @@ spec:
x-kubernetes-list-type: atomic
type: object
type: object
args:
items:
type: string
type: array
backoffLimit:
format: int32
type: integer
Expand Down
2 changes: 1 addition & 1 deletion crds/sme.sap.com_captenantoperations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.2
controller-gen.kubebuilder.io/version: v0.16.4
name: captenantoperations.sme.sap.com
spec:
group: sme.sap.com
Expand Down
2 changes: 1 addition & 1 deletion crds/sme.sap.com_captenantoutputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.2
controller-gen.kubebuilder.io/version: v0.16.4
name: captenantoutputs.sme.sap.com
spec:
group: sme.sap.com
Expand Down
2 changes: 1 addition & 1 deletion crds/sme.sap.com_captenants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.2
controller-gen.kubebuilder.io/version: v0.16.4
name: captenants.sme.sap.com
spec:
group: sme.sap.com
Expand Down
74 changes: 39 additions & 35 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
module github.com/sap/cap-operator

go 1.23.1
go 1.23.3

require (
github.com/MicahParks/keyfunc/v2 v2.1.0
github.com/cert-manager/cert-manager v1.15.3
github.com/gardener/cert-management v0.15.0
github.com/gardener/external-dns-management v0.21.1
github.com/cert-manager/cert-manager v1.16.2
github.com/gardener/cert-management v0.16.0
github.com/gardener/external-dns-management v0.22.1
github.com/go-logr/logr v1.4.2
github.com/go-logr/zapr v1.3.0
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.6.0
github.com/lestrrat-go/jwx/v2 v2.1.1
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.77.0
github.com/prometheus-operator/prometheus-operator/pkg/client v0.77.0
github.com/prometheus/client_golang v1.20.4
github.com/prometheus/common v0.59.1
github.com/lestrrat-go/jwx/v2 v2.1.3
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.78.2
github.com/prometheus-operator/prometheus-operator/pkg/client v0.78.2
github.com/prometheus/client_golang v1.20.5
github.com/prometheus/common v0.60.1
go.uber.org/zap v1.27.0
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0
golang.org/x/mod v0.21.0
google.golang.org/protobuf v1.34.2
istio.io/api v1.23.2
istio.io/client-go v1.23.2
k8s.io/api v0.31.1
k8s.io/apiextensions-apiserver v0.31.1
k8s.io/apimachinery v0.31.1
k8s.io/client-go v0.31.1
k8s.io/code-generator v0.31.1
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f
golang.org/x/mod v0.22.0
google.golang.org/protobuf v1.35.2
istio.io/api v1.24.0
istio.io/client-go v1.24.0
k8s.io/api v0.31.3
k8s.io/apimachinery v0.31.3
k8s.io/client-go v0.31.3
k8s.io/code-generator v0.31.3
k8s.io/klog/v2 v2.130.1
sigs.k8s.io/structured-merge-diff/v4 v4.4.1
sigs.k8s.io/structured-merge-diff/v4 v4.4.3
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
Expand All @@ -49,6 +50,7 @@ require (
github.com/imdario/mergo v0.3.16 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/lestrrat-go/blackmagic v1.0.2 // indirect
github.com/lestrrat-go/httpcc v1.0.1 // indirect
github.com/lestrrat-go/httprc v1.0.6 // indirect
Expand All @@ -60,29 +62,31 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/term v0.24.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/time v0.6.0 // indirect
golang.org/x/tools v0.25.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240924160255-9d4c2d233b61 // indirect
golang.org/x/crypto v0.29.0 // indirect
golang.org/x/net v0.31.0 // indirect
golang.org/x/oauth2 v0.24.0 // indirect
golang.org/x/sync v0.9.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.26.0 // indirect
golang.org/x/text v0.20.0 // indirect
golang.org/x/time v0.8.0 // indirect
golang.org/x/tools v0.27.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.31.3 // indirect
k8s.io/gengo/v2 v2.0.0-20240826214909-a7b603a56eb7 // indirect
k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38 // indirect
k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 // indirect
sigs.k8s.io/controller-runtime v0.19.0 // indirect
sigs.k8s.io/gateway-api v1.1.0 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect
k8s.io/utils v0.0.0-20241104163129-6fe5fd82f078 // indirect
sigs.k8s.io/controller-runtime v0.19.2 // indirect
sigs.k8s.io/gateway-api v1.2.0 // indirect
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Loading

0 comments on commit b7b1ea0

Please sign in to comment.