-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(agent): add pod mutation webhook to inject agent (#991)
* wip: pod mutation * More agent config * wip: working without server TLS * wip: working with TLS * Work with agent callback components * Wrap webhook to never deny admission * Add tests for pod mutation webhook, related image * Refactor agent proxy service, add test * Add size limit for emptyDir volume * Resource requests, more cleanup * sample app config makefile recipe * fixup! sample app config makefile recipe * Use slices.Contains * Switch to FNV-1 hash, add service tests --------- Co-authored-by: Andrew Azores <[email protected]> Co-authored-by: Andrew Azores <[email protected]>
- Loading branch information
1 parent
e101b6a
commit c891bbe
Showing
26 changed files
with
1,828 additions
and
97 deletions.
There are no files selected for viewing
This file contains 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 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 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,93 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: quarkus-cryostat-agent | ||
name: quarkus-cryostat-agent | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: quarkus-cryostat-agent | ||
template: | ||
metadata: | ||
labels: | ||
app: quarkus-cryostat-agent | ||
cryostat.io/name: cryostat-sample | ||
cryostat.io/namespace: cryostat-operator-system | ||
spec: | ||
serviceAccountName: quarkus-cryostat-agent-serviceaccount | ||
containers: | ||
- env: | ||
- name: JAVA_OPTS_APPEND | ||
value: |- | ||
-Dquarkus.http.host=0.0.0.0 | ||
-Djava.util.logging.manager=org.jboss.logmanager.LogManager | ||
-Dio.cryostat.agent.shaded.org.slf4j.simpleLogger.defaultLogLevel=debug | ||
image: quay.io/redhat-java-monitoring/quarkus-cryostat-agent:latest | ||
imagePullPolicy: Always | ||
name: quarkus-cryostat-agent | ||
ports: | ||
- containerPort: 10010 | ||
protocol: TCP | ||
resources: | ||
limits: | ||
cpu: 500m | ||
memory: 256Mi | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
capabilities: | ||
drop: | ||
- ALL | ||
restartPolicy: Always | ||
securityContext: | ||
runAsNonRoot: true | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app: quarkus-cryostat-agent | ||
name: quarkus-cryostat-agent | ||
spec: | ||
selector: | ||
app: quarkus-cryostat-agent | ||
ports: | ||
- name: agent-http | ||
port: 9977 | ||
protocol: TCP | ||
targetPort: 9977 | ||
- name: app-http | ||
port: 10010 | ||
protocol: TCP | ||
targetPort: 10010 | ||
--- | ||
kind: ServiceAccount | ||
apiVersion: v1 | ||
metadata: | ||
name: quarkus-cryostat-agent-serviceaccount | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: quarkus-cryostat-agent-role | ||
rules: | ||
- apiGroups: | ||
- "" | ||
verbs: | ||
- create | ||
resources: | ||
- pods/exec | ||
--- | ||
kind: RoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: quarkus-cryostat-agent-role-binding | ||
subjects: | ||
- kind: ServiceAccount | ||
name: quarkus-cryostat-agent-serviceaccount | ||
roleRef: | ||
kind: Role | ||
name: quarkus-cryostat-agent-role | ||
apiGroup: rbac.authorization.k8s.io |
This file contains 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 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 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 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,32 @@ | ||
// Copyright The Cryostat Authors. | ||
// | ||
// 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 common | ||
|
||
import ( | ||
"github.com/cryostatio/cryostat-operator/internal/controllers/model" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
func AgentHeadlessServiceName(gvk *schema.GroupVersionKind, cr *model.CryostatInstance) string { | ||
return ClusterUniqueShortNameWithPrefix(gvk, "agent", cr.Name, cr.InstallNamespace) | ||
} | ||
|
||
func AgentProxyServiceName(cr *model.CryostatInstance) string { | ||
return cr.Name + "-agent" | ||
} | ||
|
||
func AgentCertificateName(gvk *schema.GroupVersionKind, cr *model.CryostatInstance, targetNamespace string) string { | ||
return ClusterUniqueNameWithPrefixTargetNS(gvk, "agent", cr.Name, cr.InstallNamespace, targetNamespace) | ||
} |
Oops, something went wrong.