adc apply
Definition
Reads one or more documents (each may hold several configurations separated by the --- line), renders Kubernetes objects for each specified configuration, and applies them on the server side. The created resource’s name is derived from the metadata.name configuration field and optionally provided prefix. This command is idempotent.
The rendered content depends on the kind configuration parameter:
-
Cluster configuration (
ImpalaCluster,TrinoCluster,SparkApplication,SparkHistoryServer) renders the corresponding operator CR and the supporting secrets.SparkHistoryServeradditionally renders a<metadata.name>-spark-history-propertiessecret. -
Operator configuration (
ImpalaOperator,TrinoOperator,SparkOperator,KerberosOperator) renders the Namespace, ServiceAccount, RBAC, Deployment, image pull secret if configured, and embedded CRDs. -
Helm configuration (
Celeborn,YuniKorn) renders the workloads directly:-
Celeborn— StatefulSets, Service, ConfigMap, RBAC; -
YuniKorn— k8shim Deployment, ConfigMap, RBAC.
-
Usage
$ adc apply --file <file> [--file <file>...] \
[--kubeconfig <kubeconfig>] \
[--prefix <prefix>] \
[--dry-run] \
[--only-crds | --only-rbac]
| Parameter | Description |
|---|---|
-f, --file |
Path to a configuration YAML file. Several files can be provided by repeating the flag |
-k, --kubeconfig |
Path to a kubeconfig file. The default value is |
-p, --prefix |
Prefix that will be added before |
--dry-run |
Prints the rendered object manifest without actually applying it. The default output omits the CRDs |
--only-crds |
Renders or applies only the |
--only-rbac |
Renders or applies only the |
Examples
Trino operator
Rendering the Trino operator configuration and redirecting the output to the trino-operator-render.yaml file:
$ adc apply -f trino-operator.yaml --dry-run > trino-operator-render.yaml
The rendered manifest contains no CRDs.
---
apiVersion: v1
kind: Namespace
metadata:
name: trino-operator
spec: {}
status: {}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: trino-operator
namespace: trino-operator
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: trino-operator-trino-operator-manager
namespace: trino-operator
rules:
- apiGroups:
- events.k8s.io
resources:
- events
verbs:
- create
- patch
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- trino.arenadata.io
resources:
- clusters
verbs:
- get
- list
- watch
- apiGroups:
- trino.arenadata.io
resources:
- clusters/status
verbs:
- get
- patch
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: trino-operator-trino-operator-manager
namespace: trino-operator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: trino-operator-trino-operator-manager
subjects:
- kind: ServiceAccount
name: trino-operator
namespace: trino-operator
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: trino-operator-trino-operator-payload
namespace: trino-operator
rules:
- apiGroups:
- events.k8s.io
resources:
- events
verbs:
- create
- patch
- apiGroups:
- ""
resources:
- secrets
- services
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- apps
resources:
- deployments
- statefulsets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- trino.arenadata.io
resources:
- clusters
verbs:
- get
- list
- watch
- apiGroups:
- trino.arenadata.io
resources:
- clusters/status
verbs:
- get
- patch
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: trino-operator-trino-operator-payload
namespace: trino-operator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: trino-operator-trino-operator-payload
subjects:
- kind: ServiceAccount
name: trino-operator
namespace: trino-operator
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/component: operator
app.kubernetes.io/managed-by: adc-cli
arenadata.io/operator-type: trino
name: trino-operator-trino-operator
namespace: trino-operator
spec:
selector:
matchLabels:
app.kubernetes.io/component: operator
app.kubernetes.io/managed-by: adc-cli
app.kubernetes.io/name: trino-operator-trino-operator
strategy: {}
template:
metadata:
labels:
app.kubernetes.io/component: operator
app.kubernetes.io/managed-by: adc-cli
app.kubernetes.io/name: trino-operator-trino-operator
spec:
containers:
- args:
- -ns=trino-operator
image: hub.adsw.io/ng/trino-operator:1.58.0
imagePullPolicy: Always
livenessProbe:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 5
periodSeconds: 10
name: app
readinessProbe:
httpGet:
path: /readyz
port: 8081
initialDelaySeconds: 5
periodSeconds: 10
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 500m
memory: 256Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsGroup: 10001
runAsNonRoot: true
runAsUser: 10001
securityContext:
fsGroup: 10001
runAsGroup: 10001
runAsNonRoot: true
runAsUser: 10001
serviceAccountName: trino-operator
terminationGracePeriodSeconds: 10
status: {}
Applying the Trino operator configuration:
$ adc apply -f trino-operator.yaml
Trino cluster
Rendering the Trino cluster configuration and redirecting the output to the trino-cluster-render.yaml file:
$ adc apply -f trino-cluster.yaml --dry-run > trino-cluster-render.yaml
---
apiVersion: v1
kind: Secret
metadata:
name: trino-configs
namespace: trino
stringData:
core-site.xml: |-
<configuration>
<property>
<name>dfs.client.failover.proxy.provider.adh</name>
<value>org.apache.hadoop.hdfs.server.namenode.ha.ObserverReadProxyProvider</value>
</property>
<property>
<name>dfs.ha.namenodes.adh</name>
<value>nn_tsn-adh-k8s-1,nn_tsn-adh-k8s-3</value>
</property>
<property>
<name>dfs.namenode.rpc-address.adh.nn_tsn-k8s-1</name>
<value>tsn-adh-k8s-1.ru-central1.internal:8020</value>
</property>
<property>
<name>dfs.namenode.rpc-address.adh.nn_tsn-k8s-3</name>
<value>tsn-adh-k8s-3.ru-central1.internal:8020</value>
</property>
<property>
<name>dfs.nameservices</name>
<value>adh</value>
</property>
<property>
<name>fs.defaultFS</name>
<value>hdfs://adh</value>
</property>
<property>
<name>hadoop.proxyuser.trino.groups</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.trino.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.security.authentication</name>
<value>simple</value>
</property>
<property>
<name>ozone.om.address.adh.om_tsn-k8s-1</name>
<value>tsn-adh-k8s-1.ru-central1.internal:9862</value>
</property>
<property>
<name>ozone.om.address.adh.om_tsn-k8s-2</name>
<value>tsn-adh-k8s-2.ru-central1.internal:9862</value>
</property>
<property>
<name>ozone.om.address.adh.om_tsn-k8s-3</name>
<value>tsn-adh-k8s-3.ru-central1.internal:9862</value>
</property>
<property>
<name>ozone.om.nodes.adh</name>
<value>om_tsn-adh-k8s-1,om_tsn-adh-k8s-2,om_tsn-adh-k8s-3</value>
</property>
<property>
<name>ozone.om.service.ids</name>
<value>adhom</value>
</property>
</configuration>
type: Opaque
---
apiVersion: trino.arenadata.io/v1alpha1
kind: Cluster
metadata:
name: trino
namespace: trino
spec:
configsSecretName: trino-configs
coordinator:
metadata: {}
replicas: 1
spec:
image: hub.adsw.io/adh-enterprise/trino-docker:476_arenadata2-adh-4.2.0-x86_64
imagePullPolicy: Always
worker:
metadata: {}
replicas: 1
spec:
image: hub.adsw.io/adh-enterprise/trino-docker:476_arenadata2-adh-4.2.0-x86_64
imagePullPolicy: Always
status: {}
Applying the Trino cluster configuration:
$ adc apply -f trino-cluster.yaml